Basic knowledge
1. Haar wavelet transform
For a 8 bits grayscale-valued pair(x,y), 0<= x,y <= 255,define their integer average l and difference h as
l = floor ((x+y)/2)
h = x-y
The inverse transform is
x = l + floor ((h + 1)/2)
y = l
-floor (h/2)
2. Two definitions
Expandable: a difference value h is expandable under the integer average value l if
|2*h+b|<=min (2(255-l), 2l+1) for both b = 0 and 1
Changeable: a difference value h is changeable under the integer average value l if
|2*floor (h/2) +b| <=min (2(255-l), 2l+1)
Encode
1. Make pairs
Pairs = reshape(I,2,size(I,1)*size(I,2));
This makes the original image into a 2 rows size (I, 1)*size (I, 2) columns matrix, every column is a pair.
2. Calculate h and l
h = floor ((pairs (1, :) - pairs (2, :));
l = floor ((pairs (1, :) + pairs (2, :)) /2) ;
3. Get C,NC,E,NE,Tn,Tp
Here, maybe we have to test some values of Tn and Tp to make sure that the size of payload is small than the embedding capacity. Steps 3,4,5 is correlated with each other.
4.Get location map and compress location map
For an h in selected expandable, we assign an value 1 in location map, for other h, assign a value 0.using Jbig2 to compress the location map.
5.Compute capacity
We compute the embedding capacity. The size of payload should small than embedding capacity.
6. data embedding.
Embedding data to the pixels that are expandable and changeable.
For selected expandable H = 2*h + bit
For other expandable and changeable H = 2*floor (h/2) + bit
Decode
1.
Make pairs
2. Calculate h and l
Steps 1 and 2 are similar as encoder
’
s step 1 and 2.
3. Get C, NC
There are two important features:
(1)An expandable difference value h is changeable, after the DE,the expanded difference value h' is changeable too.
(2)For a changeable difference value h,if we modify its LSB,the difference value after modification is still changeable.
So,the C set is an invariant set.
4. Recover data from C
select all LSBs of all difference values in C,and form binary bitstream B = b1b2...
5. Get location map
From B ,we can get location map.
6. Recover original h ,Data
we can recover original h and get Data using location map.
7. Get original Image
Get original Image using original h and l.