REVERSIBLE WATERMARKING BASED ON SORTING PREDICTION ALGORITHM

Reversible watermarking has drawn a lot of interest in recent years. Sachnev et al proposed reversible watermarking algorithm by combining prediction technology, histogram shifting technology and sorting technology, which has good performance. However, their method is against the characteristics of the human visual system. In this paper, we propose a reversible watermarking algorithm to improve Sachnev et al algorithm by using new sorting method. The performance of the proposed reversible watermarking algorithm is evaluated and compared with Sachnev et al method and other methods. The results indicate that the proposed algorithmhas good performance than Sachnev et al method and can embed data with less distortion.

technology, histogram shifting technology, sorting technology and put forward sorting prediction scheme, which has the best effect among all the mentioned reversible watermarking algorithms.The basic thought of the above algorithm came from Tian's Difference Expansion Method.By extending the vacant position for the watermark embedding, and in order to reduce the distortion, the watermarks are usually embedded on the smooth pixel block, because the smooth area pixel values are close, so that it can provide smaller pixel difference or predict error value.However, embedding watermark in the smooth area is against the characteristics of the human visual system (HVS), since human visual system is not too sensitive to the change of texture in complex area, but is more sensitive to the change of smooth zone.(Kotvicha et al., 2012) developed the technique of sorting absolute prediction error (APE).They used local variance values in predicting APE.This algorithm decreases image distortion and increases the visual quality.(Afsharizadeh and Mohammadi, 2013) extended Sachnev et al scheme by proposing a new sorting technique to improve the hiding capacity and visual quality.They used a new measure for sorting the cells and achieved good performance.

SACHNEV ALGORITM
Sachnev and other members put up with a comprehensive reversible embedding-watermark algorithm based on prediction and sorting by combining histogram shifting algorithm.Compared with other reversible watermarking algorithms, this algorithm has better effect.The following briefly describe the main contents of Sachnev algorithm:

PREDICTION ALGORITHM
We classify all the pixels of image into two groups: one group for embedding-watermark, the other for predictive-value calculation.In Figure 1, five pixels constitute a mark for information embedding, the middle one among which is for embedding-watermark; other four pixels are used to calculate predictive-value , ′ , which can be calculated through the following formula: Then, to calculate the prediction-error: Then, embed the watermark by expanding prediction-error: b means 1 bit of information, "0" or "1". , is the prediction-error after embedding-watermark.The pixel-value  , after  , takes embedding-watermark: , =  , +  , ′ (4) After the embedding-watermark, extracting-watermark is the inverse process of embedding-watermark.As at the end of embedding-watermark, the four pixel-values used for predict do not change, thus the predictive-value  , ′ does not change which can be calculated out with the four pixels.The watermark-information b and the original pixel-value can be calculated out through the predicted-value  , ′ and the pixel-value  , after the embedding watermark.
, =  , −  , ′ (5) Figure 1.Prediction pattern The embedded watermark-information can be calculated though the following formula: The prediction-error before embedding watermark: The pixel-value of host pixel: Thus extracting-watermark and the recovery of host image have been completed.

HISTOGRAM SHIFTING
The algorithm put up by Sachnev used the Histogram-shifting algorithm proposed by Thodi and other members.Histogram-shifting algorithm is a more effective reversible embedding-watermark algorithm, which is often used to avoid the problem of value overlapping for the enlargement of value difference.This algorithm uses two threshold values, namely lower limitTnand upper limit value Tp.All the prediction-error value between [Tn,Tp] will be used to enlarge for embedding-watermark.Those prediction-error values outside the interval will be shifted to avoid the problem of value overlapping for the enlargement of value difference.
The watermark can be extracted and the host-image pixel-value can be recovered at the end of extracting-watermark according to the following formula: The embedded capacity can be controlled by controlling the value of Tn, Tp, but the distortion of the image will be influenced when the capacity is controlled.Therefore, it's very important to choose a suitable threshold limit value.

SORTING ALGORITHM
To ensure distortion of image to the least after embedding-watermark, the order of embedding-watermark in the image becomes very important.Therefore, to take embedding-watermark in order from the up to down or the left to the right for the pixel-blocks which can take embedding-watermark to sort effectively can minimize the distortion of the image.The sorting-method put up by Sachnev and other members calculate a variance yield according to the pixel-value for prediction in each pixel-block, and then sort according to the variance yield.The formula to calculate variance yield is: Where, Reversible watermarking based on sorting prediction algorithm 123 Refer to figure 1, in the above formula,  , can be calculated with the pixel-value for prediction.
As the pixel-value for prediction doesnot change after embedding-watermark, the embedding-watermark doesnot change.

PROPOSED ALGORITHM
The sorting-method put up by Sachnev applies  , as asorting-parameter has a good effect.However, the proposed sorting algorithm in this paper comes out with better results than Sanchevalgorithm.The value of  , is the difference variance of the four pixel-values for prediction.The difference variance of these four pixel-blocks can reflect the smooth level of the pixel-block.If  , is small, it means the pixel-block is smooth.If  , is big, it means the pixel-block is rich in textures.The core concept of sorting according to the variance value is to calculate the value of prediction-error for prediction,it can be used to compare the smooth level of the pixel-block for prediction, the value of prediction-error in smooth pixel-block is relatively less,but  , is not the best sorting algorithm for predicting the value of prediction-error.
The sorting-parameter  , ′ used in the proposed algorithm is more accurately and effectively in predicting the value of prediction-error.
In equation ( 12)   stands for the four pixel-values for prediction in Figure 1, ̅  means the mean value of the four pixel-values, while  , is the variance value of the four pixels.The formula to calculate the prediction-error value is  , =  , −  , ′ , in which  , ′ is the predictive-value of the four pixel-values mentioned above.Prediction-error is achieved through the pixel-value minus the mean value of these four pixels, and  , is the variance of the four pixel-values.Thus  , ′ is suitable to predict the value of prediction-error.There are two key features: 1.The value of  , ′ keeps the same after embedding-watermark.
2. The value of  , ′ can predict the value of prediction-error more accurately.

HVS-BASED EMBEDDING-WATERMARK ALGORITHM
Considering the influence of HVS, people are very sensitive to the change in the even area while not that sensitive to the change in the area rich in textures, therefore, the embedding-watermark in texture area can improve the visual quality greater.However, less distortion of image is brought out after embedding-watermark.As the pixel-values differs greatly in the texture area, the prediction-error value offered is big, thus there is a big image distortion when reversible-watermarking-algorithm is embedded by the method of enlargement.Therefore, we suggest embedding-watermark of the smooth pixel-block in the texture area, choosing the smooth pixel-block in the big texture area to take embedding-watermark first.Thus it can ensure to get a higher visual quality at the same distortion level.Divide the image into 64 blocks before embedding-watermark.The images tested in the proposed method are 512×512, therefore, each block contains 64×64 pixels.Then calculate the variance of each block to sort.To ensure the parameters sorting not to change before or after embedding-watermark, here the predictive pixels only are chosen among each block for calculating the variance of this block: The prediction-error value of the same level means the image distortion is the same in embedding-watermark.However, these values may lie in the texture area or the smooth area.In this condition, if the pixel in texture area can take embedding-watermark first, it can bring a higher visual quality.
In formula 14, C is a constant value, meaning 64 here.As the image is divided into 64 blocks in the paper, C is the number of blocks after the image being divided and i is the parameter of each block mentioned above.The main function of C is to identify different sorting space whileKi is to identify the embedding order of pixel in the same sorting-parameter.
At the end of embedding-watermark, partial additional information, e.g. the embedding capacity, should be added onto the watermark in order to extract the watermark correctly.Then the capacity we embedded can end the extracting-watermark when the extracting-watermark extracts.In extracting-watermark, we should divide the image into 64 blocks first and then we calculate the MSE of each block.Then we sort each block according to the MSE and give each of them a parameter   . = and 1 ≤   ≤ 64.As only the still embedding-watermark is chosen to calculate MSE, the pixel-value for prediction, the MSE of each block at the end of extracting-watermark and the value at the embedding-watermark is the same.As the value of  , ′ embedding-watermark doesnot change, the value of  , remains before and after embedding-watermark.Therefore, a same sorting result as that of embedding-watermark end can be achieved through sorting with  , at the end of extracting-watermark, which is the precondition for the normal extracting-watermark.

HVS-BASED REVERSIBLE-WATERMARKING-ALGORITHM
The proposed algorithm mainly states the embedding-watermark and the detail extraction pattern by the major techniques mentioned above.

A. EMBEDDING-WATERMARK
Step 1: Classify all the pixels into two groups, one for embedding-watermark, and the other for prediction.Then divide the image into 64 blocks, the carrier image is 512×512 large, thus the pixel of each block after division is 64×64.Then calculate the MSE of each block, and choose the pixel for prediction only when calculating the MSE.Sorting of the 64 blocks according to the MSE value, and then give each block a parameter value   ,   = , among which the parameter value of the smoothest block is 64 and that of the one with the most textures is  1 = 1.
Step 2: Calculate the predictive-value  , ′ , prediction-error  , , sorting-parameter of each pixel-block FVi,j.Then rank the order of all the pixel-blocks according to the calculated value ofFVi,j.Collect the first LSB value of first 34 prediction-errors to be   and then constitute the watermark-information as a part of watermark.
Step 3: Find the most suitable threshold limit value   ,   according to the capacity and the rank result of embedding-watermark.Test the pixel-block of the image according to the pattern of controlling over-flow.Classify the pixel-block into group A, B and C, and then build a location plan (if there is a location plan).
Step 4:Embed the watermark and location plan into the carrier image according to the Histogram-shifting-algorithm mentioned.From the 35th pixel-block of embedding-watermark on, those pixel-block in group A can have embedding-watermark, those pixel-block in group B will not haveembedding-watermark but take some revision and those in group C will skip over without any revision.
Step 5: Replace the LSB of the first 34 prediction-error after sorting with the 34-bit information with additional information.
Step 6: After the first embedding-watermark, change the roles of the two groups of pixel-block for the second embedding-watermark.Here the embedding-watermark ends.

B. EXTRACTING-WATERMARK AND THERECOVERY OF HOSTIMAGE
Step 1: Classify the pixels into two groups, and then divide the image into 64 blocks.Then calculate the MSE of each block.Sort the 64 blocks according to the MSE value, and then give each block a parameter value   ,   = , among which the parameter value of the smoothest block is 64 and that of the one with the most textures is  1 = 1.
Step 2: Calculate the predictive-value , ′ , prediction-errordi,j,the sorting-parameter of each pixel-block  , .Then rank the order of all the pixel-blocks according to the calculated value , .
Step 3: Read the LSB value of the first 34 prediction-error according to the rank result, from which the threshold value   ,   , the embedding-watermark capacity P come out.
Step 4: Test the pixel-block of the image according to the pattern of controlling overflow and classify the pixel-blocks into three groups, namely group A, group B and group C. According to the histogram shifting algorithm, to have embedding-watermark from the 35th pixel-block on, those pixel-block in group A can have embedding-watermark, those pixel-blocks in group B will not have embedding-watermark but take some revision and those in group C will skip over without any revision.
Step 5: Extract from the watermark-information and replace the LSB of the first 34 prediction-error, recover the value of the first host 34 prediction-error.
Step 6: After the first extracting-watermark, to take the second extracting-watermark.Here the whole extracting-watermark ends.

EXPERIMENTAL RESULTS
The proposed algorithm is compared with the methods of (Sachnevet al, 2009), (Kotvicha et al, 2012), and (Afsharizadeh and Mohammadi, 2013), the experiment in this paper applies 4 experimental images as in figure2, which are 512×512 grayscale images, namely Lena, Airplane, Baboon and Barbara, which is similar to the testing images applied in the above methods.( Kotvicha et al, 2012), and (Afsharizadeh and Mohammadi, 2013) methods showed good performance when the payload is small, while the proposed algorithm has better performance when the payload is big.
Experimental results show that the proposed algorithm by this paper enjoys efficiency, effectiveness and feasibility in the treatment of the issue of the sorting of prediction error.

CONCLUSION
This paper proposed a new reversible watermarking algorithm based on Sachnevalgorithm.The experimental results show that the new proposed algorithm is more effective than Sachnevalgorithm and other algorithms when the payload is big, because the sorting-parameter  , ′ used in the proposed algorithm is more accurately and effectively in predicting the value of prediction-error.In this algorithm we suggested embedding-watermark of the smooth pixel-block in the texture area, choosing the smooth pixel-block in the big texture area to take embedding-watermark first.Thus it can ensure to get a higher visual quality.After ranking all the pixel-blocks based on the calculated value of  , we embed the watermark and location plan into the carrier image according to the Histogram-shifting-algorithm.

Figure 3
Figure3, 4, 5, and 6 describe the PSNR effect of the four different images by using the proposed sorting algorithm and the other methods.Comparing with Sachnev's method, the proposed sorting algorithm improve the PSNR because the parameter used in sorting is more effective in predicting the values of prediction error, which improve more the relatively smooth images comparing with the relatively texture images.

Figure 3 .
Figure 3. Embedding capacity vs PSNR for the Lena image.

Figure 4 .
Figure 4. Embedding capacity vs PSNR for the Airplane image.

Figure 5 .
Figure 5. Embedding capacity vs PSNR for the Baboon image.

Figure 6 .
Figure 6.Embedding capacity vs PSNR for the Barbara image.
14)  in the above formula shows 2048 pixel-value for prediction in each block, and the pixel-value will not change in embedding-watermark, ̅ standing for the mean value of 2048 pixel-value.If the MES is big, it means it is rich in texture area.If the MES is small, it means this block is smoother.Sort these64 blocks according to the MSE of each block and give each block a parameter value   after sorting. = and1 ≤   ≤ 64.The parameter of the block with most complicated texture is  1 = 1, the parameter of the smoothest block is  64 = 64, all the pixel-value in a block shares a parameter value   .