A reversible adaptive watermark embedding and removal method based on color statistics

The watermark is adaptively embedded and removed in color images through color statistics and magic matrix steganography technology, which solves the problem of confusion between watermark and background in the existing technology, realizes clear embedding and seamless removal of watermark in color images, and meets the authenticity requirements of judicial authentication.

CN118537200BActive Publication Date: 2025-09-19HANGZHOU DIANZI UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410698585.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-05-31
Publication Date
2025-09-19
Estimated Expiration
2044-05-31

AI Technical Summary

Technical Problem

The existing technology for embedding visible watermarks in color images has poor versatility and high complexity. It also requires additional keys or Huffman coding tables to remove the watermarks, cannot achieve background adaptation, and easily causes confusion between the watermark and the background, which cannot meet the authenticity requirements of judicial evidence.

Method used

By performing color statistics on the pixels in the watermark area of ​​the host image, the watermark color is adaptively generated, and the color of the non-watermark area is protected. The magic matrix steganography technology is used to write watermark information in the non-interest area to achieve watermark embedding and removal.

Benefits of technology

It achieves clear embedding and traceless removal of watermarks in color images, ensuring the integrity of the host image and the authenticity of judicial authentication. It is applicable to images of various sizes and is versatile and flexible.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118537200B_ABST
    Figure CN118537200B_ABST
Patent Text Reader

Abstract

The present invention discloses a reversible adaptive watermark embedding and removal method based on color statistics. The watermark area of ​​the original image is subjected to histogram statistics according to the color system, and the corresponding complementary color image and the optimal watermark color are obtained by calculation to ensure that the watermark color forms a clear contrast with the color of most pixels in the watermark area. After obtaining the watermark marking code representing the watermark color, the marking code is implanted by using the watermark pixel shifting method to complete the watermark pixel marking and visible watermark embedding. In order to ensure that non-watermark pixels belonging to the color system represented by the watermark marking code will not be identified as watermark pixels and mistakenly removed during the watermark removal process, it is necessary to perform color replacement. Finally, magic matrix steganography is used to write the watermark information into the non-interested area of ​​the host image. When removing, the watermark marking code and other key information are first read to retrieve the watermark pixel, which is then reversely shifted to restore the original color information of the watermark pixel, thereby achieving seamless removal of the visible watermark.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of image processing, and in particular relates to a reversible adaptive watermark embedding and removal method based on color statistics. Background Art

[0002] In recent years, various industries have widely adopted visible watermark embedding technology to annotate images and video materials with relevant information such as the release date and specific source. This ensures the integrity and authenticity of the watermarked host material when used as evidence in judicial documents. However, due to the conspicuousness of visible watermarks, they may obscure key information in the image, interfering with the analysis and collection of judicial documents. For example, text watermarks carried on surveillance videos can obscure license plate information and suspect facial information, and logo watermarks on legal documents can obscure specific contract details. Therefore, scholars continue to invest in the detection and removal of visible watermarks, aiming to completely remove visible watermarks and restore the original information of the host image.

[0003] Zhang et al. proposed an encrypted reversible visible image watermarking scheme. The original image data is encrypted using a bitwise XOR operation with pseudorandom data, and a visible binary watermark image is inserted to achieve watermark embedding. Users who possess both the encryption key and the data hiding key can fully restore the original image. Qin et al. optimized a reversible visible image watermarking scheme based on differential expansion. Using run-length encoding, the differential image is compressed into a binary sequence, which is then embedded into the final watermark image. The watermark image is then accurately restored to the original image by extracting this sequence. However, both of these methods have significant drawbacks. First, they only work well for grayscale images and binary watermarked images, greatly limiting their versatility for color image applications. Second, watermark removal requires the additional knowledge of the data hiding key or Huffman coding table, making the overall process highly complex.

[0004] Qi et al. smoothed the difference image using a graph Laplacian regularizer to achieve compact compression. After encoding the difference image, they efficiently embedded the reconstructed data packet into the watermark image using conventional reversible data hiding methods. When removing the visible watermark, this method blindly extracted additional information from the watermark image and deconstructed the data packet to achieve high-quality restoration of the original image. However, this method is limited in size by compression efficiency and cannot achieve background-adaptive watermark embedding, resulting in confusion between the watermark and background image colors, making them difficult to distinguish.

[0005] Some methods are based on deep learning methods, which use neural network models combined with image redrawing technology to fit a "pseudo-original image" that conforms to the visual habits of the human eye. However, the restored image generated by this method may not accurately reflect the original information, cannot meet the authenticity required for judicial evidence, and is not recognized by judicial authorities. Summary of the Invention

[0006] In response to the shortcomings of the existing technology, the present invention proposes a reversible adaptive watermark embedding and removal method based on color statistics. By performing color statistics on the pixels in the watermark area of ​​the host image, the watermark color is adaptively generated to make the watermark embedded in the image clear in appearance, and the color of special pixels in the non-watermark area is protected, thereby ensuring the integrity of the host image after the watermark is removed to the greatest extent.

[0007] A reversible adaptive watermark embedding and removal method based on color statistics, including adaptive watermark color generation, watermark embedding and removal, specifically includes the following steps:

[0008] Step 1: Generate watermark code

[0009] Traverse all pixels in the watermark area of ​​the host image and record the 24-bit RGB color value of each pixel:

[0010] p c =(r7r6r5r4r3r2r1r0,g7g6g5g4g3g2g1g0,b7b6b5b4b3b2b1b0) (1)

[0011] Among them, r7, g7, and b7 represent the highest bit of the R channel value, G channel value, and B channel value of the pixel respectively. r 、n g 、n b bits, and the remaining 8-n r 、8-n g 、8-n b The resulting color is used as the representative color of the color system to which the pixel belongs. r 、n g 、n b The bits are arranged in sequence to form a binary sequence S, which is recorded as the color identification code:

[0012]

[0013] The complementary color of the representative color of the color system is calculated according to the following formula. Combined with the color information of the watermark area, the complementary color set and complementary color image of the watermark area at the color system level can be obtained:

[0014]

[0015] Among them, R, G, and B are the color values ​​of each channel of the target pixel, and R', G', and B' are the complementary color values ​​corresponding to each channel.

[0016] Specifies the high n of each channel r 、ng 、n b Colors with the same color system identification code belong to the same color system. According to the color system identification code, the pixels of the complementary color image in the watermark area are histogram-generated. The percentage of each color system in the complementary color set is used as the weight coefficient to aggregate the colors of the complementary color image and obtain a representative color as the watermark color C. W :

[0017] C W =∑h*P(h) (4)

[0018] Among them, h is the RGB value of the color system representative color, and P(h) is the ratio of the number of pixels of this color system to the total number of pixels of the complementary color image in the watermark area. W High n for three color channels r 、n g 、n b The bits are arranged in sequence and recorded as the watermark code StampCode:

[0019]

[0020] Step 2: Non-watermark pixel protection

[0021] According to the watermark shape, the color identification codes of the pixels not covered by the watermark, i.e., non-watermark pixels, within the watermark range are traversed. If the color identification code of a non-watermark pixel is the same as the watermark mark code obtained in step 1, the non-watermark pixel is marked as a protected pixel.

[0022] When there are protection pixels, count the colors of all pixels covered by the watermark, that is, the colors of the watermark pixels, put the colors that do not belong to the watermark pixels into the set Φ, and then select the color closest to the protection pixel from the set Φ Replace the color of the watermark pixel with This is to avoid misidentifying protected pixels as watermark pixels during the watermark removal process, thus completing the protection of non-watermark pixels.

[0023] Step 3: Watermark embedding

[0024] Shift the R channel value, G channel value, and B channel value of all watermark pixels to the right by n r 、n g 、n b Then fill the watermark code StampCode obtained in step 1 into the empty high n r 、n g 、n bFinally, the magic matrix steganography technique is used to write the watermark information in the non-interested area of ​​the host image, including the watermark code StampCode and the replacement color used in step 2. Watermark embedding position and size.

[0025] Step 4: Watermark removal

[0026] Read the watermark information from the non-interested area of ​​the host image, and traverse the high n values ​​of the R channel value, G channel value, and B channel value of all pixels within the watermark range. r 、n g 、n b If there is a high n of the three channels of the pixel point r 、n g 、n b The bit value is the same as the watermark code, and the color of the pixel is the same as the replacement color. If the pixel is different, it is determined that the pixel is a watermark pixel.

[0027] Shift the R channel value, G channel value, and B channel value of all watermark pixels to the left by n r 、n g 、n b The high bits of RGB channel values ​​greater than 8 bits are discarded, and the low bits are automatically filled with 0 to obtain the new RGB color value of the pixel point, completing the watermark removal.

[0028] The present invention has the following beneficial effects:

[0029] 1. Select the marker code based on the color information of the watermark area, so that the color of the embedded watermark has a large contrast with the background, and the contrast is obvious, so as to achieve clear and visible watermark embedding that is adaptive to the image background, and avoid the situation where the watermark information blends with the color texture of the original image background and is difficult to identify.

[0030] 2. The watermark image that embeds a visible watermark by pixel value shifting can also achieve seamless removal of the visible watermark by pixel value shifting, providing a restored image that meets the authentication authenticity and credibility for judicial procedures.

[0031] 3. There is no limit on the size of the host image and the watermark image, and any watermark can be embedded in a random position of the color image, which is universal and flexible. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] Figure 1 The process of reversible adaptive watermark embedding and removal method based on color statistics;

[0033] Figure 2 The watermark area image and its complementary color image extracted in the embodiment;

[0034] Figure 3 Schematic diagram of the watermark code embedding process;

[0035] Figure 4 Schematic diagram of adaptive visible watermark embedding;

[0036] Figure 5 Schematic diagram of the watermark code removal process;

[0037] Figure 6 Schematic diagram of adaptive visible watermark removal;

[0038] Figure 7 are the host image and watermark image selected in the embodiment;

[0039] Figure 8 These are images before and after watermark embedding and removal in the embodiment. DETAILED DESCRIPTION

[0040] The present invention will be further explained below with reference to the accompanying drawings;

[0041] A reversible adaptive watermark embedding and removal method based on color statistics, such as Figure 1 As shown, it includes adaptive watermark color generation AWS (Adaptive Watermark Stamp), watermark embedding VWE (Visible Watermark Embedding) and traceless removal VWR (Visible Watermark Removal). The specific steps are as follows:

[0042] Step 1: Generate watermark code

[0043] Color science knows that on the color wheel or the HSI color sphere, any two colors with a relative angle difference of 180° form a complementary color pair, and complementary colors will produce the strongest contrast when placed next to each other. Therefore, to meet the requirement of clear watermark display, it is best to make the watermark color and the background color complementary to each other. In the RGB color space, the calculation method of complementary colors is:

[0044]

[0045] Among them, R, G, and B are the color values ​​of each channel of the target pixel, and R', G', and B' are the complementary color values ​​corresponding to each channel.

[0046] like Figure 2 As shown, for the host image I O , where area I is the area where the watermark needs to be embedded. First, traverse all the pixels in the watermark area I and record the 24-bit RGB color value of each pixel:

[0047] p c=(r7r6r5r4r3r2r1r0,g7g6g5g4g3g2g1g0,b7b6b5b4b3b2b1b0) (2)

[0048] Among them, r7, g7, and b7 represent the highest bit of the R channel value, G channel value, and B channel value of the pixel point respectively.

[0049] According to the calculation method of complementary color, the complementary color image of I can be obtained

[0050] Each bit in the binary representation of a pixel contributes differently to the pixel value. The high bit usually has a greater impact on the visual effect of the image. That is, the binary high bit value of the pixel RGB value plays a decisive role in the pixel color. In other words, modifying p c The high bits of the color value will greatly affect the final color expression of the pixel. Therefore, the high bits of the RGB channels of the pixel are extracted separately. r 、n g 、n b bits, and the remaining 8-n r 、8-n g 、8-n b The resulting color is used as the representative color of the color system to which the pixel belongs. r 、n g 、n b The bits are arranged in sequence to form a binary sequence S, which is recorded as the color identification code:

[0051]

[0052] According to the color identification code, I and The pixels in the histogram are counted to obtain the color set H and When the color of the watermark area is single, the watermark color can be directly used as the complementary color of the watermark area. There are many elements in the set. Directly selecting a color from it cannot guarantee that the color of the entire watermark is significantly different from the color of the watermark area. Therefore, the set The percentage of each color in the image is used as the weight coefficient to aggregate the colors of the complementary color image and obtain the representative color as the watermark color C. W :

[0053] C W =∑h*P(h) (4)

[0054] Among them, h is the RGB value of the color system representative color, and P(h) is the ratio of the number of pixels of this color system to the total number of pixels of the complementary color image in the watermark area. W High n for three color channelsr 、n g 、n b The bits are arranged in sequence and recorded as watermark code StampCode. Assume n r =n g =n b =2, then the watermark code StampCode is:

[0055]

[0056] Step 2: Non-watermark pixel protection

[0057] According to watermark color C W The calculation method shows that there is C W ∈H, in order to avoid the non-watermark pixels and C W Pixels with the same color identification code are identified as watermark pixels, and these special non-watermark pixels need to be protected.

[0058] First, the color identification codes of the pixels in the watermark range that are not covered by the watermark, i.e., the non-watermark pixels, are traversed. If the color identification code of a non-watermark pixel is the same as the watermark code obtained in step 1, the non-watermark pixel is marked as a protected pixel.

[0059] When there are protection pixels, count the colors of all pixels covered by the watermark, that is, the colors of the watermark pixels, put the colors that do not belong to the watermark pixels into the set Φ, and then select the color closest to the protection pixel from the set Φ Replace the color of the watermark pixel with This is to avoid misidentifying protected pixels as watermark pixels during the watermark removal process, thus completing the protection of non-watermark pixels.

[0060] Step 3: Watermark embedding

[0061] Shift the R channel value, G channel value, and B channel value of all watermark pixels to the right by n r 、n g 、n b Then fill the watermark code StampCode obtained in step 1 into the empty high n r 、n g 、n b When marking the watermark pixel, the color of the pixel is represented as the background adaptive watermark color system pointed to by the watermark code StampCode. Figure 3 As shown, when n r =1,n g =1,n b=1, the length of the watermark code is 3 bits, and the three channel values ​​of the target pixel are uniformly shifted 1 bit to the right, and its upper 7 bits will be retained, that is, most of the original color information of the pixel will not be lost during the pixel shift process. At this time, a 1-bit vacancy is generated at the leftmost end of each color channel of the target pixel, and this vacancy can be used to implant the watermark code carrying the watermark color information. Using this method to implant StampCode for all watermark pixels, the watermark image that forms a clear contrast with the background image color is completely embedded in the host image, such as Figure 4 And all watermark pixels are accurately located in the visible watermark removal stage.

[0062] Finally, the magic matrix steganography technique is used to write watermark information in the non-interest area of ​​the host image, including the watermark code StampCode and the replacement color used in step 2. Watermark embedding location and size. Magic Matrix steganography can hide all the information required for seamless watermark removal with minimal impact on the host image quality.

[0063] Step 4: Watermark removal

[0064] During the watermark code embedding process, most of the original color information of the watermark pixel is retained. Therefore, in the watermark code removal stage, the pixel RGB shift method can also be used to restore the pixel color value.

[0065] Read the watermark information from the non-interested area of ​​the host image, and traverse the high n values ​​of the R channel value, G channel value, and B channel value of all pixels within the watermark range. r 、n g 、n b If there is a high n of the three channels of the pixel point r 、n g 、n b The bit value is the same as the watermark code, and the color of the pixel is the same as the replacement color. If the pixel is different, it is determined that the pixel is a watermark pixel.

[0066] Shift the R channel value, G channel value, and B channel value of all watermark pixels to the left by n r 、n g 、n b The high bits of RGB channel values ​​greater than 8 bits are discarded, and the low bits are automatically filled with 0 to obtain the new RGB color value of the pixel point, completing the watermark removal. Figure 5 Shows when n r =1,n g =1,n b =1, the watermark code removal process of a single pixel.

[0067] By removing the watermark code from the watermark pixel through this method, the original color information of the watermark pixel can be restored to a great extent. The maximum restoration error E of the color value of a single pixel is related to the length of the watermark code:

[0068]

[0069] When n r =1,n g =1,n b = 1, the length of StampCode N = 3, the pixel color loss rate is less than or equal to 0.39%, and the pixel value restoration error is almost negligible. The complete process of watermark removal is as follows Figure 6 shown.

[0070] In this embodiment, six 24-bit true color images with a size of 2400*2400 are selected as host images, including natural scenes commonly seen in real life and magazine text type images. In addition, a school logo image with a size of 800*800 is selected as the watermark image to be embedded. Figure 7 shown.

[0071] The watermark is embedded at the host image coordinate (x, y) = (1, 1) and then removed without a trace. The results of watermark embedding and removal are as follows: Figure 8 As shown. Figure 8 It can be seen that in different host images, due to the different background colors of the watermark embedding area, the final watermark color obtained by aggregating the color weights of the complementary color image in the area will also change accordingly. This can achieve clear and visible watermark embedding that is adaptive to the image background, avoiding the complete overlap of the watermark color with the original image background color, ensuring the integrity of the watermark in different host images, and has good versatility.

[0072] In order to more objectively demonstrate the watermark removal effect, Peak Signal to Noise Ratio (PSNR) and Root Mean Square Error (RMSE) are used to measure the restored image I R Relative to the original image I O Visual quality:

[0073]

[0074] Among them, MSE represents the original image I O Watermark area and its corresponding restored image I R The mean square error between watermark regions. R O with C O Indicates the width and height of the watermark area, I O (i,j) and I R(i, j) represents the pixel value of the original image and the restored image at coordinate (i, j), respectively.

[0075] Original image PSNR RMSE Mountain 48.80 0.93 Meadow 49.91 0.81 Sedona 48.78 0.93 Lighthouse 51.03 0.72 Elephant 49.24 0.88 Cactus 49.75 0.83 Average 49.585 0.85

[0076] The table shows the PSNR and RMSE values ​​of different host images after watermark embedding and removal. According to the table data, the restored image I R The average PSNR in the watermark area of ​​the image can reach 49.585, and the average RMSE is 0.85, which shows that this method can significantly restore the host image I O It can embed a high-discriminative visible watermark and perform high-quality lossless restoration of the watermarked image.

[0077] In summary, this method strictly preserves the original image I O The key color information of each pixel in the watermark area is finally restored to image I R Excellent image quality. Visible watermarks can be seamlessly removed to ensure the integrity and authenticity of images and video materials when used as legal evidence.

Claims

1. A reversible adaptive watermark embedding and removal method based on color statistics, characterized by: The specific steps include: Step 1: Generate watermark code Traverse all pixels in the watermark area of ​​the host image and record the 24-bit RGB color value of each pixel; extract the high n r 、n g 、n b bits, and the remaining 8-n r 、8-n g 、8-n b The bit is filled with zero, and the resulting color is used as the representative color of the color system to which the pixel belongs; The high n of the three channels of pixel color r 、n g 、n b The binary sequence composed of the bits arranged in sequence is recorded as the color identification code; Generate the complementary color image of the watermark area image, perform histogram statistics on the pixels of the complementary color image according to the color system identification code, use the percentage of each color system as the weight coefficient, aggregate the colors of the complementary color image, and obtain the representative color as the watermark color C W ; Set the watermark color to C W High n for three color channels r 、n g 、n b The bits are arranged in sequence and recorded as watermark code StampCode; Step 2: Non-watermark pixel protection According to the watermark shape, the color identification codes of non-watermark pixels within the watermark range are traversed. If there is a non-watermark pixel whose color identification code is the same as the watermark mark code obtained in step 1, the non-watermark pixel is marked as a protection pixel. When there is a protection pixel, count the colors of all watermark pixels, put the colors that do not belong to the watermark pixel into the set Φ, and then select the color φ that is closest to the protection pixel from the set Φ and replace the color of the watermark pixel with φ; Step 3: Watermark embedding Shift the R channel value, G channel value, and B channel value of all watermark pixels to the right by n r 、n g 、n b Then fill the watermark code StampCode obtained in step 1 into the empty high n r 、n g 、n b bits, completing the watermark embedding; finally, the watermark information is written into the non-interested area of ​​the host image; Step 4: Watermark removal Read the watermark information from the non-interested area of ​​the host image, and traverse the high n values ​​of the R channel value, G channel value, and B channel value of all pixels within the watermark range. r 、n g 、n b If there is a high n of the three channels of the pixel point r 、n g 、n b If the bit value is the same as the watermark code, and the color of the pixel is different from the replacement color φ, then the pixel is determined to be a watermark pixel; Shift the R channel value, G channel value, and B channel value of all watermark pixels to the left by n r 、n g 、n b The high bits of RGB channel values ​​greater than 8 bits are discarded, and the low bits are automatically filled with 0 to complete the watermark removal.

2. The reversible adaptive watermark embedding and removal method based on color statistics according to claim 1, characterized in that: The 24-bit RGB color value of a pixel is represented as: p c =(r7r6r5r4r3r2r1r0,g7g6g5g4g3g2g1g0,b7b6b5b4b3b2b1b0) (1) Among them, r7, g7, and b7 represent the highest bit of the R channel value, G channel value, and B channel value of the pixel point respectively.

3. The reversible adaptive watermark embedding and removal method based on color statistics as claimed in claim 1, characterized in that: The calculation method of complementary color value is: Among them, R, G, and B are the color values ​​of each channel of the target pixel, and R', G', and B' are the complementary color values ​​corresponding to each channel.

4. The reversible adaptive watermark embedding and removal method based on color statistics according to claim 1, characterized in that: Watermark color C W The calculation method is: C W =∑h*P(h) (3) Where h is the RGB value of the representative color of the color system, and P(h) is the ratio of the number of pixels of this color system to the total number of pixels of the complementary color image in the watermark area.

5. The reversible adaptive watermark embedding and removal method based on color statistics according to claim 1, characterized in that: Magic matrix steganography technology is used to realize the writing and reading of watermark information.

6. The reversible adaptive watermark embedding and removal method based on color statistics according to claim 1, characterized in that: The watermark information includes the watermark code StampCode, the replacement color φ used in step 2, and the watermark embedding position and size.

Citation Information

Patent Citations

  • Digital watermark embedded and extracting method and device

    CN101119429A

  • Watermark processing method and device, equipment and storage medium

    CN112884631A