CN118537200B - Reversible self-adaptive watermark embedding and removing method based on color statistics - Google Patents
Reversible self-adaptive watermark embedding and removing method based on color statisticsInfo
- Publication number
- CN118537200B CN118537200B CN202410698585.2A CN202410698585A CN118537200B CN 118537200 B CN118537200 B CN 118537200B CN 202410698585 A CN202410698585 A CN 202410698585A CN 118537200 B CN118537200 B CN 118537200B
- Authority
- CN
- China
- Prior art keywords
- watermark
- color
- pixel
- pixels
- bits
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T1/00—General purpose image data processing
- G06T1/0021—Image watermarking
- G06T1/0028—Adaptive watermarking, e.g. Human Visual System [HVS]-based watermarking
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/90—Determination of colour characteristics
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Editing Of Facsimile Originals (AREA)
- Image Processing (AREA)
Abstract
The invention discloses a reversible self-adaptive watermark embedding and removing method based on color statistics, which is characterized in that histogram statistics is carried out on a watermark region of an original image according to a color system, a corresponding complementary color image and an optimal watermark color are obtained through calculation, and the watermark color is ensured to form obvious contrast with the color of most pixel points in the watermark region. After obtaining the watermark marking code representing the color of the watermark, embedding the marking code by utilizing a watermark pixel shifting method to finish the marking of the watermark pixels and the embedding of the visible watermark. In order to ensure that non-watermark pixels belonging to the color system represented by the watermark marking code are not identified as watermark pixels and are erroneously removed in the watermark removal process, color replacement is required. And finally, writing watermark information into a non-interested area of the host image by using magic matrix steganography. When the watermark is removed, key information such as watermark marking codes and the like is read to search watermark pixels, the watermark pixels are reversely shifted, original color information of the watermark pixels is restored, and no-trace removal of the visible watermark is realized.
Description
Technical Field
The invention belongs to the technical field of image processing, and particularly relates to a reversible self-adaptive watermark embedding and removing method based on color statistics.
Background
In recent years, related information such as release date, specific source and the like of images and video materials is marked by adopting a visible watermark embedding technology in various industries, and the integrity and authenticity of the content of a watermark host material can be ensured when the watermark host material is used as a judicial file for verification. However, due to the significance of the visible watermark, the visible watermark may block key information in the image, interfere with analysis and evidence collection of judicial files, for example, the text watermark carried by the monitoring video may block license plate information and facial information of a suspected person, and the mark watermark of the legal file may block specific details of a contract. Therefore, students are continually put into the research work of detecting and removing the visible watermark, and aim to completely remove the visible watermark and restore the original information of the host image.
Zhang et al propose an encrypted reversible visible image watermarking scheme, original image data is encrypted by using a bitwise exclusive or operation of pseudo-random data, watermark embedding is realized by inserting a visible binary watermark image, and a user with an encryption key and a data hiding key can completely recover the original image. Qin et al optimized a reversible visible image watermarking scheme based on differential expansion, compressed differential images into binary sequences by run-length encoding, embedded into final watermark images, and accurately restored the watermark images into original images by extracting the sequences. However, the two methods have obvious defects that firstly, only the gray level image and the binary watermark image have good effects, the application universality of the color image is greatly limited, and secondly, the data hiding secret key or the Huffman coding table needs to be additionally mastered when the watermark is removed, so that the overall process complexity is higher.
Qi et al smooth the differential image through a laplace regularizer to achieve compact compression of the differential image, and after encoding the differential image, efficiently embed the reconstructed data packet into the watermark image using a conventional reversible data hiding method. When the visible watermark is removed, the method blindly extracts additional information from the watermark image, deconstructs the data packet, and realizes high-quality recovery of the original image. However, the method is influenced by compression efficiency, and has a certain limit on the size of the watermark image, in addition, the method cannot realize background self-adaptive watermark embedding, and the situation that the watermark is confused with the background image color and is difficult to distinguish can occur.
The partial method is based on a deep learning method, and a neural network model is combined with an image redrawing technology to fit a 'pseudo original image' which accords with the visual habit of human eyes, but the restored image generated by the method can not accurately reflect the original information, cannot meet the authenticity required by judicial evidence and is not accepted by a judicial institution.
Disclosure of Invention
Aiming at the defects of the prior art, the invention provides a reversible self-adaptive watermark embedding and removing method based on color statistics, which is used for adaptively generating watermark colors by carrying out color statistics on pixel points of a watermark area of a host image, so that the watermark in an embedded image has clear appearance, and carrying out color protection on special pixel points of a non-watermark area, thereby maximally ensuring the integrity of the host image after watermark removal.
A reversible self-adaptive watermark embedding and removing method based on color statistics comprises the steps of self-adaptive watermark color generation, watermark embedding and removing, and specifically comprises the following steps:
Step1, watermark marking code generation
Traversing all pixel points in a watermark area in a host image, and recording 24-bit RGB color values of each pixel:
pc=(r7r6r5r4r3r2r1r0,g7g6g5g4g3g2g1g0,b7b6b5b4b3b2b1b0) (1)
Wherein R 7、g7、b7 represents the highest bit of the R channel value, the G channel value and the B channel value of the pixel point respectively. Extracting high n r、ng、nb bits of three channels of the pixel RGB respectively, and carrying out zero padding on the remaining 8-n r、8-ng、8-nb bits to obtain a color which is used as a representative color of a color system to which the pixel belongs. At this time, the high n r、ng、nb bits of the three channels of pixel color are sequentially arranged to form a string of binary sequences S, which are marked as color system identification codes:
and calculating the complementary color of the color system representative color according to the following formula, and combining the color information of the watermark region to obtain a complementary color set and a complementary color image of the watermark region on the color system level:
Wherein R, G, B is the color value of each channel of the target pixel, and R ', G ', B ' are the complementary values corresponding to each channel.
The high n r、ng、nb bits of each channel are specified to be the same, namely the same color of the color system identification code belongs to the same color system. Carrying out histogram statistics on pixels of the complementary color image of the watermark region according to the color system identification code, and combining percentage ratio of each color system in the complementary color set as a weight coefficient to aggregate the colors of the complementary color image to obtain a representative color which is watermark color C W:
CW=∑h*P(h) (4)
Wherein h is RGB value of color system representative color, and P (h) is ratio of the number of the color system pixels to the total number of the complementary color image pixels in the watermark area. The high n r、ng、nb bits of the three color channels of watermark color C W are sequentially arranged and marked as watermark marking code StampCode:
step2, non-watermark pixel protection
Traversing the color system identification codes of the pixels which do not belong to watermark coverage, namely the non-watermark pixels, in the watermark range according to the watermark shape, and marking the non-watermark pixels as protection pixels if the color system identification codes of the non-watermark pixels are the same as the watermark marking codes obtained in the step 1.
When the protection pixel points exist, counting the colors of all the pixel points covered by the watermark, namely the watermark pixel points, putting the colors which do not belong to the watermark pixels into a set phi, and then selecting the color which is the closest to the protection pixel points from the set phiReplacing the color of the watermark pixel point withIn order to avoid the false recognition of the protection pixel point as the watermark pixel point in the watermark removing process, the non-watermark pixel protection is completed.
Step 3, watermark embedding
And (3) right shifting the R channel value, the G channel value and the B channel value of all the watermark pixel points by n r、ng、nb bits respectively, and sequentially filling the watermark marking code StampCode obtained in the step (1) with the vacated high n r、ng、nb bits to finish watermark embedding. Finally, watermark information is written in the non-interested area of the host image by using the magic matrix steganography technology, including watermark marking code StampCode, and the substitute colors used in step 2Watermark embedding location and size.
Step 4, watermark removal
Reading watermark information from a non-interested region of a host image, traversing high n r、ng、nb bits of R channel values, G channel values and B channel values of all pixel points in a watermark range, if the high n r、ng、nb bit values of three channels of the pixel points are the same as watermark marking codes, and the color of the pixel points is the same as the substitute colorIf the watermark pixel is different, the pixel is judged to be the watermark pixel.
And respectively shifting the R channel value, the G channel value and the B channel value of all the watermark pixel points by n r、ng、nb bits to the left, discarding the high bit with the RGB channel value larger than 8 bits, and automatically supplementing 0 to the low bit to obtain a new RGB color value of the pixel point, thereby completing watermark removal.
The invention has the following beneficial effects:
1. The marking code is selected based on the color information of the watermark region, so that the color for embedding the watermark has larger contrast with the background, the contrast is obvious, the self-adaptive clear visible watermark embedding of the image background is realized, and the situation that the watermark information is mixed with the color texture of the original image background and is difficult to identify is avoided
2. The watermark image of the visible watermark is embedded by a pixel value shifting method, and the traceless removal of the visible watermark can be realized by the pixel value shifting, so that a restored image meeting the authentication authenticity and credibility is provided for a judicial program.
3. There is no limitation on the size of the host image and watermark image, and any watermark can be embedded at random positions of the color image, so that the method has versatility and flexibility.
Drawings
FIG. 1 is a flow chart of a reversible adaptive watermark embedding and removing method based on color statistics;
FIG. 2 is an image of a watermark region extracted in an embodiment and its complementary color image;
FIG. 3 is a schematic diagram of a watermark code embedding process;
FIG. 4 is a schematic diagram of an adaptive visible watermark embedding;
FIG. 5 is a schematic diagram of a watermark code removal process;
FIG. 6 is a schematic diagram of adaptive visible watermark removal;
FIG. 7 illustrates a host image and a watermark image as used in the embodiment;
Fig. 8 illustrates images before and after watermark embedding and removal in an embodiment.
Detailed Description
The invention is further explained below with reference to the drawings;
A reversible self-adaptive watermark embedding and removing method based on color statistics, as shown in fig. 1, comprises self-adaptive watermark color generation AWS (Adaptive Watermark Stamp), watermark embedding VWE (Visible Watermark Embedding) and traceless removal VWR (Visible Watermark Removal), and comprises the following specific steps:
Step1, watermark marking code generation
It is known from colorimetry that any two colors with a 180 ° relative angular difference form a complementary color pair on the hue circle or on the HSI sphere, and that placing the complementary colors adjacent one another produces the strongest contrast. Therefore, to meet the requirement of clear display of the watermark, it is preferable to make the watermark color and the background color complementary to each other. In the RGB color space, the complementary color calculation method comprises the following steps:
Wherein R, G, B is the color value of each channel of the target pixel, and R ', G ', B ' are the complementary values corresponding to each channel.
As shown in fig. 2, for the host image I O, where the region I is a region where watermark is to be embedded, all pixel points in the watermark region I are traversed first, and 24-bit RGB color values of each pixel are recorded:
pc=(r7r6r5r4r3r2r1r0,g7g6g5g4g3g2g1g0,b7b6b5b4b3b2b1b0) (2)
Wherein R 7、g7、b7 represents the highest bit of the R channel value, the G channel value and the B channel value of the pixel point respectively.
According to the complementary color calculation method, a complementary color image of I can be obtained
Each bit on the binary representation of a pixel contributes differently to the pixel value, the higher bits generally have a large impact on the visual effect of the image, i.e. the binary higher bit values of the RGB values of a pixel play a decisive role in the color of the pixel, i.e. modifying the higher bits of the p c color value affects the final color representation of the pixel to a large extent. Therefore, the high n r、ng、nb bits of the three channels of the pixel RGB are respectively extracted, the remaining 8-n r、8-ng、8-nb bits are subjected to zero padding, and the obtained color is used as the representative color of the color system to which the pixel belongs. At this time, the high n r、ng、nb bits of the three channels of pixel color are sequentially arranged to form a string of binary sequences S, which are marked as color system identification codes:
identification code pair I and I according to color system The pixels in the color system are subjected to histogram statistics to obtain a color system set H andWhen the color of the watermark area is single, the color of the watermark may directly use the complementary color of the watermark area. But when the background color is relatively rich, the collectionThe elements in the watermark are many, and the direct selection of a certain color from the elements cannot ensure that the color of the whole watermark is greatly different from the color of the watermark area, so that the elements are combined into a setThe percentage ratio of each color is used as a weight coefficient, the colors of the complementary color images are aggregated, and the representative color is obtained as a watermark color C W:
CW=∑h*P(h) (4)
Wherein h is RGB value of color system representative color, and P (h) is ratio of the number of the color system pixels to the total number of the complementary color image pixels in the watermark area. The high n r、ng、nb bits of the three color channel of watermark color C W are sequentially arranged and marked as watermark code StampCode. Assuming that n r=ng=nb =2, the watermark code StampCode is:
step2, non-watermark pixel protection
According to the calculation method of the watermark color C W, there is a possibility that C W E H is present, and in order to avoid identifying the pixel point having the same color system identification code as C W in the non-watermark pixels as the watermark pixel point in the watermark removal process, the special non-watermark pixels need to be protected.
Firstly traversing color system identification codes of pixel points which do not belong to watermark coverage, namely non-watermark pixel points, and marking the non-watermark pixel points as protection pixel points if the color system identification codes of the non-watermark pixel points are the same as the watermark marking codes obtained in the step 1.
When the protection pixel points exist, counting the colors of all the pixel points covered by the watermark, namely the watermark pixel points, putting the colors which do not belong to the watermark pixels into a set phi, and then selecting the color which is the closest to the protection pixel points from the set phiReplacing the color of the watermark pixel point withIn order to avoid the false recognition of the protection pixel point as the watermark pixel point in the watermark removing process, the non-watermark pixel protection is completed.
Step 3, watermark embedding
The R channel value, the G channel value and the B channel value of all watermark pixel points are respectively shifted to the right by n r、ng、nb bits, then the watermark marking code StampCode obtained in the step 1 is sequentially filled with the vacated high n r、ng、nb bits, and the color of the pixel is characterized as the background self-adaptive watermark color system pointed by the watermark marking code StampCode while the watermark pixel marking is realized. As shown in fig. 3, when n r=1,ng=1,nb =1, the length of the watermark code is 3 bits, three channel values of the target pixel are uniformly shifted to the right by 1 bit, and the high 7 bits of the watermark code are reserved, i.e. most of original color information of the pixel cannot be lost in the pixel shifting process, and at this time, a 1-bit vacancy is generated at the leftmost end of each color channel of the target pixel, and the vacancy can be used for implanting the watermark code carrying watermark color information. Using this method, stampCode is implanted for all watermark pixels, allowing the watermark image, which is distinctly contrasting with the background image color, to be fully embedded in the host image, as shown in fig. 4. And accurately locates all watermark pixels during the visible watermark removal stage.
Finally, watermark information is written in the non-interested area of the host image by using the magic matrix steganography technology, including watermark marking code StampCode, and the substitute colors used in step 2Watermark embedding location and size. The magic matrix steganography technique can hide all the information needed for traceless watermark removal with minimal impact on the host image quality.
Step 4, watermark removal
In the watermark code implantation process, most of original color information of watermark pixels is reserved, so that pixel color value restoration can be realized by using a pixel RGB displacement method in the watermark code removal stage.
Reading watermark information from a non-interested region of a host image, traversing high n r、ng、nb bits of R channel values, G channel values and B channel values of all pixel points in a watermark range, if the high n r、ng、nb bit values of three channels of the pixel points are the same as watermark marking codes, and the color of the pixel points is the same as the substitute colorIf the watermark pixel is different, the pixel is judged to be the watermark pixel.
The R channel value, G channel value, B channel value of all watermark pixels are shifted to the left by n r、ng、nb bits respectively, the high bit with RGB channel value greater than 8 bits is truncated, the low bit is automatically complemented by 0, the new RGB color value of the pixel is obtained, watermark removal is completed, and fig. 5 shows watermark marking code removal process of single pixel when n r=1,ng=1,nb =1.
The watermark marking code is removed for the watermark pixels by the method, so that the original color information of the watermark pixels can be restored to a great extent. The single pixel color value maximum recovery error E is related to the length of the watermarking code:
When N r=1,ng=1,nb =1, the length n=3 of StampCode, the color loss rate of the pixel is 0.39% or less, and the pixel value recovery error is almost negligible. The complete process of watermark removal is shown in fig. 6.
In this embodiment, 6 true color images with a size of 2400 x 2400 are selected as the host images, including natural scenes common in real life and magazine text type images. In addition, a school badge image with a size of 800 x 800 is selected as the watermark image to be embedded, as shown in fig. 7.
Watermark is embedded in the position of the host image coordinate (x, y) = (1, 1), then traceless removal is carried out, and the embedding and removing results of the watermark are shown in fig. 8. As can be seen from fig. 8, in different host images, since the background colors of the watermark embedding regions are different, the final watermark color obtained by the color weight aggregation of the complementary color image in the region is also changed accordingly, so that the self-adaptive clear visible watermark embedding of the image background can be realized, the complete superposition of the watermark color and the background color of the original image is avoided, the integrity of the watermark in different host images is ensured, and the watermark has good universality.
To more objectively demonstrate the watermark removal effect, the peak signal-to-Noise Ratio (PSNR) and root mean square offset (Root Mean Square Error, RMSE) are used to measure the visual quality of the restored image I R relative to the original image I O:
Where MSE represents the mean square error between the original image I O watermark region and its corresponding restored image I R watermark region. R O and C O represent the width and height of the watermark region, and I O (I, j) and I R (I, j) represent the pixel values of the original image and the restored image at coordinates (I, j), respectively.
| 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 |
In the table, the PSNR value and the RMSE value after watermark embedding and removing are carried out on different host images, according to the table data, the PSNR average value of the restored image I R in the watermark area range of the image can reach 49.585, and the RMSE average value is 0.85, which shows that the method can obviously restore the detail information of the host image I O, and can carry out high-quality lossless restoration on the watermark image while embedding the visible watermark with high discrimination.
In summary, the method strictly retains the key color information of each pixel in the watermark region of the original image I O, and finally the restored image I R has excellent image quality. The visible watermark can be removed without trace, so that the integrity and the authenticity of the image and the video material which are used as judicial files for effective verification can be ensured.
Claims (6)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202410698585.2A CN118537200B (en) | 2024-05-31 | 2024-05-31 | Reversible self-adaptive watermark embedding and removing method based on color statistics |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202410698585.2A CN118537200B (en) | 2024-05-31 | 2024-05-31 | Reversible self-adaptive watermark embedding and removing method based on color statistics |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN118537200A CN118537200A (en) | 2024-08-23 |
| CN118537200B true CN118537200B (en) | 2025-09-19 |
Family
ID=92389259
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202410698585.2A Active CN118537200B (en) | 2024-05-31 | 2024-05-31 | Reversible self-adaptive watermark embedding and removing method based on color statistics |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN118537200B (en) |
Citations (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101119429A (en) * | 2006-08-01 | 2008-02-06 | 北京北大方正电子有限公司 | A method and device for digital watermark embedding and extraction |
| CN112884631A (en) * | 2021-02-24 | 2021-06-01 | 江苏保旺达软件技术有限公司 | Watermark processing method, device, equipment and storage medium |
Family Cites Families (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US6721440B2 (en) * | 1995-05-08 | 2004-04-13 | Digimarc Corporation | Low visibility watermarks using an out-of-phase color |
| US7072487B2 (en) * | 2001-01-26 | 2006-07-04 | Digimarc Corporation | Watermark detection using adaptive color projections |
| CN116993570A (en) * | 2023-09-01 | 2023-11-03 | 鲁东大学 | Robust and reversible color digital image blind watermarking method |
-
2024
- 2024-05-31 CN CN202410698585.2A patent/CN118537200B/en active Active
Patent Citations (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101119429A (en) * | 2006-08-01 | 2008-02-06 | 北京北大方正电子有限公司 | A method and device for digital watermark embedding and extraction |
| CN112884631A (en) * | 2021-02-24 | 2021-06-01 | 江苏保旺达软件技术有限公司 | Watermark processing method, device, equipment and storage medium |
Also Published As
| Publication number | Publication date |
|---|---|
| CN118537200A (en) | 2024-08-23 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| Hu et al. | Reversible visible watermarking and lossless recovery of original images | |
| Gutub | Pixel indicator technique for RGB image steganography | |
| CN109348228B (en) | A system and method for reversible information hiding in image encryption domain | |
| CN111970507B (en) | Reversible Data Hiding Method for Ciphertext Domain Image Based on Pixel Difference Coding | |
| CN110913092B (en) | A Reversible Information Hiding Method for Encrypted Image | |
| CN102682418B (en) | Method for embedding and extracting multiple zero watermarks of digital image | |
| CN114666453B (en) | A method for reversible data hiding in separable ciphertext domains based on bit-plane partitioning | |
| CN114374774A (en) | A Separable Encrypted Domain Reversible Information Hiding Method Based on Nearest Neighbor Pixel Prediction | |
| Ernawan et al. | Three layer authentications with a spiral block mapping to prove authenticity in medical images | |
| CN114663268B (en) | Reversible image watermarking algorithm based on improved bit plane decomposition and difference expansion | |
| Puteaux et al. | High-capacity data hiding in encrypted images using MSB prediction | |
| CN113763226A (en) | Reversible double-water-printing scheme suitable for color images | |
| CN118537200B (en) | Reversible self-adaptive watermark embedding and removing method based on color statistics | |
| Surekha et al. | Visual secret sharing based digital image watermarking | |
| CN105741222A (en) | Steganographic information positioning method based on pixel subset embedding rate estimation | |
| Kumar et al. | Data hiding with dual based reversible image using sudoku technique | |
| RU2288544C2 (en) | Method for embedding additional information into digital images | |
| CN117640851A (en) | Encryption domain reversible information hiding method based on bit plane reassignment | |
| CN115272042A (en) | A Steganographic Embedding and Extraction Method Based on XOR Coding and Local Thresholding | |
| Chang et al. | A watermarking scheme based on principal component analysis technique | |
| Li et al. | Reversible Adaptive Visible Watermark based on Color Statistics. | |
| Yang et al. | A Data Hiding Method Based on Partition Variable Block Size with Exclusive-or Operation on Binary Image | |
| CN120125416B (en) | An improved color image tampering detection and self-recovery method | |
| Lin et al. | A robust watermarking scheme combined with the FSVQ for images | |
| CN118694862A (en) | Reversible data hiding method based on adaptive bit-plane partitioning and prediction error map |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant |