• 沒有找到結果。

Chapter 2 A New Data Hiding Technique via Secret-fragment-visible Mosaic

2.4 Algorithms of Proposed Method

Based on the above discussions, the detailed algorithms for mosaic image creation and secret image recovery may now be described as follows.

Algorithm 2.1. Mosaic image creation.

Input: a secret image S, a pre-selected target image T, and a secret key K.

Output: a secret-fragment-visible mosaic image F.

Steps:

Stage 1 - fitting the tile images into the target blocks.

Step 1. If the size of the target image T is different from that of the secret image S, change the size of T to be identical to that of S; and divide the secret image S into n tile images {T1, T2, …, Tn} as well as the target image T into n target blocks {B1, B2, …, Bn} with each Ti or Bi being of size NT.

Step 2. Compute the means and the standard deviations of each tile image Ti and each target block Bj for the three color channels according to (1) and (2); and compute accordingly the average standard deviations for Ti and Bj, respectively, where i = 1 through n and j = 1 through n.

Step 3. Sort the tile images in the set Stile = {T1, T2, …, Tn} and the target blocks in the set Starget = {B1, B2, …, Bn} according to the computed average standard deviation values of the blocks; map in order the blocks in the sorted Stile to those in the sorted Starget in a 1-to-1 manner; and reorder the mappings according to the indices of the tile images, resulting in a mapping sequence L of the form: T1 → Bj1, T2 → Bj2, …, Tn  Bjn.

Step 4. Create a mosaic image F by fitting the tile images into the corresponding target blocks according to L.

Stage 2 - performing color conversions between the tile images and the target blocks.

Step 5. Create a counting table TB with 256 entries, each with an index corresponding to a residual value, and assign an initial value of zero to each entry (note that each residual value will be in the range of 0 to 255).

Step 6. For each mapping Ti → Bji in sequence L, represent the means c and c′ of Ti and Bji, respectively, by eight bits; and represent the standard deviation quotient qc appearing in (3) by seven bits, according to the scheme described in Section 2.3(A) where c = r, g, or b.

Step 7. For each pixel pi in each tile image Ti of mosaic image F with color value ci

where c = r, g, or b, transform ci into a new value ci′′ by (3); if ci′′ is not

smaller than 255 or if it is not larger than 0, then change ci′′ to be 255 or 0, respectively; compute a residual value Ri for pixel pi by the way described in Section 2.3(C); and increment by 1 the count in the entry in the counting table TB whose index is identical to Ri.

Stage 3 - rotating the tile images.

Step 8. Compute the RMSE values of each color-transformed tile image Ti in F with respect to its corresponding target block Bji after rotating Ti into each of the directions  = 0o, 90o, 180o and 270o in the luminance channel; and rotate Ti

into the optimal direction o with the smallest RMSE value.

Stage 4 - embedding the secret image recovery information.

Step 9. Construct a Huffman table HT using the content of the counting table TB to encode all the residual values computed previously.

Step 10. For each tile image Ti in mosaic image F, construct a bit stream Mi for recovering Ti in the way as described in Section 2.3(D), including the bit-segments which encode the data items of: 1) the index of the corresponding target block Bji; 2) the optimal rotation angle  of Ti; 3) the means of Ti and Bji and the related standard deviation quotients of all three color channels; and 4) the bit sequence for overflows/underflows with residuals in Ti encoded by the Huffman table HT constructed in Step 9.

Step 11. Concatenate the bit streams Mi of all Ti in F in a raster-scan order to form a total bit stream Mt; use the secret key K to encrypt Mt into another bit stream Mt′; and embed Mt′ into F by the reversible contrast mapping scheme proposed in [44].

Step 12. Construct a bit stream  including: 1) the number of conducted iterations Ni

for embedding Mt′; 2) the number of pixel pairs Npair used in the last iteration; and 3) the Huffman table HT constructed for the residuals; and embed the bit stream I into mosaic image F by the same scheme used in Step 11.

Algorithm 2.2. Secret image recovery.

Input: a mosaic image F with n tile images {T1, T2, …, Tn} and the secret key K.

Output: the secret image S.

Steps:

Stage 1 - extracting the secret image recovery information.

Step 1. Extract from F the bit stream I by a reverse version of the scheme proposed in [44] and decode them to obtain the following data items: 1) the number of iterations Ni for embedding Mt′; 2) the total number of used pixel pairs Npair

in the last iteration; and 3) the Huffman table HT for encoding the values of the residuals of the overflows or underflows.

Step 2. Extract the bit stream Mt′ using the values of Ni and Npair by the same scheme used in the last step.

Step 3. Decrypt the bit stream Mt′ into Mt by K.

Step 4. Decompose Mt into n bit streams M1 through Mn for the n to-be-constructed tile images T1 through Tn in S, respectively.

Step 5. Decode Mi for each tile image Ti to obtain the following data items: 1) the index ji of the block Bji in F corresponding to Ti; 2) the optimal rotation angle  of Ti; 3) the means of Ti and Bji and the related standard deviation quotients of all color channels; and 4) the overflow/underflow residual values in Ti decoded by the Huffman table HT.

Stage 2 - recovering the secret image.

Step 6. Recover one by one in a raster-scan order the tile images Ti, i = 1 through n, of the desired secret image S by the following steps: 1) rotate in the reverse direction the block indexed by ji, namely Bji, in F through the optimal angle

and fit the resulting block content into Ti to form an initial tile image Ti; 2) use the extracted means and related standard deviation quotients to recover the original pixel values in Ti according to (4); 3) use the extracted means, standard deviation quotients, and (5) to compute the two parameters cS and cL; 4) scan Ti to find out pixels with values 255 or 0 which indicate that overflows or underflows, respectively, have occurred there; 5) add respectively the values cS or cL to the corresponding residual values of the found pixels; and 6) take the results as the final pixel values, resulting in a final tile image Ti.

Step 7. Compose all the final tile images to form the desired secret image S as output.