A QR code anti-counterfeiting method based on digital watermarking and vector quantization

By embedding digital watermarks and vector quantization compression encoding into QR codes, combined with chaotic encryption and geometric scrambling, a multi-layered anti-counterfeiting system is constructed, which solves the shortcomings of QR code anti-counterfeiting systems in terms of information security and content integrity verification, and achieves highly secure and reliable anti-counterfeiting authentication.

CN122492423APending Publication Date: 2026-07-31DALIAN MARITIME UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
DALIAN MARITIME UNIVERSITY
Filing Date
2026-04-28
Publication Date
2026-07-31

AI Technical Summary

Technical Problem

Existing QR code anti-counterfeiting technologies have shortcomings in terms of information security and content integrity verification. They are particularly vulnerable to tampering in high-security scenarios and it is difficult to achieve content non-replaceability and source verifiability.

Method used

By employing digital watermarking and vector quantization compression coding technologies, and embedding invisible identification information into image data, combined with chaotic encryption and geometric scrambling, a multi-layered anti-counterfeiting system is constructed to achieve high-quality information transmission and content-level authentication.

Benefits of technology

It significantly improves the security and reliability of QR code anti-counterfeiting systems, effectively preventing tampering through content-level authentication processes after images are copied, thus ensuring the authenticity and integrity of information.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122492423A_ABST
    Figure CN122492423A_ABST
Patent Text Reader

Abstract

This invention discloses a QR code anti-counterfeiting method based on digital watermarking and vector quantization. The method first uses an image as the anti-counterfeiting carrier, embedding a watermark containing anti-counterfeiting information into the image using stable transform domain digital watermarking embedding technology, resulting in a watermarked anti-counterfeiting image. Subsequently, the anti-counterfeiting image is vector-quantized and compressed, and the encoded index information is encapsulated to generate a QR code, achieving efficient storage and transmission of the anti-counterfeiting information. In the verification stage, the embedded digital watermark is extracted and anti-counterfeiting authentication is completed by decoding the QR code and reconstructing the image. This invention constructs a new anti-counterfeiting paradigm dominated by content features, enabling anti-counterfeiting verification to no longer rely on the surface information of the QR code, but rather on the consistency of mathematical features within the image for discrimination. This significantly improves the system's resistance to copying, tampering, and reconstruction attacks, providing a novel technical path for the engineering application of digital watermarking in QR code anti-counterfeiting and related high-security authentication scenarios.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of information security and image processing, and in particular to a QR code anti-counterfeiting method based on digital watermarking and vector quantization compression encoding of images. Background Technology

[0002] The evolution of anti-counterfeiting technology shows a trend of transitioning from physical entities to digital logic. Traditional anti-counterfeiting technologies mainly rely on physical anti-counterfeiting methods. Their core idea is to create difficult-to-imitate physical features through material properties or special manufacturing processes, such as laser holographic patterns, microstructure textures, special inks, and optically variable features. These technologies played a crucial role in early anti-counterfeiting systems, offering advantages such as strong intuitiveness and the ability to verify without complex calculations. However, with continuous advancements in manufacturing processes and counterfeiting techniques, some physical anti-counterfeiting features have gradually lost their original technological barriers. Once the core processes are reverse-engineered, their anti-counterfeiting capabilities rapidly decline. Furthermore, physical anti-counterfeiting features typically exist in a static form, making it difficult to carry dynamically changing information content and to achieve real-time interaction and remote verification with modern information systems.

[0003] To overcome the shortcomings of physical anti-counterfeiting in terms of information carrying capacity and system linkage, digital anti-counterfeiting technology has emerged and quickly gained dominance. Digital anti-counterfeiting embeds anti-counterfeiting information into images, code formats, or data structures through encoding, encryption, or digital identification, thereby achieving rapid information transmission and automatic identification. Among these, two-dimensional barcodes are widely used in anti-counterfeiting labeling and information traceability scenarios due to their simple structure, relatively large information capacity, and widespread availability of reading devices. However, two-dimensional barcodes are essentially a copyable digital carrier; their anti-counterfeiting capability mainly relies on the encoded content itself. Once the encoded information is obtained, attackers have the opportunity to regenerate the barcode to copy or forge it, thus posing a threat to system security.

[0004] To enhance the security of QR code anti-counterfeiting systems, some research has introduced cryptographic methods to encrypt and protect the data content carried by the QR code. While these methods improve data confidentiality to some extent, their security is highly dependent on the encryption algorithm and key management mechanism. If the key is leaked or the algorithm is cracked, the entire anti-counterfeiting system risks failure. Furthermore, simply relying on encryption mechanisms cannot fundamentally guarantee the authenticity and integrity of the information content. It cannot effectively prevent legitimate data from being tampered with, re-encrypted, and used to generate new QR codes, thus failing to meet the dual requirements of non-replaceable content and verifiable source in high-security anti-counterfeiting scenarios.

[0005] To further enhance the information density of QR codes to accommodate high-definition images such as faces, vector quantization compression coding technology has been introduced. This technology compresses complex image data into an extremely short bitstream and encapsulates it within the QR code by constructing a codebook index. This combination of "vector quantization compression + QR code encoding" theoretically solves the problem of portable image data transmission, representing a significant step forward in anti-counterfeiting evolution. However, as a plaintext standard, QR codes inherently have limited anti-counterfeiting properties. Existing composite anti-counterfeiting schemes mostly focus on whether the code can be correctly decoded, lacking multiple joint and effective criteria for determining whether the information itself has been tampered with. This anti-counterfeiting mode, lacking an embedded integrity verification mechanism, poses certain risks in high-security scenarios. Summary of the Invention

[0006] To address the aforementioned problems, this invention proposes a QR code anti-counterfeiting method based on digital watermarking and vector quantization compression encoding of images. By embedding invisible identification information into image data, verification can be performed on the image after compression and encoding. This invention combines digital watermarking, primarily used for electronic information protection, and QR code transmission, which focuses on data capacity, with anti-counterfeiting technology. It achieves high-quality information transmission and a dual strong anti-counterfeiting mechanism of digital and physical methods within a unified system, providing an efficient and feasible new path for image information anti-counterfeiting and representing a qualitative leap in the field of anti-counterfeiting. This invention discloses a QR code anti-counterfeiting method based on digital watermarking and vector quantization, specifically including the following steps:

[0007] A. Digital watermark embedding; B. Image compression encoding and QR code generation and decoding; C. Digital watermark extraction and verification.

[0008] Furthermore, the digital watermark embedding method described in step A includes the following steps: A1. Obtain and preprocess watermark information The watermark information is acquired and preprocessed. A binarized identification image for anti-counterfeiting authentication is acquired, and the size of the watermark image is normalized so that its size is consistent with the size of the watermark matrix required by the watermark embedding algorithm. A2. Encryption processing of watermark information The watermark information encryption process involves generating a chaotic sequence with the same size as the watermark image using a chaotic mapping based on preset chaotic key parameters, and binarizing the chaotic sequence to form a chaotic mask matrix. The watermark image and the chaotic mask matrix are then XORed bit by bit. An Arnold scrambling operation is performed on the chaotically encrypted watermark image, and the positions of the watermark pixels are geometrically scrambled according to preset scrambling parameters and iteration counts to obtain the watermark matrix to be embedded. A3. Standardize the carrier image. The carrier image is standardized, and the image used for anti-counterfeiting is subjected to grayscale processing, size normalization processing, and noise suppression processing. A4. Frequency Domain Feature Decomposition of Carrier Images Frequency domain feature decomposition of the carrier image involves performing discrete wavelet transform on the preprocessed carrier image to decompose it into low-frequency approximate sub-bands and high-frequency detail sub-bands. The low-frequency approximate sub-band is selected as the watermark embedding region and processed into blocks according to the set block size. Discrete cosine transform is performed on each image block to extract the DC component of each image block and construct the DC coefficient matrix. A5. Watermarking Embedding Process Based on Singular Value Decomposition Watermark embedding processing based on singular value decomposition: Singular value decomposition is performed on the DC coefficient matrix to obtain a singular value matrix. The watermark matrix obtained in step A2 is loaded into the singular value matrix according to a preset embedding strength factor. The singular values ​​are modulated to obtain a new singular value matrix containing watermark features. A6. Reconstruct the frequency domain features of the watermark and generate the watermark image. The frequency domain features of the watermark are reconstructed and a watermark image is generated. The DC coefficient matrix is ​​reconstructed using the original orthogonal matrix and the new singular value matrix. Then, the inverse discrete cosine transform and the inverse discrete wavelet transform are performed in sequence to generate a carrier image with embedded anti-counterfeiting watermark. At the same time, the orthogonal matrix, embedding strength parameters, chaotic key and scrambling parameters used in the watermark embedding process are stored as verification auxiliary information.

[0009] Furthermore, the image compression encoding and QR code generation and decoding method described in step B includes the following steps: B1. Image segmentation and vector quantization coding The watermarked image processed in step A is divided into multiple non-overlapping image sub-blocks according to a preset block size. Each image sub-block is then unfolded into a one-dimensional vector, with its dimension matching that of the codewords in the vector quantization codebook. Based on the trained vector quantization codebook, the distance between each image block vector and all codewords in the codebook is calculated, and the codeword with the smallest distance is selected as the representation of the current image block, thereby generating the corresponding codeword index sequence.

[0010] B2. Bitstreaming of Index Sequences Based on the size of the vector quantization codebook, a fixed length of binary encoding bits is allocated to each codeword index, and all codeword indices are converted into a continuous binary bit stream according to the arrangement order of the image blocks to form a data sequence that can be used for subsequent QR code mapping.

[0011] B3. QR code image construction A QR code encoding algorithm is used to map the encrypted bitstream onto the QR code module structure, generating a QR code image composed of black and white units. The version number and error correction level of the QR code are set according to the encoding capacity and recognition stability requirements to ensure the reliability of the QR code during the recognition process.

[0012] B4. QR code image recognition The QR code is decoded using a QR code recognition algorithm to extract the QR code information contained therein.

[0013] B5. Image Reconstruction and Authenticity Determination Based on the bit width of the codeword index in the vector quantization codebook, the decrypted bitstream is restored to an index sequence. Combining this with a pre-stored vector quantization codebook, the indexes are mapped to corresponding codeword vectors using a lookup table, and the image data is reconstructed according to the image block order. The reconstructed image is then compared with the authorized templates stored in the system database to verify the authenticity of the anti-counterfeiting mask and its corresponding information.

[0014] Furthermore, the method for digital watermark extraction and verification in step C includes the following steps: C1. Frequency domain feature decomposition of the image to be verified The image to be verified is subjected to discrete wavelet transform in step B, which decomposes it into low-frequency approximate sub-band and high-frequency detail sub-band. The low-frequency approximate sub-band is selected as the watermark extraction region and is processed into blocks according to the block division rules of the embedding stage. Discrete cosine transform is performed on each image block to extract the DC component of each image block and construct the DC coefficient matrix of the image to be verified.

[0015] C2. Watermark Reverse Extraction Based on Singular Value Decomposition Singular value decomposition is performed on the DC coefficient matrix constructed in step C1 to obtain the corresponding singular value matrix. Using the watermark embedding auxiliary information stored in step A5, inverse modulation operation is performed on the singular value matrix to separate the watermark signal superimposed on the singular values, thereby obtaining a watermark matrix in an encrypted and scrambled state.

[0016] C3. Decryption of watermark information The Arnold inverse scrambling operation is performed on the watermark matrix extracted in step C2. Based on the scrambling parameters and iteration count set during the embedding stage, the positions of the watermark pixels are reversed geometrically. Using the chaotic key parameters saved in step A5, a chaotic mask matrix for decryption is generated using the same chaotic mapping method as the embedding end. The obtained encrypted watermark matrix and the chaotic mask matrix are then XORed bit-by-bit to decrypt the chaotic encryption and recover the logical data of the watermark information.

[0017] C4. Watermark Binarization and Reconstruction The watermark data decrypted in step C3 is subjected to thresholding to convert it into a binary watermark image. This eliminates amplitude disturbances introduced by compression noise, quantization errors, or optical distortion during the extraction process, resulting in the final extracted watermark image.

[0018] C5. Watermark Similarity Calculation and Anti-counterfeiting Verification The extracted watermark image obtained in step C4 is compared with the pre-stored original watermark template in the system to calculate the correlation index between the two. When the correlation index is greater than or equal to a preset threshold, the image to be verified is determined to be a genuine anti-counterfeiting image; when the correlation index is lower than the threshold, it is determined to be a counterfeit or tampered image, thus completing the anti-counterfeiting verification process.

[0019] This invention also provides a QR code anti-counterfeiting method based on digital watermarking and vector quantization compressed image encoding. This method introduces a digital watermarking mechanism, fundamentally transforming optical anti-counterfeiting from physical dependence to content credibility, significantly improving the overall anti-counterfeiting security level of the system. The core anti-counterfeiting features of this invention include two layers: the first layer is a high-definition image processed by vector quantization, which serves as an explicit anti-counterfeiting carrier. Its content can be customized according to application needs, such as using facial features, fingerprints, or other specific identification information; the second layer is a stable watermark embedded in this high-definition image, achieving content-level authentication through the invisible embedding and extraction of the watermark. This invention is the first to systematically introduce digital watermarking technology into a QR code encryption anti-counterfeiting system. By embedding encrypted anti-counterfeiting watermark information within the image carrier, the anti-counterfeiting information not only relies on external optical and physical properties but is also deeply bound to the mathematical feature structure of the image content itself. By embedding encrypted invisible watermark information in the carrier image, even if the QR code pattern or external representation is copied, illegal copyists cannot reconstruct it or pass the content-level authentication judgment process. This invention constructs a data-carrying and content authentication collaborative anti-counterfeiting mechanism through this technical approach, effectively solving the problem of the overall failure of traditional anti-counterfeiting systems after the carrier is copied, and significantly improving the security and reliability of anti-counterfeiting systems in practical applications.

[0020] This invention, based on stable transform domain feature embedding, ensures high-quality extractability of anti-counterfeiting information even under conditions of strong compression and structured coding. By constructing a DWT-DCT-SVD hybrid transform domain watermark embedding mechanism, the invention embeds the anti-counterfeiting watermark into structural features of the image that are highly energy-concentrated, algebraically stable, and visually insensitive. This invention effectively solves the technical bottleneck of digital watermarking's susceptibility to distortion under strong compression and complex channel conditions, enabling reliable extraction and identification of the anti-counterfeiting watermark even after vector quantization compression and QR code transmission. This significantly improves the usability and robustness of anti-counterfeiting information in engineering application environments, providing key technical support for the practical implementation of digital watermarking in anti-counterfeiting systems.

[0021] This invention constructs a watermark encryption and embedding mechanism based on chaotic key control, significantly enhancing the security, controllability, and engineering flexibility of anti-counterfeiting systems. To further improve the security level of the anti-counterfeiting system, this invention introduces a key control mechanism combining chaotic encryption and geometric scrambling during the watermark embedding process, forming a one-time pad key control method, making the watermark encryption and embedding process uniquely corresponding and unpredictable. By performing chaotic sequence XOR encryption and Arnold scrambling operations on the watermark information, the watermark exhibits highly randomized distribution characteristics before embedding; any slight deviation in key parameters will cause the decryption result to completely fail. Through the above key control mechanism, this invention significantly improves the security and scalability of optical anti-counterfeiting systems in engineering applications, enabling flexible adjustment of anti-counterfeiting strength and authentication strategies according to actual needs, enhancing the long-term security and engineering applicability of the system.

[0022] The multi-layered anti-counterfeiting architecture used in this invention possesses excellent scalability and versatility, and can be widely adapted to various anti-counterfeiting implementation forms and application scenarios. The anti-counterfeiting method proposed in this invention organically integrates multiple technical layers, including digital watermarking technology, vector quantization compression, structured coding, and key control mechanisms. In particular, it uses customizable high-definition images as the first-layer anti-counterfeiting carrier and a stable watermark embedded based on a one-time key mechanism as the second-layer content-level authentication method, constructing a multi-layered, modular anti-counterfeiting architecture. This structure maintains the relative independence of each functional module while forming a synergistic protection effect as a whole, exhibiting good system scalability, independence from specific implementation forms, and strong versatility and compatibility. By adjusting the watermark size, embedding strength, and key parameters, this invention can meet the needs of various high-security application scenarios such as document anti-counterfeiting, identity authentication, and invoice anti-counterfeiting. Attached Figure Description

[0023] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0024] Figure 1 This is a flowchart of the QR code anti-counterfeiting method based on digital watermarking and vector quantization compression encoding of images according to the present invention.

[0025] Figure 2 This is a flowchart of the digital watermark embedding method of the present invention.

[0026] Figure 3 This is a flowchart of the digital watermark extraction and verification method of the present invention. Detailed Implementation

[0027] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. 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 should fall within the scope of protection of the present invention.

[0028] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0029] like Figure 1 As shown, this invention provides a QR code anti-counterfeiting method based on digital watermarking and vector quantization compressed image encoding, specifically including the following steps: S1: Digital watermark embedding, such as Figure 2 As shown Double encryption of the watermark image: The original watermark is set as an 11×11 binary image, with pixel values ​​of 0 or 1, used to represent specific anti-counterfeiting marks or authentication patterns. First, the watermark image is encrypted using a Logistic chaotic mapping. The iteratively generated chaotic sequence is thresholded and mapped to a binary chaotic mask matrix containing only 0 and 1. The chaotic mask matrix is ​​XORed pixel-by-pixel with the original watermark image, significantly randomizing the pixel distribution of the original watermark. Then, the encrypted watermark is further subjected to an Arnold scrambling operation to disrupt the spatial distribution of the watermark pixels. The number of scrambling iterations is set to K=3, resulting in the final watermark matrix to be embedded.

[0030] Carrier image preprocessing: First, the input image is converted into a grayscale image, and then the image size is uniformly adjusted to 112×96 pixels to ensure that it is consistent with the image size used in the vector quantization stage, thus providing a basis for subsequent block segmentation and codebook matching.

[0031] Discrete wavelet transform: Perform a first-level Haar discrete wavelet transform on the preprocessed carrier image to decompose the carrier image into a low-frequency approximate subband LL1 and high-frequency detail subbands LH1, HL1 and HH1.

[0032] Extraction and segmentation of the LL low-frequency sub-band: The LL1 low-frequency approximation sub-band is selected as the watermark embedding area, with a size of 56×48 pixels. This sub-band is segmented into blocks of 4×4 pixels, resulting in a total of 168 low-frequency sub-blocks.

[0033] Discrete Cosine Transform and Construction of Low-Frequency Coefficient Matrix: Perform a two-dimensional discrete cosine transform (DCT) on each 4×4 sub-block, extract the DC coefficients (DC coefficients) in the upper left corner of each DCT block, and construct a 14×12 DC coefficient matrix according to their positions in LL1.

[0034] Singular Value Decomposition: Perform Singular Value Decomposition (SVD) on the DC coefficient matrix, expressed in the form of... This yields the singular value matrix S and the orthogonal matrices U and V.

[0035] Singular Value Embedding and Reconstruction: Expand the 11×11 encrypted watermark matrix and map it to the corresponding positions in the singular value matrix. The embedding strength factor α is 40, and the process is performed according to the formula... Modulate the singular values ​​to obtain a new singular value matrix containing the watermark. The corresponding orthogonal matrices U and V are retained for watermark extraction.

[0036] Inverse transform to generate watermarked images: using the original orthogonal matrix and The DC coefficient matrix is ​​reconstructed and backfilled into each DCT block. Inverse DCT is then performed to obtain the low-frequency subband LL1′. Finally, inverse DWT is performed with the original high-frequency subbands LH1, HL1, and HH1 to obtain the watermarked carrier image.

[0037] S2: Image compression coding and QR code coding Blocking and Vectorization Conversion: The watermarked carrier image is divided into 4×4 non-overlapping blocks, and each block is expanded into a 16-dimensional vector to form a set of image block vectors to be encoded.

[0038] Codeword index matching encoding: For each image block vector, calculate its Euclidean distance to 512 codewords in the codebook, select the index of the codeword with the smallest distance, and concatenate them in block order to generate a complete index sequence.

[0039] Index to binary bitstream: Since the codebook size K=512, each index requires 9 bits of binary representation (log2(512)=9). All indices are converted into a continuous binary bitstream in sequence as intermediate data after image compression.

[0040] Generating anti-counterfeiting QR codes: Using QR code encoding algorithms, the bitstream is mapped to a black and white QR code image. The QR code module strictly corresponds to the arrangement of encrypted bits, and high-density information embedding is achieved by selecting an appropriate version and fault tolerance level.

[0041] QR code decoding: Scan the QR code to parse the encrypted bitstream. Divide the bitstream into groups of 9 bits to recover the codeword index sequence. Using a shared vector quantization codebook, map the index sequence back to the corresponding 4×4 codeword blocks, and reassemble the image blocks in their original order to complete the reconstruction of the image to be verified.

[0042] S3: Digital watermark extraction and verification, such as Figure 3 As shown Discrete wavelet transform: Perform a first-order Haar discrete wavelet transform on the image to be verified to extract the low-frequency subband LL1, and further map the spatial domain information to the frequency domain, making the energy distribution of the image more concentrated.

[0043] Block Discrete Cosine Transform: The LL1 subband is divided into 4×4 blocks for discrete cosine transform, and the DC coefficients are extracted to construct a DC coefficient matrix. This matrix preserves the overall structural features of the image in an algebraic sense, and is also the key carrier for embedding singular value information of the watermark.

[0044] Singular value decomposition inverse operation extraction: Singular value decomposition is performed on the DC coefficient matrix constructed in the previous step to obtain the singular value matrix. Using the key matrices U and V retained in the embedding stage, the projection matrix is ​​calculated. By performing an inverse combination operation between the current singular value matrix and the orthogonal matrix, the features of the image to be verified are remapped into the signal space used during watermark embedding, thereby constructing a temporary matrix containing the watermark energy. The extracted information at this point is a noisy floating-point matrix.

[0045] Decryption and watermark recovery: First, perform an inverse Arnold transform on the floating-point matrix obtained in the previous step to eliminate position scrambling. Generate a decryption mask using the same chaotic parameters (initial and control parameters) as the embedding end, and XOR it with the inversely scrambled data for decryption. Finally, binarize the decrypted data (e.g., set the threshold to 0.5) to obtain the final watermark image. Calculate the normalized correlation coefficient (NC) between the extracted watermark and the original watermark. If the NC value is greater than a preset threshold, the verification is successful.

[0046] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0047] In the above embodiments of the present invention, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0048] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units can be a logical functional division, and in actual implementation, there may be other division methods. For instance, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual coupling, direct coupling, or communication connection may be through some interfaces; the indirect coupling or communication connection between units or modules may be electrical or other forms.

[0049] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0050] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0051] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A QR code anti-counterfeiting method based on digital watermarking and vector quantization, characterized in that: S1: After encrypting and scrambling the watermark image, the carrier image is preprocessed, and the watermark is embedded through wavelet transform, block discrete cosine transform and singular value decomposition. The inverse transform generates a watermarked image and stores the verification information. S2: After dividing the watermarked image into blocks, a codeword index sequence is generated based on the vector quantization codebook and converted into a binary bit stream. A QR code image is generated through QR code encoding. After recognition and decoding, the index sequence is restored and the image is reconstructed using the codebook. The image is then compared with the database template to complete the authenticity verification. S3: The low-frequency sub-band is extracted by discrete wavelet transform of the image to be verified and reconstructed. After being divided into blocks, the DC coefficient matrix is ​​constructed by discrete cosine transform. The watermark signal is extracted in reverse by singular value decomposition and auxiliary information stored in the embedding stage. Arnold inverse scrambling and chaotic XOR decryption are performed in sequence to restore the watermark data. The extracted watermark image is obtained by threshold binarization and compared with the original watermark template. The authenticity is determined according to the preset threshold to complete the anti-counterfeiting verification.

2. The anti-counterfeiting method based on digital watermarking and vector quantization of two-dimensional code according to claim 1, characterized in that: S1 adopts the following method: S11: Obtain the identification image used for anti-counterfeiting authentication, perform binarization processing on the identification image to obtain the watermark image, and perform size normalization processing on the watermark image so that its size is consistent with the size of the watermark matrix required by the watermark embedding algorithm. S12: Based on preset chaotic key parameters, a chaotic sequence with the same size as the watermark image is generated using chaotic mapping, and the chaotic sequence is binarized to form a chaotic mask matrix. The watermark image and the chaotic mask matrix are XORed bit by bit. An Arnold scrambling operation is performed on the watermark image after chaotic encryption. The positions of the watermark pixels are geometrically scrambled according to preset scrambling parameters and iteration number to obtain the watermark matrix to be embedded. S13: Perform grayscale processing, size normalization processing, and noise suppression processing on the carrier image used for anti-counterfeiting; S14: Perform discrete wavelet transform on the preprocessed carrier image to decompose it into low-frequency approximate sub-bands and high-frequency detail sub-bands. Select the low-frequency approximate sub-band as the watermark embedding region and perform block processing according to the set block size. Perform discrete cosine transform on each image block to extract the DC component of each image block and construct the DC coefficient matrix. S15: Perform singular value decomposition on the DC coefficient matrix to obtain a singular value matrix. Load the watermark matrix obtained in step A2 into the singular value matrix according to a preset embedding strength factor. Modulate the singular values ​​to obtain a new singular value matrix containing watermark features. S16: Reconstruct the DC coefficient matrix using the original orthogonal matrix and the new singular value matrix, and sequentially perform inverse discrete cosine transform and inverse discrete wavelet transform to generate a carrier image with embedded anti-counterfeiting watermark. At the same time, store the orthogonal matrix, embedding strength parameter, chaotic key and scrambling parameter used in the watermark embedding process as verification auxiliary information.

3. The QR code anti-counterfeiting method based on digital watermarking and vector quantization according to claim 1, characterized in that: S2 specifically includes the following steps: S21: Divide the processed watermarked image into multiple non-overlapping image sub-blocks according to a preset block size; unfold each image sub-block into a one-dimensional vector, making its dimension consistent with the codeword dimension in the vector quantization codebook; based on the trained vector quantization codebook, calculate the distance between each image block vector and all codewords in the codebook, and select the codeword with the smallest distance as the representation of the current image block, thereby generating the corresponding codeword index sequence; S22: Based on the size of the vector quantization codebook, a fixed length of binary encoding bits is allocated to each codeword index, and all codeword indices are converted into a continuous binary bit stream according to the arrangement order of the image blocks to form a data sequence that can be used for subsequent QR code mapping. S23: Using a QR code encoding algorithm, the encrypted bit stream is mapped onto the QR code module structure to generate a QR code image composed of black and white units; S24: Use a QR code recognition algorithm to decode the code and extract the QR code information it contains. S25: Based on the bit width of the codeword index in the vector quantization codebook, the decrypted bitstream is restored to an index sequence; combined with the pre-stored vector quantization codebook, the index is mapped to the corresponding codeword vector through a lookup table, and the image data is reconstructed according to the image block order. The reconstructed image is then compared with the authorized templates stored in the system database to verify the authenticity of the anti-counterfeiting mask and its corresponding information.

4. The QR code anti-counterfeiting method based on digital watermarking and vector quantization according to claim 1, characterized in that: S3 specifically includes the following steps: S31: Perform discrete wavelet transform on the reconstructed image to be verified obtained in S2, decompose it into low-frequency approximate sub-band and high-frequency detail sub-band; select the low-frequency approximate sub-band as the watermark extraction region, and perform block processing according to the block division rules of the embedding stage; perform discrete cosine transform on each image block, extract the DC component of each image block, and construct the DC coefficient matrix of the image to be verified. S32: Perform singular value decomposition on the constructed DC coefficient matrix to obtain the corresponding singular value matrix. Using the watermark embedding auxiliary information stored in step A5, perform inverse modulation operation on the singular value matrix to separate the watermark signal superimposed on the singular values, thereby obtaining a watermark matrix in an encrypted and scrambled state; S33: Perform Arnold inverse scrambling operation on the extracted watermark matrix, and perform inverse geometric mapping on the position of the watermark pixels according to the scrambling parameters and iteration number set in the embedding stage. S34: Perform threshold decision processing on the decrypted watermark data to convert it into a binary watermark image, thereby eliminating amplitude disturbances introduced by compression noise, quantization error or optical distortion during the extraction process, and obtaining the final extracted watermark image. S35: The extracted watermark image is compared with the original watermark template pre-stored in the system to calculate the correlation index between the two. When the correlation index is greater than or equal to a preset threshold, the image to be verified is determined to be a genuine anti-counterfeiting image; when the correlation index is lower than the threshold, it is determined to be a counterfeit or tampered image, thereby completing the anti-counterfeiting verification process.

5. The QR code anti-counterfeiting method based on digital watermarking and vector quantization according to claim 1, characterized in that: Based on the chaotic key parameters stored in S1, a chaotic mask matrix for decryption is generated using the same chaotic mapping method as the embedded end. The obtained encrypted watermark matrix and the chaotic mask matrix are XORed bit by bit to decrypt the chaotic encryption and recover the logical data of the watermark information.