Two-color complementary digital watermark generation and decoding method based on jitter grid and point diffusion
By employing a dual-color complementary digital watermarking technology based on dithering grids and dot diffusion, and utilizing the complementary spectral characteristics of cyan and magenta and Gaussian diffusion, the robustness of digital watermarking under image compression, conversion, and color distortion is solved, achieving efficient information recovery and anti-interference capabilities.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHANGHAI UNIV
- Filing Date
- 2025-12-31
- Publication Date
- 2026-04-17
AI Technical Summary
Existing digital watermarking technologies are not robust enough in the face of image compression, conversion, optical noise interference, color distortion, etc., which leads to the loss of watermark information or difficulty in decoding. In addition, traditional solutions are prone to producing moiré patterns and color distortion.
A dual-color complementary digital watermarking method using dithered grid and dot diffusion is adopted. The complementary spectral characteristics of cyan and magenta are used for differential encoding, and Gaussian diffusion is used to simulate natural texture to generate and decode watermark images. RS error correction code is combined to improve robustness.
It achieves visually natural concealment and is highly robust against color distortion and analog-to-digital conversion attacks, enabling the recovery of complete information under harsh conditions.
Smart Images

Figure CN121881318A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of digital watermarking and information security technology, specifically involving a method for generating and decoding dual-color complementary digital watermarks based on dithering grids and dot diffusion, which can be applied to scenarios such as digital image copyright protection, content traceability, and anti-counterfeiting authentication. Background Technology
[0002] With the rapid development of mobile internet, social media, and high-resolution display technology, the acquisition and dissemination of multimedia data has become exceptionally convenient. However, this has also led to increasingly serious problems such as illegal copying, malicious tampering, and data leakage of digital images. Digital watermarking technology, as a technique that conceals specific information (such as copyright notices, serial numbers, and hash values) into multimedia data, has become an important means in the fields of content protection and information security.
[0003] However, existing digital watermarking technologies still face many intractable technical bottlenecks in large-scale practical applications: (1) Vulnerability of spatial domain algorithms: Although traditional least significant bit replacement or simple pixel overlay algorithms are computationally efficient, they are extremely vulnerable. Once an image undergoes lossy compression (such as JPEG compression), size scaling, or a "digital-analog-digital" conversion process (such as screen capture, printing and scanning), the watermark information is often completely lost due to pixel resampling, interpolation errors and optical noise interference.
[0004] (2) Synchronization problem of transform domain algorithm: Although algorithms based on DCT, DWT or SVD perform well in terms of compression resistance, the rigid synchronization signal they rely on is very easy to fail when faced with physical ink dot diffusion of printer, mechanical jitter of scanner, or perspective distortion when shooting with mobile phone, resulting in the decoding end being unable to correctly locate the watermark embedding area.
[0005] (3) Moiré patterns caused by regular grids: Traditional frequency modulation or amplitude modulation halftone watermarks, if the points are arranged too neatly (such as a standard orthogonal matrix), are very likely to interfere with the high-frequency texture of the image itself (such as striped clothes, building grids) or the physical pixel grid of the display, producing low-frequency moiré patterns that are extremely sensitive to the human eye, which seriously damages the visual quality of the image.
[0006] (4) Uncontrollability of completely random sampling: If a Poisson disk or completely random sampling is used, although periodic textures are avoided, noise spots caused by the "clustering" of points in local areas are likely to occur, or uneven information density caused by "holes". In blind detection scenarios, the decoding end has difficulty predicting the exact location of random points at low cost, which increases the complexity of synchronous calculation.
[0007] (5) Poor resistance to color distortion: Many watermarking schemes rely on absolute color values (such as specific RGB values) for encoding. However, during the printing process, due to the limitations of the CMYK color gamut, the non-linear superposition of inks, and the ink absorption of paper, colors often undergo severe non-linear shifts. In screen shooting scenarios, color distortion is even more severe due to the influence of ambient light color temperature (such as warm yellow light and cool white light), automatic white balance of the camera, and exposure strategies. Traditional monochrome watermarking or algorithms that rely on absolute thresholds are prone to high bit error rates as a result.
[0008] Therefore, the industry urgently needs a highly robust watermarking solution that has both excellent visual concealment—able to simulate the texture of natural paper or the graininess of film—and the ability to effectively resist color distortion and analog-to-digital conversion attacks by utilizing the characteristics of human vision. Summary of the Invention
[0009] To address the problems existing in the prior art, this invention provides a dual-color complementary digital watermark generation and decoding method based on dithering grid and dot diffusion. It aims to combine the "blue noise" characteristics of dithering sampling in the frequency domain, utilize the complementary spectral absorption characteristics of cyan and magenta in the RGB and CMYK color spaces for differential encoding, and simulate the halo effect and dot gain effect of physical optics through Gaussian diffusion to achieve a natural visual transition and extremely high robustness for cross-media transmission.
[0010] To achieve the above objectives, the present invention provides the following solution: A method for generating dual-color complementary digital watermarks based on dithering grids and dot diffusion, the method comprising: Convert the watermark string to be embedded into a binary bit stream; The number of coding points is dynamically calculated based on the length of the binary bit stream. The dithering grid algorithm is used to divide the target image into regular micro grids to generate coding points. Based on the values of the binary bit stream, the generated coded bits are paired in sequence and mapped to complementary color combinations of "cyan-magenta" or "magenta-cyan". A blank high-resolution canvas is constructed based on the target image, and subtractive color rendering is performed on the complementary color combination using a diffusion kernel on the blank high-resolution canvas. The rendered blank high-resolution canvas is downsampled to the target image size using a region averaging algorithm to generate the final watermark image.
[0011] Preferably, the method for converting the watermark string to be embedded into a binary bitstream includes: Convert the watermark string to be embedded into a standard byte stream; Error correction is performed on standard byte streams based on RS error correction coding; Convert the error-corrected standard byte stream into a binary bit stream.
[0012] Preferably, the method for dynamically calculating the number of coding points based on the length of the binary bit stream and using a dithering grid algorithm to divide the target image into regular micro-grids to generate coding points includes: Two-point complementary coding is adopted, and the number of coding points is dynamically calculated based on the length of the binary bit stream; Based on the number of encoded points, the target image is divided into regular micro-grids; Traverse each cell of the microgrid to obtain the center coordinates; By introducing random perturbations, the point distribution is made to approximate the effect of "Poisson disk sampling"; Based on the center coordinates and random perturbation, coded points are generated.
[0013] Preferably, the method for mapping the generated coded bits to complementary color combinations of "cyan-magenta" or "magenta-cyan" in sequence according to the values of the binary bit stream includes: binary bit stream B Each of them b k Mapped to a pair of points ( P 2k , P 2k+1 ): Logic 0: Setting P 2k It is blue. P 2k+1 It is magenta; Logic 1: Setting P 2k It is magenta. P 2k+1 It is cyan.
[0014] Preferably, the method of constructing a blank high-resolution canvas based on the target image and performing subtractive color rendering on the blank high-resolution canvas using a diffusion kernel for complementary color combinations includes: Construct a blank high-resolution canvas with a size that is a preset multiple of the target image; A two-dimensional Gaussian kernel function is used to generate the diffusion kernel; Subtract the value of the diffusion kernel from the red channel of a blank high-resolution canvas to achieve cyan point rendering; Magenta dot rendering is achieved by subtracting the diffusion kernel value from the green channel of a blank high-resolution canvas.
[0015] This invention also provides a dual-color complementary digital watermark decoding method based on dithering grid and dot diffusion. The decoding method is used to decode the watermark image generated by the aforementioned production method. The decoding method includes: Obtain the metadata of the watermark image to be detected during the generation stage, reconstruct the encoded points, and the metadata includes RS error correction parameters and the original image size; On the watermark image to be detected, the average color channel value of pixels within a preset radius is read, centered on the coordinates of the reconstructed encoded points. Calculate the numerical difference between paired coded points on a specific color channel, and extract the bit stream based on the numerical difference; The extracted bitstream is reassembled into a byte array and sent to the RS decoder for error correction to obtain the original watermark information.
[0016] Preferably, the method for reconstructing the encoded points includes: Using the shared key seed and original image size of the dithering grid algorithm, the coded points are reconstructed by running the dithering grid algorithm.
[0017] Preferably, the method for calculating the numerical difference between paired coded bits in a specific color channel and extracting the bitstream based on the numerical difference includes: For each pair of coded points Calculate the difference: ,in, for The green component, for The green component; like ,determination It is blue. The color is magenta. According to the encoding rule "cyan-magenta=0", bit 0 is extracted. like ,determination It is magenta. Since it is cyan, according to the encoding rule "magenta-cyan=1", bit 1 is extracted.
[0018] Compared with the prior art, the beneficial effects of the present invention are as follows: 1. Strong visual concealment: The dithered grid sampling method generates a point distribution with spectral characteristics similar to "blue noise". This distribution is the least likely to attract the visual attention of the human eye and avoids the moiré pattern caused by regular textures. Combined with Gaussian diffusion rendering, the watermark appears as a natural paper texture or film noise, with excellent concealment.
[0019] 2. High resistance to color cast and lighting variations: The core decision logic is based on the relative complementary relationship (differential signal) between cyan and magenta, rather than absolute color values. Even if the overall image experiences severe brightness changes (such as shooting in dim conditions) or color casts (such as when a printer runs out of ink), decoding will succeed as long as the relative channel difference polarity between cyan and magenta dots remains unchanged.
[0020] 3. Large encoding capacity and robustness: Compared to a single watermark covering the entire image, the dot matrix encoding method of this invention has a higher local information density. Combined with RS error correction codes, even if some watermark areas are unrecognizable due to cropping, smearing, or strong light reflection, the complete information can still be recovered through data redundancy, achieving a balance between high capacity and high robustness. Attached Figure Description
[0021] To more clearly illustrate the technical solution of the present invention, the drawings used in the embodiments are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0022] Figure 1 This is a flowchart illustrating the overall process of watermark generation in an embodiment of the present invention. Figure 2 This is a schematic diagram of the layered architecture for jitter mesh point generation, two-color complementary mapping, and Gaussian diffusion rendering in an embodiment of the present invention.
[0023] Figure 3 This is a schematic diagram of the coding point distribution in an embodiment of the present invention; Figure 4 This is a two-color complementary digital watermark image generated in an embodiment of the present invention; Figure 5 These are comparison images of Gaussian diffusion effects in embodiments of the present invention, wherein (a) is a magnified view of a local area without diffusion; and (b) is a magnified view of a local area after Gaussian diffusion rendering. Figure 6 This is a flowchart illustrating the overall process of the watermark decoding method according to an embodiment of the present invention. Detailed Implementation
[0024] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0025] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0026] Example 1 This invention provides a method for generating dual-color complementary digital watermarks based on dithering grids and dot diffusion, comprising: Convert the watermark string to be embedded into a binary bit stream; The number of coding points is dynamically calculated based on the length of the binary bit stream. The dithering grid algorithm is used to divide the target image into regular micro grids to generate coding points. Based on the values of the binary bit stream, the generated coded bits are paired in sequence and mapped to complementary color combinations of "cyan-magenta" or "magenta-cyan". A blank high-resolution canvas is constructed based on the target image, and subtractive color rendering is performed on the complementary color combination using a diffusion kernel on the blank high-resolution canvas. The rendered blank high-resolution canvas is downsampled to the target image size using a region averaging algorithm to generate the final watermark image.
[0027] like Figures 1-5 As shown, the specific implementation process of this embodiment is as follows: Step S1, watermark information encoding and enhancement, converts the watermark string to be embedded into a binary bit stream, specifically including: Set the watermark string to be embedded.
[0028] Character encoding: First, the watermark string to be embedded is converted into a standard byte stream in UTF-8 format to ensure support for multilingual character embedding.
[0029] RS error correction coding: To resist noise interference and geometric clipping during transmission, the Reed-Solomon forward error correction coding mechanism is introduced, using RS error correction coding to correct errors in the standard byte stream. The number of error correction symbols is set. This means that for each coded block, up to [number] can be mathematically corrected. An error occurs at any position of one byte. If the original data length is... If the total length of bytes after encoding is 100,000, then the total length of bytes after encoding is 100 This redundancy is key to ensuring robustness. RS error correction coding has a strong ability to correct burst errors. By adding redundant check symbols, the generated binary bit stream can be completely recovered even if there are continuous bit flips or large-area corruption and loss during transmission, thus greatly improving the fault tolerance of watermarks under harsh channels.
[0030] Bitstream generation: Converting error-corrected standard byte streams into binary bitstreams. Total number of bits .
[0031] Step S2: Dithered grid point generation. The number of coding points is dynamically calculated based on the length of the binary bitstream. A dithered grid algorithm is used to divide the target image into regular micro-grids to generate coding points, including: This invention employs two-point complementary coding, dynamically calculating the number of coding points based on the length of the binary bit stream. Because it uses two-point complementary coding (each bit is represented by a pair of complementary color dots, forming a difference pair), the number of coding points is... , The length of the binary bit stream; A dithering grid algorithm is used to divide the target image into regular micro-grids to generate coded points. This algorithm is controlled by a key seed (the initial value used to initialize a pseudo-random number generator. In a computer system, although the sequence generated by the pseudo-random number generator appears random, its numerical sequence is completely determined by the initial seed. Specifically, before executing the grid dithering algorithm, the user-input integer (i.e., the key seed, such as SEED=12345) is input into a random function library (such as Python's np.random.seed or C++'s standard random function library). This ensures that as long as the key seed and the image size are consistent, the generated random perturbation sequence and the final coded point coordinates (x, y) are completely deterministic and unique, regardless of when or where the algorithm is run. This eliminates the need for the decoding end to transmit a large coordinate file; only the key seed is needed to reconstruct completely consistent points), ensuring the determinism and security of the generation process. The points generated by this method exhibit "blue noise" characteristics in the frequency domain—that is, the energy is mainly concentrated in the high-frequency part, while the human eye is far less sensitive to high-frequency noise than to low-frequency noise. This distribution preserves the macroscopic uniformity of the grid, avoiding point accumulation, while introducing microscopic randomness, effectively disrupting the periodic structure and eliminating the risk of moiré patterns at its source. Specifically, it includes: Macro-grid generation: Calculating grid size based on the number of encoded points. and grid spacing The original target image is divided into The regular micro-grid ensures uniform spatial coverage of the watermark signal and avoids local information accumulation.
[0032] Center positioning: Traversing each grid cell of the micromesh Obtain the center coordinates ; Microscopic controlled perturbation: introducing random perturbation quantities This makes the point distribution approximate the effect of "Poisson disk sampling". x axis, y Random disturbance on the axis , All follow the interval The uniform distribution on the surface. In this embodiment, the jitter ratio coefficient... Set it to 0.7. If If the value is too small (e.g., 0.1), the points will be too close to the regular grid, easily producing low-frequency moiré patterns. If... If the value is too large (e.g., 1.5), the distance between the points will be too close or even overlap, leading to signal crosstalk. Select... A value of 0.7 is the optimal balance point verified by experiments, which makes the point distribution approximate the effect of "Poisson disk sampling", that is, while maintaining the minimum distance constraint, it has blue noise characteristics and obtains the best visual concealment effect.
[0033] Among them, random disturbance variables ( δ The value range of ) is determined by the grid spacing ( S The jitter coefficient is determined together with the jitter factor, and the calculation formula is as follows: Range = Among them, random disturbance quantity and These are values that are independently and randomly sampled within this range. (Jitter ratio coefficient) R (e.g., 0.7) defines the maximum deviation of a point from the grid center as 70% of the grid spacing.
[0034] Coordinate calculation: Based on the center coordinates and random perturbation, the final coordinates of the coded points are generated. .
[0035] Step S3: Two-color complementary mapping strategy. Based on the values of the binary bit stream, the generated coded bits are paired in sequence and mapped to complementary color combinations of "cyan-magenta" or "magenta-cyan", including: Based on the values (0 or 1) of the binary bit stream, differential coding is used to map the paired bits sequentially to complementary color combinations of "cyan-magenta" or "magenta-cyan". Cyan primarily absorbs red light, while magenta primarily absorbs green light, forming a stable complementary relationship in both the RGB additive and CMY subtractive color models. This color pair creates a visual contrast of warm and cool tones, but the difference in brightness is small, which is beneficial for concealment.
[0036] Define the physical representation of two complementary colors in the BGR color space and design them using the subtractive color mixing principle: Cyan: BGR value (255, 255, 0). In physical subtractive color mixing, cyan ink absorbs long-wavelength red light and reflects mid-wavelength green light and short-wavelength blue light. Corresponding to digital image data, this means the red channel value is suppressed, while the green channel value remains high.
[0037] Magenta: BGR value (255, 0, 255). In physical subtractive color mixing, magenta ink absorbs mid-wavelength green light and reflects red and blue light. Corresponding to digital image data, this means the green channel value is suppressed, while the red channel value remains high.
[0038] binary bit stream BEach of them b k Mapped to a pair of points ( P 2k , P 2k+1 (The value of the bitstream determines the color allocation order of paired dots, that is, the color mapping of dot pairs is controlled by the value of the binary bitstream.) Logic 0: Setting P 2k It is blue. P 2k+1 It is magenta; Logic 1: Setting P 2k It is magenta. P 2k+1 It is cyan.
[0039] Differential coding here means that the information carrier is not the absolute color value of a single point, but the relative difference (polarity) of the color channel values between two points.
[0040] The idea behind differential coding is that the system does not identify information by judging whether a point is "green enough" (absolute threshold), but rather by judging whether "point A is greener than point B" (relative difference). During decoding, the difference Δ is calculated. G = G ( P 2k )- G ( P 2k+1 ),in, G ( P 2k )for P 2k The green component, G ( P 2k+1 )for P 2k+1 The green component eliminates common-mode interference such as background lighting and paper color. As long as two points are in close proximity, the environmental influence on them is consistent. After subtraction, the interference is canceled out, and only the difference signal representing the data is retained.
[0041] This pairwise mapping ensures chromaticity balance within local areas, reducing the impact on the overall average tone of the image.
[0042] Step S4: Super-resolution Gaussian diffusion rendering. A blank high-resolution canvas is constructed based on the target image. Subtractive color rendering is then performed on the complementary color combination using a diffusion kernel on the blank high-resolution canvas, including: To simulate the physical diffusion of ink on paper fibers and avoid the artificial look of single pixels, super-resolution technology is used for rendering. Construct canvas: Construct a canvas with a size that is a preset multiple of the target image ( In this embodiment, the multiple is... A blank high-resolution canvas (pure white background, value 255) and a high magnification (recommended range 5x to 20x (10x in this example). The magnification needs to be high enough to ensure the Gaussian diffusion kernel has sufficient pixel precision to render smooth gradients, avoiding jagged edges or shape distortion at low resolutions. Higher magnification results in a more delicate simulated optical halo effect, but also increases computational overhead) ensure the fineness and geometric accuracy of the diffusion edges.
[0043] Generate a diffusion kernel: Use a two-dimensional Gaussian kernel function to generate a two-dimensional Gaussian kernel. As a diffusion nucleus, its standard deviation Set as This ensures that the energy is concentrated in the center and decays smoothly in all directions. KernelSize refers to the side length of the matrix used for Gaussian blur calculation on a high-resolution canvas (in pixels), which determines the size of the diffusion's "scope". Channel subtraction plotting: Cyan point rendering: Subtract the diffusion kernel value from the red channel on a blank high-resolution canvas. Reducing the red component reveals cyan, thus achieving cyan point rendering; R old G old Before rendering, the raw values of the current pixel in the red (R) and green (G) channels on the high-resolution canvas (usually initially 255, i.e., white).
[0044] R new G new The new value after rendering, after subtracting the Gaussian kernel value.
[0045] Magenta Dot Rendering: Subtract the diffusion kernel value from the green channel of a blank high-resolution canvas. Reducing the green component reveals magenta, achieving magenta dot rendering.
[0046] Blue channel: Remain unchanged or undergo only a slight uniform attenuation to serve as a unified cool-tonal base, further integrating high-frequency noise.
[0047] Parameter description: Diffusion intensity ( Strength The depth (transparency) of the control points and the size of the diffusion radius control points (in step S4, the stage of generating the diffusion nucleus) are also important. These two parameters need to be adjusted according to the characteristics of the carrier (such as the type of printing paper) to achieve the best balance between concealment and robustness.
[0048] This step simulates the natural diffusion process of ink droplets in paper fibers, so that the watermark dots are no longer rigid square digital pixels, but simulated signal dots with soft edges, dark in the middle and light around the edges, which greatly improves the visual naturalness and makes it look more like a natural paper texture rather than artificial noise.
[0049] Step S5: Anti-aliasing downsampling output The high-resolution canvas is downsampled back to the target image size (e.g., 128x128) using a region averaging algorithm. For each pixel (x, y) in the target image, the corresponding M×M sub-pixel blocks are found in the M-fold high-resolution canvas. The arithmetic mean of the RGB values of all pixels within this sub-pixel block is calculated, and this mean is used as the final color value of pixel (x, y) in the target image. This mathematical process is equivalent to the "integral effect" in optical imaging, effectively filtering out high-frequency jagged edges and achieving a smooth anti-aliasing effect. This step simulates the integration process of photons by a camera sensor. After downsampling, the Gaussian spread points are no longer discrete pixels, but smooth color blocks that blend perfectly with the surrounding background, making them extremely difficult for the human eye to perceive as artificially added noise, thus achieving extremely high visual concealment. This process not only achieves anti-aliasing but also further smooths the watermark signal, simulating the integral effect of the human eye or camera sensor, generating the final watermarked image. Finally, save a JSON file containing metadata (here, "metadata" refers to key parameters used to assist decoding and archiving, specifically including: version number, original watermark string, key seed (core synchronization parameter), target image size (core synchronization parameter), and RS error correction parameter (Nsym) (used to configure the decoder and point generation method)) and a point coordinate file (CSV) for archiving.
[0050] Example 2 Based on the same inventive concept, this invention also provides a dual-color complementary digital watermark decoding method based on dithering grid and dot diffusion, used to decode the watermark image generated by the production method described in the foregoing embodiments. The decoding method includes: Obtain the metadata of the watermark image to be detected during the generation stage, reconstruct the encoded points, and the metadata includes RS error correction parameters and the original image size; On the watermark image to be detected, the average color channel value of pixels within a preset radius is read, centered on the coordinates of the reconstructed encoded points. Calculate the numerical difference between paired coded points on a specific color channel, and extract the bit stream based on the numerical difference; The extracted bitstream is reassembled into a byte array and sent to the RS decoder for error correction to obtain the original watermark information.
[0051] like Figure 6 As shown, the specific implementation process of this embodiment is as follows: Step D1: Blind Detection Data Loading and Synchronization Read the watermark image to be detected. Load the metadata from the generation stage (including RS error correction parameters and original image size) (in practical applications (blind detection), the decoder usually cannot directly read the JSON file from the generator. Here, "loading" refers to: preset / protocol agreement: the sender and receiver pre-agree on the RS parameters and image size to be used. Extract auxiliary information: or the watermark contains a small piece of fixed header information to store these parameters (but in this embodiment, it is more likely to be described as reading known project configurations from storage media or databases)). In blind detection mode, the decoder does not need the original CSV file. It only needs to use the key seed and original image size shared by the dithering grid algorithm to repeatedly run step S2 in Example 1 to reconstruct the encoded points (the decoder program has the exact same "dithering grid algorithm" code as the generator. After the decoder reads the values Seed=12345 and Size=128, it calls the same function (such as generate_points_jittered_grid)). Due to the deterministic nature of the pseudo-random number algorithm (a computer algorithm that generates a sequence of numbers that appears statistically random but is actually entirely determined by a "seed"; therefore, the same code + the same seed = the same coordinate sequence; no need to transmit coordinate files over the network), the decoding end can accurately reconstruct the coordinates of the encoded points that are completely consistent with those of the generating end within milliseconds, achieving efficient synchronization without the need for the original image.
[0052] Step D2: Color sampling of anti-distortion region Iterate through all reconstructed encoded point coordinates. Considering that images often undergo minor non-linear geometric distortions, pixel misalignment, or moiré interference during printing-scanning or screen capture, directly reading single-point pixel values is highly prone to errors. Instead, read the average color value within a neighborhood centered at the coordinates with a radius of r (e.g., r = 1 or 2 pixels, corresponding to a 3x3 or 5x5 area). (After obtaining the reconstructed coordinates (x, y), the decoder reads the pixels near those coordinates in the current image to be detected and calculates the average value in real time.) The area averaging operation acts like a low-pass filter, effectively suppressing shooting noise (such as high-frequency salt-and-pepper noise) and improving the signal-to-noise ratio.
[0053] Step D3: Two-color differential logic decision For each pair of coded points Compare the numerical differences between the values in a specific color channel (e.g., the green channel) and extract the bitstream based on these differences: Principles of judgment: Cyan dot: It retains the reflection of green light, so the G component is high (close to 255).
[0054] Magenta dot: It absorbs green light, so the G component is low.
[0055] Differential logic: Calculate the difference ,in, for The green component, for The green component; like (Right now (Green component is large), judgment It is blue. The color is magenta. According to the encoding rule "cyan-magenta=0", bit 0 is extracted. like (Right now (Green component is large), judgment It is magenta. Since it is cyan, according to the encoding rule "magenta-cyan=1", bit 1 is extracted.
[0056] Common-mode rejection characteristics: Even if the image darkens due to insufficient lighting (significantly reducing the overall G value) or becomes yellowish due to a color temperature bias (overall color cast), as long as this change is global or low-frequency, The two points are affected by ambient light almost identically (i.e., common-mode interference). By subtracting them, the common-mode interference is canceled out, leaving only the differential-mode component of the watermark signal. This is the core reason why this invention can effectively resist analog-to-digital conversion attacks.
[0057] Step D4: RS Error Correction and Information Recovery All bits obtained from the judgment are concatenated into a binary string and converted into a byte array in groups of 8 bits. The RS decoder is then used to perform error correction on the data. RS codes are particularly adept at handling burst errors. For example, if a corner of an image is covered by dirt, obscured by reflections, or cropped, causing a series of consecutive bit errors, the RS algorithm can still calculate the lost information using the remaining intact data blocks, as long as the number of erroneous bytes does not exceed [a certain threshold]. Finally, verify whether the recovered watermark string matches the expectation, and output the decoding result.
[0058] Example 3 This embodiment verifies the impact of different parameters on watermark performance through experiments.
[0059] 1. Diffusion radius comparison experiment: With other parameters fixed, the diffusion radius was changed. The results are shown in Table 1: Table 1. Effect of different diffusion radii on watermark performance Conclusion: The optimal balance between visual quality and decoding performance is achieved when the diffusion radius is between 3.0 and 6.0 pixels.
[0060] 2. The results of the shake ratio comparison experiment are shown in Table 2: Table 2. Comparison of jitter ratios in experiments. Conclusion: A jitter ratio of 50%-80% can balance uniformity and safety.
[0061] The embodiments described above are merely preferred embodiments of the present invention and are not intended to limit the scope of the present invention. Various modifications and improvements made to the technical solutions of the present invention by those skilled in the art without departing from the spirit of the present invention should fall within the protection scope defined by the claims of the present invention.
Claims
1. A method for generating dual-color complementary digital watermarks based on dithering grids and dot diffusion, characterized in that, The generation method includes: Convert the watermark string to be embedded into a binary bit stream; The number of coding points is dynamically calculated based on the length of the binary bit stream. The dithering grid algorithm is used to divide the target image into regular micro grids to generate coding points. Based on the values of the binary bit stream, the generated coded bits are paired in sequence and mapped to complementary color combinations of "cyan-magenta" or "magenta-cyan". A blank high-resolution canvas is constructed based on the target image, and subtractive color rendering is performed on the complementary color combination using a diffusion kernel on the blank high-resolution canvas. The rendered blank high-resolution canvas is downsampled to the target image size using a region averaging algorithm to generate the final watermark image.
2. The generation method according to claim 1, characterized in that, Methods for converting the watermark string to be embedded into a binary bitstream include: Convert the watermark string to be embedded into a standard byte stream; Error correction is performed on standard byte streams based on RS error correction coding; Convert the error-corrected standard byte stream into a binary bit stream.
3. The generation method according to claim 1, characterized in that, The number of coding points is dynamically calculated based on the length of the binary bit stream. A dithering grid algorithm is used to divide the target image into regular micro-grids. Methods for generating coding points include: Two-point complementary coding is adopted, and the number of coding points is dynamically calculated based on the length of the binary bit stream; Based on the number of encoded points, the target image is divided into regular micro-grids; Traverse each cell of the microgrid to obtain the center coordinates; By introducing random perturbations, the point distribution is made to approximate the effect of "Poisson disk sampling"; Based on the center coordinates and random perturbation, coded points are generated.
4. The generation method according to claim 1, characterized in that, The methods for mapping the generated coded bits to complementary color combinations of "cyan-magenta" or "magenta-cyan" in sequence, based on the values of the binary bit stream, include: binary bit stream B Each of them b k Mapped to a pair of points ( P 2k , P 2k+1 ): Logic 0: Setting P 2k It is blue. P 2k+1 It is magenta; Logic 1: Setting P 2k It is magenta. P 2k+1 It is cyan.
5. The generation method according to claim 1, characterized in that, The method of constructing a blank high-resolution canvas based on the target image, and then using a diffusion kernel to perform subtractive color rendering on the blank high-resolution canvas includes: Construct a blank high-resolution canvas with a size that is a preset multiple of the target image; A two-dimensional Gaussian kernel function is used to generate the diffusion kernel; Subtract the value of the diffusion kernel from the red channel of a blank high-resolution canvas to achieve cyan point rendering; Magenta dot rendering is achieved by subtracting the diffusion kernel value from the green channel of a blank high-resolution canvas.
6. A method for decoding a dual-color complementary digital watermark based on dithering grid and dot diffusion, the decoding method being used to decode a watermark image generated by the production method according to any one of claims 1-5, characterized in that, The decoding method includes: Obtain the metadata of the watermark image to be detected during the generation stage, reconstruct the encoded points, and the metadata includes RS error correction parameters and the original image size; On the watermark image to be detected, the average color channel value of pixels within a preset radius is read, centered on the coordinates of the reconstructed encoded points. Calculate the numerical difference between paired coded points on a specific color channel, and extract the bit stream based on the numerical difference; The extracted bitstream is reassembled into a byte array and sent to the RS decoder for error correction to obtain the original watermark information.
7. The decoding method according to claim 6, characterized in that, Methods for reconstructing encoded bits include: Using the shared key seed and original image size of the dithering grid algorithm, the coded points are reconstructed by running the dithering grid algorithm.
8. The decoding method according to claim 6, characterized in that, Methods for calculating the numerical difference between paired coded bits on a specific color channel and extracting the bitstream based on this numerical difference include: For each pair of coded points Calculate the difference: ,in, for The green component, for The green component; like ,determination It is blue. The color is magenta. According to the encoding rule "cyan-magenta=0", bit 0 is extracted. like ,determination It is magenta. Since it is cyan, according to the encoding rule "magenta-cyan=1", bit 1 is extracted.