Coded watermark pattern generation, hiding and detection method and device and storage medium
By using a spatial spread spectrum coding watermark pattern generation method, the shortcomings of existing QR code anti-counterfeiting technologies are addressed, achieving a high level of anti-counterfeiting effect and data security, and making it suitable for secure data delivery and key management.
Patent Information
- Application Number
- CN202410568660.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-09
- Publication Date
- 2025-11-11
AI Technical Summary
Existing QR code anti-counterfeiting technologies suffer from problems such as reliance on server status, accuracy of scanning devices, time limitations, and long pattern recognition times, resulting in poor anti-counterfeiting effects or susceptibility to forgery.
A spatial spread spectrum-based coded watermark pattern generation method is adopted. Through Cartesian coordinate calibration, gray quantization, virtual graphic block splicing, and two-dimensional spreading code modulation, information hiding and detection are achieved. Combined with channel coding and inverse cosine transform, a coded watermark pattern with strong anti-interference capability is generated.
It improves data security and anti-counterfeiting performance, making it difficult to counterfeit and with low deployment costs, making it suitable for fields such as secure data delivery and key management.
Smart Images

Figure CN120931464A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing, and in particular to a method, apparatus and storage medium for generating, hiding and detecting coded watermark patterns. Background Technology
[0002] Currently, commonly used methods for preventing counterfeiting and copying of QR codes and other patterns mainly include the following four categories: The first type is cloud-based storage-based anti-counterfeiting methods. These methods use specific compilation tools to convert plaintext encoding into corresponding ciphertext encoding, and then store the interrelated plaintext and ciphertext encodings on an anti-counterfeiting verification server. This method relies on the server's operational status; if the server malfunctions or is attacked, the entire anti-counterfeiting system may fail, and there is also a risk of data leakage. The methods described in Chinese patent applications No. 2017109760437, entitled "An Interactive Anti-counterfeiting Method for Static Barcode / QR Code Recognition Technology"; No. 2022108001581, entitled "An Anti-counterfeiting Method and System for Payment QR Codes"; No. 2023118255377, entitled "An Intelligent Anti-counterfeiting Method for Computer QR Codes Based on Data Analysis"; and No. 2023116676672, entitled "Verification Method, Device, and Storage Medium for Anti-counterfeiting QR Codes," all belong to this type of cloud-based storage-based anti-counterfeiting method.
[0003] The second type is QR code anti-counterfeiting technology based on adding non-public coded content, anti-copying sub-codes, and other anti-counterfeiting information, and further using encryption algorithms to encrypt the anti-counterfeiting information to improve its security. The effectiveness of this anti-counterfeiting method largely depends on the accuracy and reliability of the scanning device. If the scanning device has performance or compatibility issues, the anti-counterfeiting code may not be correctly recognized. The methods described in Chinese patent application No. 2017109760437, entitled "An Anti-counterfeiting Method for Tamper-proof and Anti-copying QR Codes" and Chinese patent application No. 2022114681879, entitled "QR Code Anti-counterfeiting Method, QR Code Anti-counterfeiting Code Generation System," both belong to this type of anti-counterfeiting method that adds non-public coded anti-copying sub-codes.
[0004] The third type of anti-counterfeiting technology is based on setting the validity period of QR codes. For example, it uses timestamps combined with digital signature algorithms to set the validity period of QR codes. After the validity period expires, the time-limited QR code cannot be verified or used. This technology can only provide a certain level of security within a specific time range, which greatly limits its application scenarios. The method described in Chinese Patent Application No. 2023117036141, entitled "A QR Code Anti-counterfeiting Encryption Method and System Based on Random Numbers," adopts this timestamp digital signature anti-counterfeiting method.
[0005] The fourth type of method employs pattern recognition-based anti-counterfeiting schemes. This method uses sophisticated pattern patterns to prevent copying and employs pattern recognition technology to verify whether a document is a copy. The drawback of this method is its long recognition time. While it effectively prevents copying, the limited number of pattern patterns allows counterfeiters to bypass the copying process and directly forge identical QR codes through pattern arrangement, successfully deceiving the counterfeiters. Chinese patent application number 2019100988220, entitled "QR Code Generation Method, Verification Method, Server, and QR Code," falls into this category.
[0006] Given the shortcomings of the four existing technologies, it is necessary to improve the existing technologies and design a method, device and storage medium for generating, hiding and detecting coded watermark patterns based on spatial spread spectrum. This method can not only hide data, but also estimate transmission characteristics, and improve the anti-interference ability and data security of data. Summary of the Invention
[0007] This invention provides a method, apparatus, and storage medium for generating, hiding, and detecting coded watermark patterns. The technical solution is as follows: In a first aspect, the present invention provides a method for generating an coded watermark pattern, comprising the following steps: Select the original QR code as the original image and generate a rectangular area to be processed. Specifically, establish the top, bottom, left and right directions of the original image and adjust it to a standard size to further generate a rectangular area that can contain the entire original image. A Cartesian coordinate table is created and calibrated for the rectangular region. Specifically, the top left corner of the rectangular region is determined as the origin of the coordinate system, the leftward direction is determined as the X direction of the Cartesian coordinate system, and the downward direction is determined as the Y direction. A grid is then created to calibrate the original image. Acquire and record the grayscale values of the original image in the Cartesian coordinate system; Calculate the grayscale value of each grid in the Cartesian coordinate system, and quantize the original image into dark and light squares according to the grayscale value. Specifically, calculate the average grayscale of each grid, and quantize each grid into dark and light squares according to the grayscale value, where those closer to pure black are dark and those closer to pure white are light. Number the dark and light squares sequentially, specifically by numbering all the dark and light squares from left to right and from top to bottom, respectively. Adjacent dark and light squares are pieced together to form virtual graphic blocks. Specifically, several adjacent dark and light squares are assembled into rectangular or square virtual graphic blocks to generate coded watermark patterns.
[0008] Furthermore, the original QR code is a color image.
[0009] Secondly, the present invention provides a method for hiding an coded watermark pattern, comprising the following steps: The source data to be hidden is channel-coded to generate a coded sequence; An N*M two-dimensional spreading code is generated using virtual graphic blocks as the basic unit, where N and M are both positive integers greater than or equal to 1; A two-dimensional matrix signal is generated by modulating the channel coding sequence with a two-dimensional spreading code; Perform a two-dimensional inverse cosine transform on a two-dimensional matrix signal to generate an N*M two-dimensional spatial signal; The two-dimensional spatial signal is quantized and amplitude modulated to generate an N*M matrix. Information hiding is achieved by overlaying or removing dark and light virtual image blocks using matrix diagrams. Specifically, for dark or near-black virtual graphic blocks, a quantized N*M matrix diagram is overlaid on the original image block, and the grayscale value is limited to the range of 0~255 to achieve information hiding. For light or near-white virtual graphic blocks, a quantized N*M matrix diagram is subtracted from the original image block, and the grayscale value is limited to the range of 0~255 to achieve information hiding.
[0010] Furthermore, the channel coding employs any one of BCH code, Reed-Solomon code, convolutional code, low-density parity-check code, polar code, or Turbo code.
[0011] Furthermore, the two-dimensional inverse cosine transform can also employ the Hadamard inverse transform.
[0012] Thirdly, the present invention provides a method for demodulating and detecting coded watermark patterns, comprising the following steps: Establish a rectangular region and determine the pattern information, and establish a position coordinate system for the image signal. Specifically, adjust the pattern to be detected to a preset standard size, establish the original rectangular region containing the pattern, determine the type, name and synchronization position of the pattern based on the pattern data using pattern recognition, and establish a position coordinate system for the image signal. Calculate the grayscale value of each grid cell and quantize the original image into dark and light squares according to the grayscale value. Specifically, calculate the average grayscale value of each grid cell and quantize each grid cell into dark and light squares according to the grayscale value, where those closer to pure black are dark and those closer to pure white are light. Number the dark and light blocks sequentially, specifically: number all the dark blocks and light blocks from left to right and from top to bottom, respectively; Connect adjacent dark and light squares to form a virtual graphic block; Obtain the arrangement order information of dark and light blocks in the virtual graphic block; The two-dimensional spatial grayscale matrix signal of the virtual graphic block is obtained and a two-dimensional discrete cosine transform is performed. Specifically, for each virtual graphic block, its N*M two-dimensional spatial grayscale matrix signal is read and a two-dimensional discrete cosine transform is performed. Demodulation is performed based on the prior spreading code to obtain the transmission sequence number sequence; The received signal sequence is recovered according to the encoding order of the virtual graphic blocks at the encoding generation end; The hidden information sequence is recovered by channel decoding of the received signal sequence, and the authenticity verification is completed. If it can be decoded correctly and the decoding verification is satisfied, it is judged to be a real pattern; otherwise, it is judged to be a copy or a forgery.
[0013] Furthermore, the two-dimensional discrete cosine transform can also be replaced by the Hadamard transform.
[0014] Fourthly, the present invention provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the coded watermark pattern generation method as described in the first aspect.
[0015] Fifthly, the present invention provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the coded watermark pattern hiding method as described in any of the second aspects.
[0016] In a sixth aspect, the present invention provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the demodulation and detection method for the coded watermark pattern as described in any of the third aspects.
[0017] In a seventh aspect, the present invention provides an coded watermark graphic processing apparatus, comprising: One or more processors; Memory; and One or more computer programs, wherein the one or more computer programs are stored in the memory and configured to be executed by the one or more processors, wherein the processors, when executing the computer programs, implement the steps of the coded watermark pattern generation method as described in the first aspect.
[0018] Eighthly, the present invention provides an coded watermark graphic processing apparatus, comprising: One or more processors; Memory; and One or more computer programs, wherein the one or more computer programs are stored in the memory and configured to be executed by the one or more processors, wherein the processors, when executing the computer programs, implement the steps of the encoded watermark pattern hiding method as described in any of the second aspects.
[0019] Ninthly, the present invention provides an coded watermark graphic processing apparatus, comprising: One or more processors; Memory; and One or more computer programs, wherein the one or more computer programs are stored in the memory and configured to be executed by the one or more processors, wherein the processors, when executing the computer programs, implement the steps of the demodulation and detection method for the encoded watermark pattern as described in any of the third aspects.
[0020] The method, apparatus, and storage medium for generating, hiding, and detecting encoded watermark data of the present invention have a high level of anti-counterfeiting, are difficult to counterfeit, and have low deployment costs, which greatly improves data security and can be applied to data security delivery and key management in various scenarios. Attached Figure Description
[0021] Figure 1 Flowchart of the method for generating coded watermark patterns.
[0022] Figure 2 Flowchart of the method for hiding encoded watermark patterns.
[0023] Figure 3 Flowchart of the demodulation and detection method for hidden information in coded watermark patterns.
[0024] Figure 4 : A schematic diagram of the combination of QR code virtual graphic blocks according to the first embodiment of the present invention.
[0025] Figure 5 : A schematic diagram of the anchoring grid of the trademark pattern according to the second embodiment of the present invention.
[0026] Figure 6 : Schematic diagram of two-dimensional spatial spreading code generation and random mode.
[0027] Figure 7 : A schematic diagram of a signal modulated using spatial spreading code.
[0028] Figure 8 A comparative diagram of original QR codes of different sizes and anti-counterfeiting QR codes with added coded watermarks in the first embodiment.
[0029] Figure 9 : A comparative diagram of the original trademark and the anti-counterfeiting trademark with added coded watermark in the second embodiment.
[0030] Figure 10 : Schematic diagram of the coded watermark graphic processing device of the present invention. Detailed Implementation
[0031] To make the technical problems to be solved, the technical solutions, and the beneficial effects of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0032] Please refer to Figure 1 The flowchart of the coded watermark pattern generation method according to the first embodiment of the present invention is shown below. A QR code pattern is used as an example; trademark patterns can be processed in the same way. The coded watermark generation method includes the following steps: Step 101: Select the original QR code as the original image and generate a rectangular area to be processed. Specifically, select the original QR code pattern as the original image, establish the up, down, left, and right directions of the image, and adjust it to a certain standard size to further generate a rectangular area of appropriate size that can contain the entire QR code pattern. Step 102: Create and calibrate a Cartesian coordinate table for the rectangular area. Specifically, determine the top left corner of the rectangular area as the origin of the coordinate system, define the leftward direction as the X direction of the Cartesian coordinate system, and the downward direction as the Y direction. Use this to create a grid to calibrate the pattern. Step 103: Obtain and record the grayscale of the original image in the Cartesian coordinate system; Step 104: Calculate the gray value of each grid and quantize the original image into dark and light squares according to the gray value. Specifically, calculate the average gray value of each grid and quantize each grid into dark and light squares according to the gray value, where those closer to pure black are dark and those closer to pure white are light. Step 105: Number the dark and light squares sequentially, specifically: number all the dark and light squares from left to right and from top to bottom respectively; Step 106: Combine adjacent dark and light squares to form virtual graphic blocks. Specifically, combine several small dark and light squares with adjacent numbers to form larger virtual graphic blocks that are rectangles or squares. These larger virtual graphic blocks are the main body of the hidden data information.
[0033] Please refer to Figure 2 Flowchart of a method for hiding encoded watermark patterns, the method comprising the following steps: Step 201: Channel coding is performed on the source data to be hidden to generate a coding sequence. The channel coding adopts a typical channel coding method, such as any one of BCH code, Reed-Solomon code or convolutional code. In particular, any one of low-density parity-check coding, polar code or Turbo code can be used. These coding methods have near Shannon limit error correction capabilities, thus reducing the signal transmission power requirements. By selecting a coding method that matches the corresponding error correction capability, the signal can be reliably transmitted in a noisy channel with extremely low power. Step 202: Generate an N*M two-dimensional spreading code using virtual graphic blocks as the basic unit, where N and M are both positive integers greater than or equal to 1, and the spreading ratio and spreading sequence are determined according to different pattern sizes and anti-counterfeiting strength requirements; Step 203: Modulate the channel coding sequence with a two-dimensional spreading code to generate a two-dimensional matrix signal; Step 204: Perform a two-dimensional inverse cosine transform on the two-dimensional matrix signal to generate an N*M two-dimensional spatial signal. The two-dimensional inverse cosine transform can also be replaced by the inverse Hadamard transform. Step 205: Quantize the two-dimensional spatial signal and perform amplitude modulation to generate an N*M matrix diagram; Step 206: Use matrix diagrams to overlay or eliminate dark and light virtual image blocks respectively to complete information hiding. Specifically: for dark or near-black virtual graphic blocks, overlay the quantized N*M matrix diagram onto the original graphic block and limit the grayscale value to the range of 0~255 to complete information hiding; for light or near-white virtual graphic blocks, subtract the quantized N*M matrix diagram from the original graphic block and limit the grayscale value to the range of 0~255 to complete information hiding.
[0034] Further reference Figure 3 The flowchart of the demodulation and detection method for hidden information in the encoded watermark pattern of the present invention includes the following steps: Step 301: Establish a rectangular region and determine the pattern information, and establish the position coordinate system of the image signal. Specifically, adjust the pattern to be detected to a preset standard size, establish the original rectangular region containing the pattern, determine the type, name and synchronization position of the pattern based on the pattern data using pattern recognition or similar methods, and establish the position coordinate system of the image signal. Step 302: Calculate the gray value of each grid and quantize the original image into dark and light squares according to the gray value. Specifically, calculate the average gray value of each grid and quantize each grid into dark and light squares according to the gray value, where those closer to pure black are dark and those closer to pure white are light. Step 303: Number the dark and light blocks sequentially, specifically: number all the dark and light blocks from left to right and from top to bottom respectively; Step 304: Connect adjacent dark and light squares to form a virtual graphic block; Step 305: Obtain the arrangement order information of dark and light blocks in the virtual graphic block; Step 306: Obtain the two-dimensional spatial grayscale matrix signal of the virtual graphic block and perform a two-dimensional discrete cosine transform. Specifically, read the N*M two-dimensional spatial grayscale matrix signal of each virtual graphic block and perform a two-dimensional discrete cosine transform. The two-dimensional discrete cosine transform can also be replaced by the Hadamard transform. Step 307: Demodulate based on the prior spreading code to obtain the transmission sequence number sequence; Step 308: Recover the received signal sequence according to the encoding order of the virtual graphic blocks at the encoding generation end; Step 309: Decode the received signal sequence to recover the hidden information sequence and complete the authenticity verification. If it can be decoded correctly and the decoding verification is satisfied, it is judged to be a real pattern; otherwise, it is judged to be a copied or forged pattern.
[0035] In particular, in the technical solution of this invention, if the channel noise exceeds the design requirements, the information transmission rate will exceed the channel capacity, the decoder will not be able to decode correctly, and the decoding output bit error rate will increase sharply. This invention uses the channel coding characteristic to construct a coded watermark, which can not only hide the data, but also estimate the transmission characteristics, that is, whether it has been copied or photographed. After spread spectrum modulation, the hidden data is diluted, which improves the anti-interference ability. The detection difficulty for the detector without prior knowledge of the hidden data increases, thus improving the anti-counterfeiting performance.
[0036] When the error correction code length reaches tens, hundreds, or even thousands of symbols, the channel coding and parity check matrix dimensions will be very high. At the same time, the two-dimensional spatial spreading code can be randomly selected, and different spreading codes can be used in different virtual graphic blocks, thus making the coded watermark difficult or even impossible to forge.
[0037] Legitimate manufacturers print this anti-counterfeiting QR code on the product label. Customers scan this QR code with their mobile phones. The dedicated application on their phones performs perspective correction, despreads and error correction decoding of the image data, completes the watermark detection, and authenticates the digital signature. The channel noise of a legitimate and authentic QR code is within the error correction capability range of the error correction code, so it can be correctly decoded and authenticated as an original through signature verification.
[0038] If the original QR code is copied or scanned and printed, the copying and scanning process will inevitably introduce noise into the pattern. Since the selected channel coding is operating near the limit of error correction capability, after the customer scans the QR code, the pattern will not be able to be correctly demodulated and decoded by the detection algorithm, and therefore will not pass the data verification and signature authentication, and will be judged as a copy or counterfeit.
[0039] A dedicated application on the customer's mobile phone can complete image acquisition and transmit the acquisition results to the server, where the server will decode and detect the signal. Alternatively, the dedicated application on the user's mobile phone can also complete both image acquisition and signal decoding and detection. The specific task allocation between the mobile phone and the server can be determined by comprehensively considering factors such as the manufacturer's security requirements for isolation delivery, key management and data storage, as well as deployment costs.
[0040] refer to Figure 4 The schematic diagram of the QR code virtual graphic block combination in the first embodiment of the present invention, for ordinary QR codes, first excludes the part used for graphic positioning and spatial synchronization, and then arranges the remaining black and white small squares. The white small squares are first numbered W1, W2, W3... in order from left to right and from top to bottom. The black small squares are arranged in the same way to obtain the numbering of each small square as B1, B2, B3..., and then the four white small squares W1, W2, W3 and W4 with adjacent numbers are combined to form a larger white virtual graphic block; similarly, the four black small squares B1, B2, B3 and B4 with adjacent numbers are combined to form a larger black virtual graphic block. Each white virtual graphic block or black virtual graphic block can be used to hide one or more coded codeword symbols.
[0041] This invention stitches together several black or white squares of a regular QR code into a larger virtual graphic block of the same color, and selects an N*M spatial spreading code for this block. The manufacturer data source information (which may include the manufacturer's digital signature) to be used for watermark generation is processed by error correction encoding. Single or multiple bits of the error correction codeword are taken and spatial spreading is performed using spatial spreading code to generate the watermark signal after spatial spreading, thus completing the signal hiding.
[0042] Preferably, although the first embodiment of the present invention is described with a black and white ordinary QR code, the technical solution of the present invention is not limited to this. It is also applicable to color QR codes or other color images. It is only necessary to replace the binary quantization of "dark color" and "light color" in the technical solution with multi-value quantization such as "1 color", "2 color"... "S color", where S is an integer greater than or equal to 2. The applicant will not elaborate further here.
[0043] refer to Figure 5The second embodiment of the present invention illustrates the anchoring grid diagram of the trademark pattern. Using the same grayscale processing and arrangement method, the trademark pattern is positioned from left to right and top to bottom, with an anchored rectangular area defined within the graphic region. A grid is then drawn, and the average grayscale within each grid is calculated. Based on the grayscale of each grid, each grid is quantized into dark and light grids using a single-bit uniform quantizer. Then, these dark and light grids are processed... Figure 4 The same method is used to arrange the virtual graphic blocks sequentially and assemble them.
[0044] refer to Figure 6 A schematic diagram of two-dimensional spatial spreading code generation and random modes is shown. A virtual graphic block is divided into an N*M matrix. In this invention, N and M are both 6. First, the upper triangular part excluding diagonal elements is numbered sequentially from left to right and from top to bottom. Approximately 50% of the positions are randomly and evenly selected and their values are set to "+1", while the values of the other approximately 50% are set to "-1". For the (i, j)th element position (i>j) of the upper triangular part of the matrix, if the position is "+1", then the value of the corresponding (j, i)th element in the lower triangular part is set to "-1"; if the position is "-1", then the value of the corresponding (j, i)th element in the lower triangular part is set to "+1". The diagonal elements are left empty and can be filled with 0. The figure shows two random modes: random mode 1 and random mode 2. Both random mode 1 and random mode 2 can be used as two-dimensional spatial spreading codes to modulate signals.
[0045] Further reference Figure 7 A schematic diagram of signal modulation using spatial spreading code is shown. The spatial spreading code is multiplied by the signal to be modulated, and then the modulated signal is transformed into a two-dimensional spatial domain by performing a two-dimensional inverse discrete cosine transform or an inverse Hadamard transform. The transformed matrix is then quantized and amplitude modulated to obtain the modulated signal. The modulated signal is directly superimposed on the black virtual block, or the sign is taken and then superimposed on the white virtual block to complete the embedding of information and signal hiding. If the signal has been processed by printing, photographing, or other processes, channel noise will inevitably be introduced, resulting in signal distortion at the receiving end. The received signal after channel distortion is transformed into the frequency domain by a two-dimensional cosine transform to complete frequency domain detection. The received log-likelihood ratio of the frequency domain detection output signal is estimated, and then the log-likelihood ratio of each symbol is sent to the channel decoder to complete channel decoding.
[0046] refer to Figure 8The first embodiment is a comparison diagram of original QR codes and anti-counterfeiting QR codes with added coded watermarks of different sizes. The small size has a side length of 1 cm, the medium size has a side length of 2 cm, and the large size has a side length of 3 cm. Each of the three sizes of anti-counterfeiting QR codes with added coded watermarks embeds the string "my coding watermark". Due to the use of channel coding, the signal detector can work reliably under extremely low signal-to-noise ratio, and information can be hidden using a very light digital watermark. Even with careful observation, it is difficult to detect the difference between the original QR code and the anti-counterfeiting QR code with the naked eye.
[0047] The coded watermark generated using the technical solution of this invention and the data hidden therein are printed using a 600DPI printer, and then copied using 600DPI and 1200DPI copiers respectively. Further, images are scanned and acquired using a mobile phone with a 12-megapixel dual camera and a 40-megapixel ultra-sensitive lens, alternating between the two. The coded watermark detection method provided by this invention is used to detect the acquired images. Each size undergoes 100 tests, and each time the original anti-counterfeiting code and the copy are correctly identified. The hidden information sequence in the original anti-counterfeiting document is correctly detected and output, along with the hidden information sequence "mycoding watermark".
[0048] refer to Figure 9 The second embodiment of this invention presents a comparative diagram of the original trademark and the anti-counterfeiting trademark with added coded watermark. The watermarked trademark in the diagram hides the string "my watermarked trademark". Due to the use of channel coding, the signal detector can reliably operate at extremely low signal-to-noise ratios. Information can be hidden using a very shallow digital watermark. Even with careful observation, it is difficult to distinguish between the original trademark and the anti-counterfeiting trademark with the naked eye. Using the coded watermark and hidden data provided by this invention, the image was printed using a 600 DPI printer, then copied using 600 DPI and 1200 DPI copiers respectively. Furthermore, images were scanned and collected using a 12-megapixel dual-camera and a 40-megapixel ultra-sensitive lens mobile phone, alternating between the two. The coded watermark detection method provided by this invention was used to detect the collected images. After 100 tests, the original anti-counterfeiting code and the copy were correctly identified each time, and the hidden information sequence "my watermarked trademark" in the original anti-counterfeiting copy was correctly detected and output.
[0049] refer to Figure 10A schematic diagram of the coded watermarking graphic processing device of the present invention is shown. The coded watermarking graphic processing device 10 of the present invention further includes one or more memories 20 and one or more processors 30, wherein the one or more computer programs are stored in the memories 20 and configured to be executed by the one or more processors 30. When the processors 30 execute the computer programs, they implement the steps of the coded watermarking data generation, hiding and detection methods.
[0050] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by a program instructing related hardware. The program can be stored in a computer-readable storage medium, which may include: read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.
[0051] The method, apparatus, and storage medium for generating, hiding, and detecting encoded watermark data of the present invention have a high level of anti-counterfeiting, are difficult to counterfeit, and have low deployment costs, which greatly improves data security and can be applied to data security delivery and key management in various scenarios.
[0052] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A method for generating an coded watermark pattern, characterized in that, Includes the following steps: Select the original QR code as the original image and generate a rectangular area to be processed. Specifically, establish the top, bottom, left and right directions of the original image and adjust it to a standard size to further generate a rectangular area that can contain the entire original image. A Cartesian coordinate table is created and calibrated for the rectangular region. Specifically, the top left corner of the rectangular region is determined as the origin of the coordinate system, the leftward direction is determined as the X direction of the Cartesian coordinate system, and the downward direction is determined as the Y direction. A grid is then created to calibrate the original image. Acquire and record the grayscale values of the original image in the Cartesian coordinate system; Calculate the grayscale value of each grid in the Cartesian coordinate system, and quantize the original image into dark and light squares according to the grayscale value. Specifically, calculate the average grayscale of each grid, and quantize each grid into dark and light squares according to the grayscale value, where those closer to pure black are dark and those closer to pure white are light. Number the dark and light squares sequentially, specifically by numbering all the dark and light squares from left to right and from top to bottom, respectively. Adjacent dark and light squares are pieced together to form virtual graphic blocks. Specifically, several adjacent dark and light squares are assembled into rectangular or square virtual graphic blocks to generate coded watermark patterns.
2. The method for generating an coded watermark pattern as described in claim 1, characterized in that, The original QR code is a color image.
3. A method for hiding an coded watermark pattern, characterized in that, Includes the following steps: The source data to be hidden is channel-coded to generate a coded sequence; An N*M two-dimensional spreading code is generated using virtual graphic blocks as the basic unit, where N and M are both positive integers greater than or equal to 1; A two-dimensional matrix signal is generated by modulating the channel coding sequence with a two-dimensional spreading code; Perform a two-dimensional inverse cosine transform on a two-dimensional matrix signal to generate an N*M two-dimensional spatial signal; The two-dimensional spatial signal is quantized and amplitude modulated to generate an N*M matrix. Information hiding is achieved by overlaying or removing dark and light virtual image blocks using matrix diagrams. Specifically, for dark or near-black virtual graphic blocks, a quantized N*M matrix diagram is overlaid on the original image block, and the grayscale value is limited to the range of 0~255 to achieve information hiding. For light or near-white virtual graphic blocks, a quantized N*M matrix diagram is subtracted from the original image block, and the grayscale value is limited to the range of 0~255 to achieve information hiding.
4. The method for hiding coded watermark patterns as described in claim 3, characterized in that, The channel coding employs any one of the following: BCH code, Reed-Solomon code, convolutional code, low-density parity-check code, polar code, or Turbo code.
5. The method for hiding coded watermark patterns as described in claim 3, characterized in that, The two-dimensional inverse cosine transform can also be expressed as the inverse Hadamard transform.
6. A method for demodulating and detecting an coded watermark pattern, characterized in that, Includes the following steps: Establish a rectangular region and determine the pattern information, and establish a position coordinate system for the image signal. Specifically, adjust the pattern to be detected to a preset standard size, establish the original rectangular region containing the pattern, determine the type, name and synchronization position of the pattern based on the pattern data using pattern recognition, and establish a position coordinate system for the image signal. Calculate the grayscale value of each grid cell and quantize the original image into dark and light squares according to the grayscale value. Specifically, calculate the average grayscale value of each grid cell and quantize each grid cell into dark and light squares according to the grayscale value, where those closer to pure black are dark and those closer to pure white are light. Number the dark and light blocks sequentially, specifically: number all the dark blocks and light blocks from left to right and from top to bottom, respectively; Connect adjacent dark and light squares to form a virtual graphic block; Obtain the arrangement order information of dark and light blocks in the virtual graphic block; The two-dimensional spatial grayscale matrix signal of the virtual graphic block is obtained and a two-dimensional discrete cosine transform is performed. Specifically, for each virtual graphic block, its N*M two-dimensional spatial grayscale matrix signal is read and a two-dimensional discrete cosine transform is performed. Demodulation is performed based on the prior spreading code to obtain the transmission sequence number sequence; The received signal sequence is recovered according to the encoding order of the virtual graphic blocks at the encoding generation end; The hidden information sequence is recovered by channel decoding of the received signal sequence, and the authenticity verification is completed. If it can be decoded correctly and the decoding verification is satisfied, it is judged to be a real pattern. Otherwise, the design will be deemed a copy or forgery.
7. The demodulation and detection method for coded watermark patterns as described in claim 6, characterized in that, The two-dimensional discrete cosine transform can also be replaced by the Hadamard transform.
8. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the steps of the coded watermark pattern generation method as described in any one of claims 1 to 2.
9. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the steps of the coded watermark pattern hiding method as described in any one of claims 3 to 5.
10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the steps of the demodulation and detection method for the encoded watermark pattern as described in any one of claims 6 to 7.
11. A coded watermark graphic processing device, comprising: One or more processors; Memory; as well as One or more computer programs, wherein the one or more computer programs are stored in the memory and configured to be executed by the one or more processors, characterized in that, when the processor executes the computer program, it implements the steps of the coded watermark pattern generation method as described in any one of claims 1 to 2.
12. A coded watermark graphic processing device, comprising: One or more processors; Memory; as well as One or more computer programs, wherein the one or more computer programs are stored in the memory and configured to be executed by the one or more processors, characterized in that, when the processor executes the computer program, it implements the steps of the coded watermark pattern hiding method as described in any one of claims 3 to 5.
13. A coded watermark graphic processing device, comprising: One or more processors; Memory; as well as One or more computer programs, wherein the one or more computer programs are stored in the memory and configured to be executed by the one or more processors, characterized in that, when the processor executes the computer program, it implements the steps of the demodulation and detection method for the encoded watermark pattern as described in any one of claims 6 to 7.