Picture watermark embedding method and system capable of adaptively adjusting embedding intensity
By adaptively adjusting the watermark embedding intensity in the RGB color space and modifying the RGB three-channel parameters according to the pixel grayscale value, the problem of watermark visibility differences under different backgrounds is solved, achieving visual consistency and invisibility of the watermark under different backgrounds.
Patent Information
- Application Number
- CN202210184518.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-02-28
- Publication Date
- 2025-11-07
- Estimated Expiration
- 2042-02-28
AI Technical Summary
Existing invisible watermarking technologies exhibit significant differences in visibility under different backgrounds, with watermarks appearing more prominent against light-colored backgrounds, affecting the consistency of visual effects.
By modifying the three-channel parameter values of each pixel in the image to be embedded in the RGB color space according to the content of the watermark matrix, the modification magnitude is inversely proportional to the grayscale value of the pixel, adaptively adjusting the embedding intensity, and generating a watermark pattern of the same size as the image to be embedded.
It achieves consistent watermark visibility against both light and dark backgrounds, and improves the watermark's invisibility, making it less noticeable.
Smart Images

Figure CN114547563B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of watermark embedding, in particular to a picture watermark embedding method and system capable of adaptively adjusting embedding intensity. BACKGROUND
[0002] A copyright picture is a concept relative to a pirated picture. Generally, it refers to an image work authorized by the copyright holder of the picture or the author or institution creating the picture for commercial, publishing, exhibition, etc. After the picture is created, the picture owner generally adds a watermark to the picture to avoid being used. The current common picture watermark technology mainly includes two types.
[0003] The first type is visible watermark, that is, adding visible information or icons to the picture. This method is relatively simple and fast, but the disadvantage is that it is visually visible and easy to be attacked and erased, and the experience of customers watching the picture is poor. The second type is invisible watermark. The main market picture invisible watermark algorithm is mainly to convert the image from the spatial domain to the frequency domain, then embed the watermark in the frequency domain, and then restore it to the spatial domain. Invisible watermark has many advantages such as invisibility, imperceptibility and non-erasability, which is obviously superior to visible watermark.
[0004] There are many schemes for adding invisible watermarks to pictures. The invention patent "Watermark generation and decoding method, storage medium and electronic device" (application number: 2021107265874) submitted by our company on June 29, 2021 discloses a method for adding watermark to image. Here, a watermark pattern is generated by a random template R and copyright information, and then the watermark pattern is superimposed on the image to be embedded. Since the watermark is embedded by slightly modifying the channel value, the superimposed image has very small changes compared with the original image, thereby having good invisible effect. However, since the above modification is a fixed value, the visibility of the watermark is different in different lightness backgrounds. The watermark in the dark background is slightly more obvious than the light background. For example, when there are a large number of white areas in the picture, the watermark will be more obvious. SUMMARY
[0005] The primary purpose of the present application is to provide a picture watermark embedding method capable of adaptively adjusting embedding intensity, so as to ensure consistent watermark visibility in light or dark backgrounds.
[0006] To achieve the above object, the technical scheme adopted by the present application is as follows: a picture watermark embedding method capable of self-adaptively adjusting embedding strength, comprising the following steps: S100, encoding according to a random module R and binary information to be embedded to obtain a binary watermark pattern; S200, tiling the watermark pattern in a horizontal direction and a vertical direction to the width and height of a picture to be embedded to obtain a watermark matrix pattern; S300, modifying three-channel parameter values of each pixel point of the picture to be embedded in an RGB color space according to the content of the watermark matrix pattern, and the modification amplitude is inversely proportional to the gray value of the pixel point.
[0007] Another object of the present application is to provide a picture watermark embedding system capable of self-adaptively adjusting embedding strength, which ensures consistent watermark visibility effect in a light or dark background.
[0008] To achieve the above object, the technical scheme adopted by the present application is as follows: a picture watermark embedding system capable of self-adaptively adjusting embedding strength, comprising a watermark pattern generation module, which is used for encoding according to a random module R and binary information to be embedded to obtain a binary watermark pattern; a watermark matrix generation module, which is used for generating a watermark matrix pattern with the same size as a picture to be embedded according to the watermark pattern; and a watermark superimposition module, which is used for modifying three-channel parameter values of each pixel point according to the gray value of the pixel point in the picture to be embedded, the watermark matrix pattern and a preset modification amplitude to obtain a picture with embedded watermark, wherein the modification amplitude is inversely proportional to the gray value of the pixel point.
[0009] Compared with the prior art, the above two schemes of the present application have the following technical effects: a watermark pattern is generated according to a random template R and information to be embedded, and then a watermark matrix pattern is generated according to the watermark pattern, so that a watermark pattern with the same size as the picture to be embedded can be conveniently obtained; when superimposed, the embedding of the watermark is conveniently realized by modifying the pixel values of the three channels of RGB; and when modified, the modification amplitude is inversely proportional to the gray value, that is, the modification amplitude is small in a light background and the modification amplitude is large in a dark background, so that self-adaptive modification of the modification amplitude is realized, the stealth effect of the watermark is improved, and the watermark is not easy to be detected. BRIEF DESCRIPTION OF DRAWINGS
[0010] Fig. 1 is a flowchart of the present application;
[0011] Fig. 2 is a watermark pattern generation flowchart in the present application;
[0012] Fig. 3 is a system block diagram of the present application. DETAILED DESCRIPTION
[0013] The present application will be described in detail below. Figs. 1 to 3 with reference to the accompanying drawings.
[0014] Reference is made toFig. 1 The application discloses a picture watermark embedding method capable of self-adaptively adjusting embedding intensity, and comprises the following steps: S100, encoding according to a random module R and binary information to be embedded to obtain a binary watermark pattern; S200, laying out the watermark pattern in a horizontal direction and a vertical direction to the width and height of a picture to be embedded to obtain a watermark matrix pattern; and S300, modifying three-channel parameter values of each pixel point of the picture to be embedded in an RGB color space according to the content of the watermark matrix pattern, and the modification amplitude is inversely proportional to the gray value of the pixel point. According to the random template R and the information to be embedded, the watermark pattern is generated, and then the watermark matrix pattern is generated according to the watermark pattern, so that the watermark pattern with the same size as the picture to be embedded can be conveniently obtained. When the watermark is superimposed, the embedding of the watermark is conveniently realized by modifying the pixel values of the three channels of RGB, and when the modification is performed, the modification amplitude is inversely proportional to the gray value, that is, the modification amplitude is small in a light color background and the modification amplitude is large in a dark color background. Therefore, the self-adaptive modification of the modification amplitude is realized, the stealth effect of the watermark is improved, and the watermark is not easy to be perceived.
[0015] It should be noted that the "modification amplitude is inversely proportional to the gray value of the pixel point" mentioned herein does not mean that, for any two pixel points P1 and P2, if the gray value of P1 is greater than that of P2, the modification amplitude of P1 is necessarily smaller than the gray value of P2. This sentence should be understood as follows: the modification amplitude is large when the gray value is small, and the modification amplitude is small when the gray value is large.
[0016] Further, in the step S300, the modification amplitude wherein R, G, B and r, g, b respectively represent three-channel parameter values of the pixel point before and after modification, and here, the value of the RGB three channels that changes the most is defined as the modification amplitude, so that the relationship of the remaining gray values can be better calculated; the gray value of the pixel point The change of the gray value of the pixel point before and after modification is less than a set threshold, and the threshold can be set to about 0.1, so that the gray value of the pixel point before and after modification can be basically unchanged.
[0017] Since the channel value is an integer, and the channel value will not be greatly modified during the modification, the modification amplitude k has a very limited value. In order to ensure that the modification amplitude is inversely proportional to the gray value, a plurality of gray value intervals are set in the step S300, and the modification amplitude of the pixel point in each gray value interval is consistent, as long as the relationship "the modification amplitude is large when the gray value is small, and the modification amplitude is small when the gray value is large" is ensured.
[0018] The relationship between the modification amplitude and the gray value is described in detail by way of example. Specifically, the gray value interval has three intervals: when , the modification amplitude ; when the modification range ; when the modification range ; wherein , that is, when k2 takes 4, k3 can only take 2 or 3. The specific values here are only a preferred scheme, and other values can be selected in practice.
[0019] Further, since the channel B has a smaller contribution to the gray value, in order to ensure the consistency of the gray value, preferably, in the step S300, when the three-channel parameter values of the pixel points are modified, the change value of the channel B is the modification range k, and the change values of the channels R and G are equal to 0 or 1 or -1 to ensure that the gray value change of the pixel points before and after the modification is less than a set threshold. Here, the channel B is selected as the main modification channel, which can increase the value range of the modification range k. If the channels R or G are selected as the main modification channel, it is not conducive to maintaining the consistency of the gray value.
[0020] More specifically, when , the modified r, g, b three-channel parameter values of the pixel points are respectively equal to R+1, G+1, B-8 or respectively equal to R+1, G+1, B-7; when , the modified r, g, b three-channel parameter values of the pixel points are respectively equal to R, G+1, B-5; when , the modified r, g, b three-channel parameter values of the pixel points are respectively equal to R+1, G, B-3 or respectively equal to R-1, G+1, B-3. This specific embodiment is a preferred scheme with very good modification effect. When modifying, for any pixel point of the picture to be embedded, first determine whether the parameter of the pixel point corresponding to the watermark matrix picture is 0 or 1, if it is 1, then combine the gray value of the pixel point and the judgment step here to modify the RGB three-channel parameter values. If it is 0, it can not be modified, or it can be modified in reverse, the reverse modification of the first modification mode R+1, G+1, B-8 is R-1, G-1, B+8, and the specific modification is not described here, we only need to have modification, and the difference is embodied, which can perform watermark embedding.
[0021] Referring to Fig. 2In the invention patent "watermark generation, decoding method and storage medium, electronic equipment" applied by our company (application number: 2021107265874), when decoding the watermark, the random template R needs to be used, which requires the embedding party and the extracting party to communicate and transmit the random template R, which is very inconvenient and unsafe in use. In the present application, preferably, in step S100, the random template R is a preset size binary image; the information to be embedded contains N-bit binary information, wherein N is an integer; the random template R is encoded as follows: S101, add 1 at the beginning of the N-bit binary number, and then convert the N+1-bit binary number into a two-dimensional matrix; S102, judge the element value in the two-dimensional matrix in the order from left to right and from top to bottom, if the element is in the first row and the first column, use the image of the random template R to represent the element, if the element value is the same as the previous element value, use the image of the random template R to represent the element, if the element value is different from the previous element value, use the inverse image of the random template R to represent the element. Encode in this way, without using the random template R, the decoding can be performed, because here the binary information is embodied by differentiation, and the encoding is performed according to the above steps, which improves the convenience and security of decoding.
[0022] Reference Fig. 3 A picture watermark embedding system capable of self-adapting to adjust the embedding strength, comprising a watermark pattern generation module for encoding according to a random module R and a binary information to be embedded to obtain a binary watermark pattern; a watermark matrix generation module for generating a watermark matrix graph with the same size as the picture to be embedded according to the watermark pattern; a watermark superposition module for modifying the three-channel parameter values of each pixel point according to the gray value of the pixel point in the picture to be embedded, the watermark matrix graph and the preset modification amplitude to obtain a picture embedded with the watermark, wherein the modification amplitude is inversely proportional to the gray value of the pixel point. According to the random template R and the information to be embedded, the watermark pattern is generated, and then the watermark matrix graph is generated according to the watermark pattern, so that the watermark graph with the same size as the picture to be embedded can be easily obtained. When superimposed, the embedding of the watermark is realized by modifying the RGB three-channel pixel values, and when modified, the modification amplitude is inversely proportional to the gray value, that is, the modification amplitude is small in light color background and the modification amplitude is large in dark color background, so that the self-adaptive modification of the modification amplitude is realized, and the stealth effect of the watermark is improved, which is not easy to be detected.
[0023] The application further discloses a computer readable storage medium and an electronic device, wherein the computer readable storage medium stores a computer program, and the computer program is executed by a processor to implement any one of the picture watermark embedding methods with adaptive adjustment of embedding strength. The electronic device comprises a memory, a processor and a computer program stored in the memory, and the processor executes the computer program to implement any one of the picture watermark embedding methods with adaptive adjustment of embedding strength.
Claims
1. A picture watermark embedding method capable of adaptively adjusting embedding strength, characterized by: The method comprises the following steps: S100, encoding according to a random module R and binary information to be embedded to obtain a binary watermark pattern; S200, tiling the watermark pattern in a horizontal direction and a vertical direction to the width and height of a picture to be embedded to obtain a watermark matrix picture; S300, modifying three-channel parameter values of each pixel point of the picture to be embedded in an RGB color space according to the content of the watermark matrix picture, and the modification amplitude is inversely proportional to the gray value of the pixel point, wherein the modification amplitude k = max(|r-R|, |g-G|, |b-B|), R, G, B and r, g, b respectively represent the three-channel parameter values of the pixel point before and after modification, the change value of channel B is the modification amplitude k, the change values of channel R and channel G are equal to 0 or 1 or -1, and the gray value change of the pixel point before and after modification is less than a set threshold.
2. The picture watermark embedding method capable of adaptively adjusting the embedding strength according to claim 1, wherein: In the step S300, a plurality of gray value intervals are provided, and the modification amplitude of the pixel point in each gray value interval is consistent.
3. The picture watermark embedding method capable of adaptively adjusting the embedding strength according to claim 2, wherein: The gray value interval has three: When Gray ∈ [0, 90), the modification amplitude k1 = {6, 7, 8, 9}; When Gray ∈ [90, 160), the modification amplitude k2 = {4, 5, 6, 7}; When Gray ∈ [160, 255], the modification amplitude k3 = {2, 3, 4, 5}; Wherein k1 > k2 > k3.
4. The picture watermark embedding method with self-adaptive adjustment of embedding strength according to claim 3, wherein: When Gray ∈ [0, 90), the three-channel parameter values of the pixel point after modification are respectively equal to R+1, G+1, B-8 or respectively equal to R+1, G+1, B-7; When Gray ∈ [90, 160), the three-channel parameter values of the pixel point after modification are respectively equal to R, G+1, B-5; When Gray ∈ [160, 255], the three-channel parameter values of the pixel point after modification are respectively equal to R+1, G, B-3 or respectively equal to R-1, G+1, B-3.
5. The picture watermark embedding method with adaptive strength adjustment of claim 1, wherein: In the step S100, the random template R is a binary image with a preset size; the information to be embedded contains a binary number of N bits, wherein N is an integer; the random template R is encoded according to the following steps: S101, adding 1 at the beginning of the binary number of N bits, and then converting the binary number of N+1 bits into a two-dimensional matrix; S102, judging the element value in the two-dimensional matrix in the order from left to right and from top to bottom, if the element is in the first row and the first column, using the image of the random template R to represent the element, if the element value is the same as the previous element value, using the image of the random template R to represent the element, if the element value is different from the previous element value, using the inverse image of the random template R to represent the element.
6. A picture watermark embedding system capable of adaptively adjusting embedding strength, employing the picture watermark embedding method capable of adaptively adjusting embedding strength according to any one of claims 1 to 5, characterized in that: The method comprises a watermark pattern generation module, configured to encode according to a random module R and binary information to be embedded to obtain a binary watermark pattern; a watermark matrix generation module, configured to generate a watermark matrix picture with the same size as a picture to be embedded according to the watermark pattern; The watermark superposition module is configured to modify three-channel parameter values of each pixel point in the picture according to a gray value of the pixel point, a watermark matrix picture, and a preset modification amplitude to obtain a picture with embedded watermark, wherein the modification amplitude is inversely proportional to the gray value of the pixel point, the modification amplitude k = max(|r-R|,|g-G|,|b-B|), R, G, B, and r, g, b represent three-channel parameter values of the pixel point before and after modification, a change value of channel B is the modification amplitude k, change values of channel R and channel G are equal to 0 or 1 or -1, and a gray value of the pixel point Gray = 0.299*R+0.587*G+0.114*B, and a change in the gray value of the pixel point before and after modification is less than a set threshold.
7. A computer-readable storage medium, characterized in that: A computer program is stored on the computer readable storage medium, and the computer program is executed by a processor to implement the picture watermark embedding method with adaptive adjustment of embedding strength according to any one of claims 1-5.
8. An electronic device, comprising: A computer program is stored on the computer readable storage medium, and the computer program is executed by a processor to implement the picture watermark embedding method with adaptive adjustment of embedding strength according to any one of claims 1-5.
Citation Information
Patent Citations
Adaptive hidden watermark optimization method and system, medium and terminal
CN112488902A
Watermark generation method, watermark decoding method, storage medium and electronic equipment
CN113392381A
Image processing device, image processing method, and program
US20190066254A1