Reversible watermarking method and device based on improved weight predictor
By improving the weight predictor to make more accurate predictions in the texture area, and combined with the fluctuation value sorting the optimization order, the problem of the predictive error of the texture area in the existing technology has been solved. The embedded effect.
Patent Information
- Application Number
- CN202010910082.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-09-02
- Publication Date
- 2025-01-24
- Estimated Expiration
- 2040-09-02
AI Technical Summary
The prior art has poor results in the prediction error expansion of textured areas, resulting in visual distortion of the image in the textured areas after embedding information.
Adopting the improvement weight predictor, calculating the two differences and average values of the pixel value of the target pixel around, calculate a more accurate predictive value, and combine the fluctuation value to sort to optimize the embedded order.
The accuracy of the prediction of the texture area has improved significantly, and the images of image vision after being embedded are reduced, especially in the hourly effect of the embedded capacity.
Smart Images

Figure CN114004724B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of reversible digital watermarking, and in particular to a reversible watermarking method and device based on an improved weight predictor. Background Art
[0002] In 2004, Thodi and Rodriguez proposed a prediction error expansion algorithm, which further improved the problem of low embedding capacity caused by the limit of the number of peak point pixels in the prediction error histogram method by expanding the prediction error. The specific expansion method is to multiply the prediction error by 2 and add the embedded one-bit information to obtain the prediction error of the embedded information, and then add it back to the original pixel to form an image of the embedded information. The ideal embedding capacity is 1 bit / pixel. In information hiding technology based on prediction error expansion, the design of the predictor has become a major research hotspot.
[0003] In 2009, Sachnev et al. proposed a prediction method of diamond predictor based on the prediction error expansion algorithm. This predictor has a double-layer embedding feature, which further improves the embedding capacity. Specifically, it first divides the pixels into cross sets and point sets, and then embeds the data into these two sets in turn. Taking the point set as an example, the prediction value is calculated by averaging the pixels of the four cross sets around the target, and the difference between the original pixel value and the prediction value becomes the prediction error. Then, the prediction errors are sorted in ascending order and the data is embedded in turn using the prediction error expansion method.
[0004] In 2012, Dragoi et al. proposed an adaptive prediction value calculation method based on diamond predictor, which improved the previous diamond predictor. Specifically, the four surrounding pixels are divided into two groups in the horizontal direction and the vertical direction. For each group, the absolute value of the difference between them is calculated. Then the two absolute differences are compared, and the mean of the two pixels in the group with the smaller difference is calculated as the prediction value of the target pixel.
[0005] In 2019, Jia et al. established a diamond predictor based on weighted average, which was improved again. The predicted value of the target pixel is obtained by weighting the four pixels above, below, left and right. If the surrounding pixel values are closer to their average, the pixel will account for a larger proportion. This can reduce the proportion of pixels that are very different from the target pixel. In order to embed information preferentially in areas with small prediction errors, this method calculates the fluctuation value of each pixel, sorts the fluctuation values in ascending order, and preferentially embeds information in pixels with small fluctuation values.
[0006] However, the prior art has the following disadvantages:
[0007] (1) In 2009, Sachnev et al. proposed a diamond predictor based on prediction error expansion, which solved the problem of incomplete prediction that was common in previous methods that were not diamond predictors. However, since the prediction was made using only the average of the surrounding pixels, it did not take into account that there may be pixel values in the texture area that are very different from the target pixel. These pixels with large differences will cause large errors in the prediction process, making this prediction method unsuitable for texture areas.
[0008] (2) In 2012, Dragoi et al. proposed an adaptive prediction value calculation method. This method takes into account the need to use pixels with smaller differences for prediction to a certain extent, and makes some improvements on the solution proposed by Sachnev et al. However, this method only considers the horizontal and vertical directions of the diamond area where the target pixel is located, and does not comprehensively consider other directions, such as the positive and negative diagonal directions, so the prediction result does not achieve good results. At the same time, the prediction value is only calculated by averaging, and this method cannot be well applied to texture areas.
[0009] (3) In 2019, Jia et al. established a diamond predictor based on weighted averaging. Weighted averaging solves the problem that the previous mean prediction method cannot be well used in texture areas to a certain extent, and improves the previous methods of Sachnev and Dragoi. However, since this method only considers the relationship between the target pixel and its surrounding neighboring pixels, but does not comprehensively consider the relationship between the surrounding pixels, the effect is not much improved when applied to texture areas. In addition, the correlation between the fluctuation value of this method and the prediction error is not very high, so there are certain problems in the order of embedding, which will also cause a certain degree of visual distortion in the texture area of the image after the information is embedded. Summary of the invention
[0010] The present invention aims to solve one of the technical problems in the related art at least to a certain extent.
[0011] To this end, an object of the present invention is to propose a reversible watermarking method based on an improved weight predictor, which improves the existing diamond predictor to have better prediction accuracy in the texture area of natural images, thereby achieving better embedding effect.
[0012] Another object of the present invention is to provide a reversible watermarking device based on an improved weight predictor.
[0013] To achieve the above-mentioned purpose, an embodiment of the present invention proposes a reversible watermarking method based on an improved weight predictor, comprising the following steps: converting a target image into a grayscale image, and dividing the grayscale image into a cross set and a point set; taking any pixel of the cross set or the point set as a target pixel, obtaining a predicted value of the target pixel according to the correlation between adjacent pixels in the surrounding pixels of the target pixel, and obtaining a prediction error according to the difference between the pixel value of the target pixel and the predicted value, wherein the target pixel and the surrounding pixels of the target pixel are in different sets; calculating the fluctuation value of each pixel point, and sorting the fluctuation value of each pixel point to obtain the order of embedded information, wherein there is a correlation between the fluctuation value and the prediction error; extending the embedded information to the prediction error to restore the expanded prediction error to the any pixel to obtain a new pixel value, at which point one set is embedded, and then embedding another set in the same way until all the pixel points of the cross set and the point set are embedded.
[0014] The reversible watermarking method based on the improved weight predictor of the embodiment of the present invention has a good prediction effect when predicting the pixel points in the texture area of the image during the reversible watermarking work based on prediction error expansion, so that the embedded image produces less visual distortion, especially when the embedding capacity is small. It is more obvious. It is precisely because the correlation of the pixel points around the target pixel point and the smoothness in all directions are taken into account, and the calculation method of the fluctuation value also has a good correlation with the prediction value, so that the prediction effect reaches a good level.
[0015] In addition, the reversible watermarking method based on the improved weight predictor according to the above embodiment of the present invention may also have the following additional technical features:
[0016] In one embodiment of the present invention, obtaining the predicted value of the target pixel according to the correlation between adjacent pixels in the surrounding pixels of the target pixel includes:
[0017] Calculate the target pixel x i,j The absolute value of the pairwise difference of the surrounding pixel values:
[0018] d 1 =|y i-1,j -y i+1,j |,
[0019] d 2 =|y i,j-1 -y i,j+1 |,
[0020] d 3 =|y i-1,j -y i,j-1 |,
[0021] d 4 =|y i-1,j -y i,j+1 |,
[0022] d 5 =|y i+1,j -y i,j-1 |,
[0023] d 6 =|y i+1,j -y i,j+1 |,
[0024] Among them, y i,j-1 is the target pixel x i,j The left adjacent pixel, y i,j+1 is the target pixel x i,j The adjacent pixel on the right, y i-1,j is the target pixel x i,j Upper adjacent pixel, y i+1,j is the target pixel x i,j The lower adjacent pixel;
[0025] Calculate the target pixel x respectively i,j The pairwise average of the surrounding pixel values:
[0026]
[0027]
[0028]
[0029]
[0030]
[0031]
[0032] Calculate the target pixel x i,j The predicted value P i,j , the predicted value P i,j The calculation formula is:
[0033] P i,j =w 1 ·temp 1 +w 2 ·temp 2 +w 3 ·temp 3 +w 4 ·temp 4 +w 5 ·temp 5 +w6 ·temp 6 ,
[0034] Among them, w i represents the weight of the average value.
[0035] In one embodiment of the present invention, the method further includes: calculating the sum d_sum of all the absolute values, and calculating the weight of each average value according to whether d_sum is 0:
[0036]
[0037] Normalize the weights of all average values to get w i :w 1 +w 2 +w 3 +w 4 +w 5 +w 6 =1.
[0038] In one embodiment of the present invention, the calculation formula of the fluctuation value is:
[0039] Δv i,j =|y i-1,j -y i+1,j |+|y i,j-1 -y i,j+1 |+|y i-1,j -y i,j-1 |+|y i-1,j -y i,j+1 |+|y i+1,j -y i,j-1 |+|y i+1,j -y i,j+1 |.
[0040] In one embodiment of the present invention, the prediction error is:
[0041] P i,j =x i,j -P i,j ,
[0042] Among them, x i,j is the pixel value of the target pixel, P i,j is the predicted value.
[0043] To achieve the above-mentioned purpose, another embodiment of the present invention proposes a reversible watermarking device based on an improved weight predictor, comprising: a preprocessing module, used to convert a target image into a grayscale image, and divide the grayscale image into a cross set and a point set; a prediction module, used to take any pixel of the cross set or the point set as a target pixel, obtain a predicted value of the target pixel according to the correlation between adjacent pixels in the surrounding pixels of the target pixel, and obtain a prediction error according to the difference between the pixel value of the target pixel and the predicted value, wherein the target pixel and the surrounding pixels of the target pixel are in different sets; a sorting module, used to calculate the fluctuation value of each pixel point, and sort the fluctuation value of each pixel point to obtain the order of embedded information, wherein there is a correlation between the fluctuation value and the prediction error; an embedding module, used to extend the embedded information into the prediction error, so as to restore the extended prediction error to any pixel to obtain a new pixel value, at which point one set is embedded, and then another set is embedded in the same way until all the pixel points of the cross set and the point set are embedded.
[0044] The reversible watermarking device based on the improved weight predictor of the embodiment of the present invention has a good prediction effect when predicting the pixel points in the texture area of the image during the reversible watermarking work based on prediction error expansion, so that the embedded image produces less visual distortion, especially when the embedding capacity is small. It is more obvious. It is precisely because the correlation of the pixel points around the target pixel point and the smoothness in all directions are taken into account, and the calculation method of the fluctuation value also has a good correlation with the prediction value, so that the prediction effect reaches a good level.
[0045] In addition, the reversible watermarking device based on the improved weight predictor according to the above embodiment of the present invention may also have the following additional technical features:
[0046] In one embodiment of the present invention, the prediction module is further used for:
[0047] Calculate the target pixel x i,j The absolute value of the pairwise difference of the surrounding pixel values:
[0048] d 1 =|y i-1,j -y i+1,j |,
[0049] d 2 =|y i,j-1 -y i,j+1 |,
[0050] d 3 =|y i-1,j -y i,j-1 |,
[0051] d 4 =|y i-1,j -y i,j+1 |,
[0052] d 5 =|y i+1,j -y i,j-1 |,
[0053] d 6 =|y i+1,j -y i,j+1 |,
[0054] Among them, y i,j-1 is the target pixel x i,j The left adjacent pixel, y i,j+1 is the target pixel x i,j The adjacent pixel on the right, y i-1,j is the target pixel x i,j Upper adjacent pixel, y i+1,j is the target pixel x i,j The lower adjacent pixel;
[0055] Calculate the target pixel x respectively i,j The pairwise average of the surrounding pixel values:
[0056]
[0057]
[0058]
[0059]
[0060]
[0061]
[0062] Calculate the predicted value P of the target pixel i,j , the predicted value P i,j The calculation formula is:
[0063] P i,j =w 1 ·temp 1 +w 2 ·temp 2 +w 3 ·temp 3 +w 4 ·temp 4 +w 5 ·temp 5 +w 6·temp 6 ,
[0064] Among them, w i represents the weight of the average value.
[0065] In one embodiment of the present invention, the prediction module is further used to calculate the sum d_sum of all the absolute values, and calculate the weight of each average value according to whether d_sum is 0:
[0066]
[0067] Normalize the weights of all average values to get w i :w 1 +w 2 +w 3 +w 4 +w 5 +w 6 =1.
[0068] In one embodiment of the present invention, the calculation formula of the fluctuation value is:
[0069] Δv i,j =|y i-1,j -y i+1,j |+|y i,j-1 -y i,j+1 |+|y i-1,j -y i,j-1 |+|y i-1,j -y i,j+1 |+|y i+1,j -y i,j-1 |+|y i+1,j -y i,j+1 |.
[0070] In one embodiment of the present invention, the prediction error is:
[0071] P i,j =x i,j -P i,j ,
[0072] Among them, x i,j is the pixel value of the target pixel, P i,j is the predicted value.
[0073] Additional aspects and advantages of the present invention will be given in part in the following description and in part will be obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0074] The above and / or additional aspects and advantages of the present invention will become apparent and easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:
[0075] Figure 1 is a flow chart of a reversible watermarking method based on an improved weight predictor according to an embodiment of the present invention;
[0076] Figure 2 is a flow chart of a reversible watermarking method based on an improved weight predictor according to an embodiment of the present invention;
[0077] Figure 3 is an example of a diamond predictor according to an embodiment of the present invention;
[0078] Figure 4 This is an example of calculating the absolute value of the difference between two pixel values around a target pixel according to an embodiment of the present invention;
[0079] Figure 5 This is an example where d_sum is 0 according to an embodiment of the present invention;
[0080] Figure 6 This is an example where d_sum is not 0 according to an embodiment of the present invention;
[0081] Figure 7 Schematic diagram of the structure of a reversible watermarking device based on an improved weight predictor according to an embodiment of the present invention. DETAILED DESCRIPTION
[0082] Embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present invention, and should not be construed as limiting the present invention.
[0083] The present invention is based on the inventor's understanding and discovery of the following problems:
[0084] Reversible digital watermarking technology is a technology that can secretly transmit information without destroying the original image of the carrier, so as to accurately extract the watermark information and perfectly restore the carrier image. It can exist as a guardian of digital product copyright protection in any field and any place, providing invisible authentication marks, i.e. watermarks, for various images, bills, etc. It can assist relevant personnel to achieve functions such as confirming authenticity, preventing tampering, hiding important information, and ensuring confidentiality and integrity. It has been widely used in military, medical, and remote sensing fields. Reversible digital watermarking technology has two important requirements: large embedding capacity and low distortion. These two requirements are often contradictory and difficult to balance. Reversible digital watermarking technology based on prediction error expansion has a better effect in balancing these two important points, which can make the specific technology based on this have better performance. Prediction error expansion technology can bring many benefits and is widely used.
[0085] Among them, the diamond predictor uses the values of the four pixels above, below, left and right to predict the central pixel, and makes a difference to get the prediction error. Then the data is converted into binary bits and embedded in the prediction error. The prediction error that has been expanded is added to the original pixel to obtain an image embedded with key information. The key to this technology lies in the prediction accuracy of the predictor. Although the accuracy of the existing diamond predictor is higher than that of many other predictors, it still does not fully consider the effect of the texture of natural images on embedding distortion. The image distortion caused by embedding data in the smooth area of the image is much smaller than that in the texture area, which directly leads to the visual distortion of the image and the decrease of the imperceptibility of the watermark algorithm. The consequences are obviously immeasurable.
[0086] That is to say, in the existing reversible digital watermarking algorithms based on prediction error expansion, there is a situation where the embedded information in the texture area is greatly distorted. The present invention analyzes and concludes that this problem comes from the insufficient prediction accuracy of the predictor, which leads to the further amplification of the prediction error after expansion. At the same time, after a certain error is generated in the embedding of the first layer, it will affect the embedding of the second layer, thereby generating greater visual distortion. The method proposed in the present invention is also based on the diamond predictor of prediction error expansion. By improving the existing diamond predictor, it has better prediction accuracy in the texture area of natural images, thereby achieving a better embedding effect.
[0087] The following describes a reversible watermarking method and apparatus based on an improved weight predictor according to an embodiment of the present invention with reference to the accompanying drawings. First, the reversible watermarking method based on an improved weight predictor according to an embodiment of the present invention will be described with reference to the accompanying drawings.
[0088] Figure 1 The flowchart of a reversible watermarking method based on an improved weight predictor according to an embodiment of the present invention.
[0089] like Figure 1 As shown, the reversible watermarking method based on the improved weight predictor includes the following steps:
[0090] In step S101, the target image is converted into a grayscale image, and the grayscale image is divided into a cross set and a point set.
[0091] It is understandable that if Figure 2 As shown, first, a picture is converted into a grayscale image; then, the image is divided into a cross set and a point set.
[0092] In step S102, any pixel of the cross set or the point set is taken as the target pixel, the predicted value of the target pixel is obtained according to the correlation between the adjacent pixels in the surrounding pixels of the target pixel, and the prediction error is obtained according to the difference between the pixel value of the target pixel and the predicted value, wherein the target pixel and the surrounding pixels of the target pixel are in different sets.
[0093] It is understandable that if Figure 2 and Figure 3 As shown, taking the cross set as an example, the target pixel x i,j The four pixels above, below, left and right of y i-1,j ,y i+1,j ,y i,j-1 ,y i,j+1 All of them come from the point set, and the four pixels of the point set are used to predict the target pixel of the cross set to obtain a prediction error.
[0094] Specifically, the innovation of the present invention is to calculate the prediction of the target pixel and calculate the weight of the diamond predictor by the difference between adjacent pixels in each direction, so as to more accurately predict the target pixel value. The specific method is as follows:
[0095] 1. Figure 3 For example, first calculate the target pixel x i,j The absolute value of the pairwise difference of the surrounding pixel values:
[0096] d 1 =|y i-1,j -y i+1,j |,
[0097] d 2 =|y i,j-1 -y i,j+1 |,
[0098] d 3 =|y i-1,j -y i,j-1 |,
[0099] d 4 =|y i-1,j -y i,j+1 |,
[0100] d 5 =|y i+1,j -y i,j-1 |,
[0101] d 6 =|y i+1,j -y i,j+1 |, (1)
[0102] The target pixel x can be reflected by the pairwise difference between adjacent pixels. i,jThe gradient values in the horizontal, vertical, positive diagonal and negative diagonal directions can more comprehensively reflect whether the neighborhood of the target pixel is smooth or has texture, such as Figure 4 shown.
[0103] 2. Calculate the target pixel x respectively i,j The pairwise average of the surrounding pixel values:
[0104]
[0105]
[0106]
[0107]
[0108]
[0109]
[0110] Among them, the temp value is the object that needs to be weighted in the predictor, so the object that needs to be weighted is not just the pixel values around the target pixel, because this can make good use of the correlation between adjacent pixels for prediction.
[0111] 3. Give the target pixel x i,j The predicted value P i,j The calculation formula is:
[0112] P i,j =w 1 ·temp 1 +w 2 ·temp 2 +w 3 ·temp 3 +w 4 ·temp 4 +w 5 ·temp 5 +w 6 ·temp 6 , (3)
[0113] Among them, w i Represents each temp i The weight corresponding to the value. It can be seen that if temp i The smaller the difference between the two pixels corresponding to the value, the closer the two pixels are, and they are in a relatively smooth area, which should increase the impact of the smooth area on the predicted value. i The corresponding weight should be larger. On the contrary, if temp iThe greater the difference between the two pixels corresponding to the value, the farther the two pixel values are from each other, indicating that they are in the texture area. The influence of the value with large error in the texture area on the predicted value should be reduced. Therefore, this temp i The corresponding weight should be smaller.
[0114] 4. The method for calculating weights is as follows:
[0115] First, we need to calculate the sum of the six absolute errors:
[0116] d_sum=d 1 +d 2 +d 3 +d 4 +d 5 +d 6 ; (4)
[0117] Then calculate the weight based on whether d_sum is 0:
[0118]
[0119] It is not difficult to see here that for a certain pixel, the value of d_sum is fixed. So for each temp value, the smaller the difference between the two adjacent pixels it corresponds to, that is, d i The smaller it is, the greater the weight corresponding to temp is. Finally, we need to add six w i Normalize it, that is, w 1 +w 2 +w 3 +w 4 +w 5 +w 6 =1, thus ensuring the accuracy of the prediction. Figure 5 and Figure 6 As shown in the figure, there are examples where d_sum is 0 and d_sum is not 0.
[0120] 5. After getting the predicted value, the target pixel x i,j The pixel value minus the predicted value is used to obtain the prediction error Pe i,j , which is used for the next step of prediction error expansion to embed information:
[0121] P i,j =x i,j -P i,j (6)
[0122] In step S103, the fluctuation value of each pixel is calculated, and the fluctuation value of each pixel is sorted to obtain the order of embedded information, wherein there is a correlation between the fluctuation value and the prediction error.
[0123] It can be understood that the fluctuation value of each pixel is calculated, wherein the fluctuation value has a strong correlation with the prediction error. Then, the fluctuation value of each pixel is sorted to obtain the order of the embedded information.
[0124] It should be noted that in order to make the image produce less visual distortion after embedding information, the embodiment of the present invention needs to sort the order of embedding information for each pixel well, and give priority to embedding information in pixels with small prediction errors. Here we need to introduce the concept of fluctuation value. If the area where the pixel is located is smoother, its prediction value will be more accurate, so the prediction error will be smaller, and information will be embedded more preferentially. Fluctuation value Δv i,j It is used to judge the smoothness of the area where the pixel is located. The calculation method is as follows:
[0125] Δv i,j =|y i-1,j -y i+1,j |+|y i,j-1 -y i,j+1 |+|y i-1,j -y i,j-1 |+|y i-1,j -y i,j+1 |+|y i+1,j -y i,j-1 |+|y i+1,j -y i,j+1 |. (7)
[0126] In fact, each sub-formula in the above formula is the target pixel x i,j The absolute difference between the two surrounding pixels. Each difference represents the degree of smoothness in a certain direction around the target pixel. If the absolute values of the six differences are very small, it means that the area where the target pixel is located is relatively smooth in each direction, so it can be said that it is in a smooth area. On the contrary, if the value of one or more sub-formulas is too large, it means that the gradient direction value represented by these sub-formulas in the area where the target pixel is located is too large, that is, it is not smooth, and information cannot be embedded in such pixels preferentially. Therefore, the fluctuation value can more comprehensively reflect the degree of smoothness of the area where the target pixel is located in each direction, and is highly correlated with the calculation weight and prediction value in the predictor.
[0127] In step S104, the embedded information is extended to the prediction error to restore the extended prediction error to any pixel to obtain a new pixel value. At this time, one set is embedded, and then another set is embedded in the same way until all pixel points of the cross set and the point set are embedded.
[0128] It is understandable that if Figure 2As shown in , after sorting d_sum, the PEE method is used to embed the data. The PEE method is: expand the information to be embedded into the prediction error, and finally restore the prediction error to the original pixel to obtain the new pixel value. After all the pixels from the cross set are embedded, the point set is embedded using the same method. It should be noted that Figure 3 As shown in FIG. 1 , the pixels around the edge of the image are not embedded because they have no complete adjacent pixels.
[0129] Specifically, 1. Before the embedding step, a threshold range [T - , T + ], the pixels whose prediction error falls within this range can be embedded. The selection of the threshold range should match the overall smoothness of the image.
[0130] 2. After setting the threshold range, perform prediction error expansion to embed information into the prediction error. The specific method is as follows:
[0131] P i,j '=2Pe i,j +b, (8)
[0132] Multiplying the prediction error by 2 is equivalent to shifting the binary representation of the prediction error one bit to the left, leaving the lowest bit, and embedding information b to obtain the expanded prediction error.
[0133] 3. For those pixels whose prediction errors are not within the threshold range, they need to be shifted. + The pixel value on the right moves to the right by one T + , thereby preventing pixels within the threshold range from overlapping with it after expansion. Similarly, the prediction error is - The pixel on the left takes you, and the pixel value moves one grid to the left. - Then the comprehensive prediction error belongs to the extended operation within the threshold range, as follows:
[0134]
[0135] 4. After the expansion of the prediction error is completed, the expanded prediction error is restored to the original pixel to form a new pixel value x i,j ':
[0136] x i,j '=Pe i,j '+P i,j (10)
[0137] 5. In the embedding process, a very important issue is to prevent overflow and underflow. For example, the pixel value of a pixel is 253, its predicted value is 252, and the prediction error is 1. If the bit of the embedded information is 1, the expanded prediction error is 3, and then restored to the original pixel value, the new pixel value is 256, which exceeds the pixel value range of the grayscale image [0, 255], indicating that an overflow has occurred. Similarly, when the new pixel value after the embedded information becomes a negative number, it means that an underflow has occurred. To avoid such problems, pixels that may overflow or underflow need to be excluded from the embedding queue in advance. For a grayscale image, let L = 256, and the maximum prediction error value that can be embedded is T + Assuming that the information to be embedded is 1, the maximum prediction error after expansion can reach 2T + +1. When the original pixel value x i,j The value reaches L-2T + -1, overflow may occur after embedding information. Similarly, when the original pixel value x i,j The value reaches 0-2T - When the value is -1, the pixel may overflow downward after embedding the information. Therefore, in order to distinguish the pixels whose prediction errors meet the conditions for embedding information but may overflow, the embodiment of the present invention sets a position map to distinguish these pixels. The marking method is as follows:
[0138] If the pixel x i,j ∈(-2T - -1, L-2T + -1), then it will not overflow, and we need to distinguish whether it is embedded or shifted. i,j ∈[T - , T + ], then no marking is done on the location map; if Pe i,j >T + or Pe i,j <T - , then mark “0” on the position diagram.
[0139] If the pixel x i,j ≥L-2T + -1 or x i,j ≤-2T - -1. From the above analysis, we can see that this point may overflow or underflow during the embedding process, so "1" is marked on the position map to distinguish it from the previous pixel.
[0140] Furthermore, in one embodiment of the present invention, it also includes: an image extraction and restoration module. In the reversible digital watermark, the work done by the extraction module is actually the reverse process of the embedding work. In the above embodiment, the cross set is embedded first and then embedded in the point set. When restoring, it is necessary to first extract the information embedded in the point set and restore the image, and then use the same method to operate on the cross set, such as Figure 2 As shown, the details are as follows:
[0141] 1. First, we need to use the prediction method mentioned above to predict the point set with the pixel points of the cross set to obtain the predicted value P of the point set i,j .
[0142] 2. Then use the pixel value x of the image after embedding the information i,j 'Subtract the predicted value to get the prediction error of the embedded information:
[0143] P i,j '=x i,j '-p i,j (11)
[0144] 3. In order to determine the order of extraction, it is necessary to calculate the fluctuation value of each pixel in the point set, sort the fluctuation values in ascending order, and combine them with the marks of the position map to obtain the order of the pixels with embedded information.
[0145] 4. When embedding information, the embodiment of the present invention uses the prediction error expansion method and places the embedded information in the lowest bit of the prediction error. Therefore, in the extraction process, it is necessary to perform a modulo 2 operation on the prediction error of the embedded information to extract the information:
[0146] b=Pe i,j 'mod 2. (12)
[0147] After extracting the information, if you need to restore the image, you need to first get the original prediction error Pe i,j :
[0148]
[0149] 5. After obtaining the original prediction error, image restoration can be performed:
[0150] x i,j =P i,j +Pe i,j (14)
[0151] According to the reversible watermarking method based on the improved weight predictor proposed in the embodiment of the present invention, when performing reversible watermarking based on prediction error expansion, when predicting the pixel points in the texture area of the image, it has a better prediction effect, so that the embedded image produces less visual distortion, especially when the embedding capacity is small, it is more obvious; it is precisely because the correlation of the pixel points around the target pixel point and the smoothness in all directions are taken into account, and the calculation method of the fluctuation value also has a good correlation with the prediction value, so that the prediction effect reaches a good level.
[0152] Next, a reversible watermarking device based on an improved weight predictor according to an embodiment of the present invention will be described with reference to the accompanying drawings.
[0153] Figure 7 It is a structural schematic diagram of a reversible watermarking device based on an improved weight predictor according to an embodiment of the present invention.
[0154] like Figure 7 As shown, the reversible watermarking device 10 based on the improved weight predictor includes: a preprocessing module 100 , a prediction module 200 , a sorting module 300 and an embedding module 400 .
[0155] Among them, the preprocessing module 100 is used to convert the target image into a grayscale image, and divide the grayscale image into a cross set and a point set; the prediction module 200 is used to take any pixel of the cross set or the point set as the target pixel, obtain the predicted value of the target pixel according to the correlation between the adjacent pixels in the surrounding pixels of the target pixel, and obtain the prediction error according to the difference between the pixel value of the target pixel and the predicted value, wherein the target pixel and the surrounding pixels of the target pixel are in different sets; the embedding module 300 is used to calculate the fluctuation value of each pixel point, and sort the fluctuation value of each pixel point to obtain the order of embedded information, wherein there is a correlation between the fluctuation value and the prediction error; the embedding module 400 is used to expand the embedded information into the prediction error, so as to restore the expanded prediction error to any pixel to obtain a new pixel value, at this time, one set is embedded, and then embedded in another set in the same way until all the pixel points of the cross set and the point set are embedded. The device 10 of the embodiment of the present invention improves the existing diamond predictor, so that it has better prediction accuracy in the texture area of the natural image, thereby achieving a better embedding effect.
[0156] In one embodiment of the present invention, the prediction module 200 is further configured to:
[0157] Calculate the target pixel x i,j The absolute value of the pairwise difference of the surrounding pixel values:
[0158] d 1 =|y i-1,j -y i+1,j|,
[0159] d 2 =|y i,j-1 -y i,j+1 |,
[0160] d 3 =|y i-1,j -y i,j-1 |,
[0161] d 4 =|y i-1,j -y i,j+1 |,
[0162] d 5 =|y i+1,j -y i,j-1 |,
[0163] d 6 =|y i+1,j -y i,j+1 |,
[0164] Among them, y i,j-1 The target pixel x i,j The left adjacent pixel, y i,j+1 The target pixel x i,j The adjacent pixel on the right, y i-1,j The target pixel x i,j Upper adjacent pixel, y i+1,j The target pixel x i,j The lower adjacent pixel;
[0165] Calculate the target pixel x respectively i,j The pairwise average of the surrounding pixel values:
[0166]
[0167]
[0168]
[0169]
[0170]
[0171]
[0172] Calculate the predicted value P of the target pixel i,j , predicted value P i,j The calculation formula is:
[0173] P i,j =w 1 ·temp 1+w 2 ·temp 2 +w 3 ·temp 3 +w 4 ·temp 4 +w 5 ·temp 5 +w 6 ·temp 6 ,
[0174] Among them, w i Represents the weight of the average value.
[0175] In one embodiment of the present invention, the prediction module 200 is further configured to calculate the sum d_sum of all absolute values, and calculate the weight of each average value according to whether d_sum is 0:
[0176]
[0177] Normalize the weights of all average values to get w i :w 1 +w 2 +w 3 +w 4 +w 5 +w 6 =1.
[0178] In one embodiment of the present invention, the calculation formula of the fluctuation value is:
[0179] Δv i,j =|y i-1,j -y i+1,j |+|y i,j-1 -y i,j+1 |+|y i-1,j -y i,j-1 |+|y i-1,j -y i,j+1 |+|y i+1,j -y i,j-1 |+|y i+1,j -y i,j+1 |.
[0180] In one embodiment of the present invention, the prediction error is:
[0181] P i,j =x i,j -P i,j ,
[0182] Among them, x i,j is the pixel value of the target pixel, P i,j is the predicted value.
[0183] It should be noted that the above explanation of the embodiment of the reversible watermarking method based on the improved weight predictor is also applicable to the reversible watermarking device based on the improved weight predictor of this embodiment, which will not be described in detail here.
[0184] According to the reversible watermarking device based on the improved weight predictor proposed in the embodiment of the present invention, when performing reversible watermarking based on prediction error expansion, when predicting the pixel points in the texture area of the image, it has a better prediction effect, so that the embedded image produces less visual distortion, especially when the embedding capacity is small, it is more obvious; it is precisely because the correlation of the pixel points around the target pixel point and the smoothness in all directions are taken into account, and the calculation method of the fluctuation value also has a good correlation with the prediction value, so that the prediction effect reaches a good level.
[0185] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In the description of the present invention, the meaning of "plurality" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined.
[0186] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, without contradiction.
[0187] Although the embodiments of the present invention have been shown and described above, it is to be understood that the above embodiments are exemplary and are not to be construed as limitations of the present invention. A person skilled in the art may change, modify, replace and vary the above embodiments within the scope of the present invention.
Claims
1. A reversible watermarking method based on an improved weight predictor, characterized in that: The following steps are involved: Converting the target image into a grayscale image, and dividing the grayscale image into a cross set and a point set; Taking any pixel of the cross set or the point set as a target pixel, obtaining a predicted value of the target pixel according to the correlation between adjacent pixels in the surrounding pixels of the target pixel, and obtaining a prediction error according to the difference between the pixel value of the target pixel and the predicted value, wherein the target pixel and the surrounding pixels of the target pixel are in different sets; Calculate the fluctuation value of each pixel and sort the fluctuation value of each pixel to obtain the order of embedded information, where there is a correlation between the fluctuation value and the prediction error; The embedded information is extended to the prediction error to restore the extended prediction error to any pixel to obtain a new pixel value. At this time, one set is embedded, and then another set is embedded in the same way until all the pixel points of the cross set and the point set are embedded; wherein, The step of obtaining a predicted value of the target pixel according to the correlation between adjacent pixels in surrounding pixels of the target pixel comprises: Calculate the target pixel x i,j The absolute value of the pairwise difference of the surrounding pixel values: d1=|y i-1,j -and i+1,j |, d2=|y i,j-1 -y i,j+1 |, <h2 style=";text-align:left;direction:ltr">d3 =|y<h2 style=";text-align:left;direction:ltr"> i-1,j <h2 style=";text-align:left;direction:ltr"> -y<h2 style=";text-align:left;direction:ltr"> i,j-1 <h2 style=";text-align:left;direction:ltr"> |, d4|y i-1,j -y i,j+1 |, d5=|y i+1,j -y i,j-1 |, d6=|and i+1,j -and i,j+1 |, Among them, y i,j-1 is the target pixel x i,j The left adjacent pixel, y i,j+1 is the target pixel x i,j The adjacent pixel on the right, y i-1,j is the target pixel x i,j Upper adjacent pixel, y i+1,j is the target pixel x i,j The lower adjacent pixel; Calculate the target pixel x respectively i,j The pairwise average of the surrounding pixel values: Calculate the target pixel x i,j The predicted value P i,j , the predicted value P i,j The calculation formula is: <h2 style=";text-align:left;direction:ltr">P<h2 style=";text-align:left;direction:ltr"> i,j <h2 style=";text-align:left;direction:ltr"> (w1·temp1+w2·temp2+w3·temp3+w4·temp4+w5·temp5+w6·temp6) Also includes: Calculate the sum d_sum of all the absolute values, and calculate the weight of each average value based on whether d_sum is 0: Normalize the weights of all average values to get w i :w1+w2+w3+w4+w5+w6=1.
2. The method according to claim 1, characterized in that in, The calculation formula of the fluctuation value is: Δv i,j =|y i-1,j -y i+1,j |+|y i,j-1 -y i,j+1 |+|y i-1,j -y i,j-1 |+|y i-1,j -y i,j+1 |+|y i+1,j -y i,j-1 |+|y i+1,j -y i,j+1 | 3. The method according to any one of claims 1 to 2, characterized in that: in, The prediction error is: On i,j =x i,j -P i,j , Among them, x i,j is the pixel value of the target pixel, P i,j is the predicted value.
4. A reversible watermarking device based on an improved weight predictor, characterized in that: include: A preprocessing module, used for converting a target image into a grayscale image, and dividing the grayscale image into a cross set and a point set; A prediction module, used for taking any pixel of the cross set or the point set as a target pixel, obtaining a prediction value of the target pixel according to the correlation between adjacent pixels in the surrounding pixels of the target pixel, and obtaining a prediction error according to the difference between the pixel value of the target pixel and the prediction value, wherein the target pixel and the surrounding pixels of the target pixel are in different sets; A sorting module is used to calculate the fluctuation value of each pixel point and sort the fluctuation value of each pixel point to obtain the order of embedded information, wherein there is a correlation between the fluctuation value and the prediction error; The embedding module is used to extend the embedding information into the prediction error, so as to restore the extended prediction error to any pixel to obtain a new pixel value. At this time, one set is embedded, and then another set is embedded in the same way until all the pixel points of the cross set and the point set are embedded; wherein, The prediction module is further used to: Calculate the target pixel x i,j The absolute value of the pairwise difference of the surrounding pixel values: d1=|y i-1,j -and i+1,j |, d2=|y i,j-1 -y i,j+1 |, <h2 style=";text-align:left;direction:ltr">d3 =|y<h2 style=";text-align:left;direction:ltr"> i-1,j <h2 style=";text-align:left;direction:ltr"> -y<h2 style=";text-align:left;direction:ltr"> i,j-1 <h2 style=";text-align:left;direction:ltr"> |, d4|y i-1,j -y i,j+1 |, d5=|y i+1,j -y i,j-1 |, d6=|and i+1,j -and i,j+1 |, Among them, y i,j-1 is the target pixel x i,j The left adjacent pixel, y i,j+1 is the target pixel x i,j The adjacent pixel on the right, y i-1,j is the target pixel x i,j Upper adjacent pixel, y i+1,j is the target pixel x i,j The lower adjacent pixel; Calculate the target pixel x respectively i,j The pairwise average of the surrounding pixel values: Calculate the predicted value P of the target pixel i,j , the predicted value P i,j The calculation formula is: <h2 style=";text-align:left;direction:ltr">P<h2 style=";text-align:left;direction:ltr"> i,j <h2 style=";text-align:left;direction:ltr"> (w1·temp1+w2·temp2+w3·temp3+w4·temp4+w5·temp5+w6·temp6) The prediction module is further used to calculate the sum d_sum of all the absolute values, and calculate the weight of each average value according to whether d_sum is 0: Normalize the weights of all average values to get w i :w1+w2+w3+w4+w5+w6=1.
5. The device according to claim 4, characterized in that in, The calculation formula of the fluctuation value is: Δv i,j =|y i-1,j -y i+1,j |+|y i,j-1 -y i,j+1 |+|y i-1,j -y i,j-1 |+|y i-1,j -y i,j+1 |+|y i+1,j -y i,j-1 |+|y i+1,j -y i,j+1 | 6. The device according to any one of claims 4 to 5, characterized in that: in, The prediction error is: On i,j =x i,j -P i,j , Among them, x i,j is the pixel value of the target pixel, P i,j is the predicted value.
Citation Information
Patent Citations
Reversible watermark method of multi-dimensional prediction error extension
CN105741225A
Reversible information hiding method and device with contrast enhancement in combination with multi-layer difference expansion
CN110047029A