Anti-copy two-dimensional code and generation and detection method and application thereof
By introducing anti-counterfeiting feature textures and double-position patterns into the QR code, combined with error correction coding and encryption technology, the problem of low security in the existing QR code anti-counterfeiting technology is solved, and the effect of efficiently distinguishing the original from the replica is achieved.
Patent Information
- Application Number
- CN202510230489.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-28
- Publication Date
- 2025-07-04
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing QR code anti-counterfeiting technology has problems such as low security, high cost, and great limitations in application scenarios, making it difficult to effectively distinguish between originals and replicas.
By introducing anti-counterfeiting feature texture replacement in the QR code or embedding the second layer of copy detection information, combining error correction encoding and encryption technology, the pixel size, density and number of anti-counterfeiting feature textures are designed, the double-position pattern is added, and the authenticity is identified using imaging equipment.
While achieving compatibility with existing QR codes, it enhances printing and scanning fault tolerance and security, can effectively distinguish between originals and replicas, and provides efficient, reliable and low-cost anti-counterfeiting solutions.
Smart Images

Figure FT_1 
Figure FT_2 
Figure FT_3
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of two-dimensional code encoding and decoding, and relates to an anti-copy two-dimensional code, a method for generating and detecting the same, and an application thereof. Background Art
[0002] Two-dimensional codes (such as QR codes, Datamatrix codes, etc.) have been widely used as identifiers for items and item packages, and related applications involve the authenticity identification, anti-copying, and traceability of items and valuable items.
[0003] Existing common anti-counterfeiting technologies for items and valuable items mainly include: material anti-counterfeiting, electronic identification anti-counterfeiting, electronic code anti-counterfeiting, and texture anti-counterfeiting.
[0004] Taking material anti-counterfeiting as an example, identification is carried out through special inks, temperature changes, chemical substances, etc. The method for identifying the original item mainly relies on manual inspection of the existence of special marks. This solution is mainly used to prevent forgery, and its security mainly depends on the complexity of the special marks. For example, as described in US Patent Nos. US7492920B2, US7684088B2, and US7965862B2, invisible marks are printed on the surface of an item or package, including special paper treatment, so that it can be immediately colored by a solvent or an ultrasonic detection system. However, these technologies require special materials or unique construction methods, which are not only costly but also have low security.
[0005] Electronic identification anti-counterfeiting is carried out through magnetic recording, identification cards combined with a data management system. This anti-counterfeiting technology must use specific hardware devices, and its application scenarios are relatively limited and not suitable for identifying low-cost items and their packaging.
[0006] Texture anti-counterfeiting technology is based on unique textures. Digital images of all textures are stored in a database. Users use a smart phone to photograph the texture, upload it to the database for retrieval, and the corresponding image is returned. Users achieve identification by comparing it themselves. This method is not objective, and the database retrieval time will increase as the database grows. These anti-counterfeiting technologies all have more or less defects, which makes people start to explore new solutions. Summary of the Invention
[0007] In order to solve the deficiencies existing in the prior art, the purpose of the present invention is to provide an anti-copy two-dimensional code, a method for generating and detecting the same, and an application thereof.
[0008] The present invention provides an anti-copy two-dimensional code, wherein all or part of the black modules and / or all or part of the regions of a known publicly available two-dimensional code are replaced by anti-counterfeiting feature textures; and / or, a second layer of copy detection information is modulated and embedded in the high-frequency components of the known publicly available two-dimensional code.
[0009] The anti-counterfeiting feature texture includes one or more, which contain copy detection information;
[0010] The pixel size of the anti-counterfeiting feature texture is greater than or equal to 1×1 and less than or equal to 12×12;
[0011] The density of black pixels in the anti-counterfeiting feature texture is greater than or equal to 40% and less than or equal to 70%;
[0012] In a specific embodiment, anti-counterfeiting dot matrices are arranged around the replaced partial area and / or around the known publicly disclosed two-dimensional code.
[0013] In a specific embodiment, the number of the anti-counterfeiting feature textures is less than or equal to 16.
[0014] In the present invention, a method for manufacturing an anti-copy two-dimensional code as an article identifier includes: the first layer of information is a publicly readable two-dimensional graphic code compatible with the known publicly disclosed two-dimensional code; the second layer of copy detection information is that anti-counterfeiting feature textures are used to replace all or part of the black modules and / or all or part of the areas of the known publicly disclosed two-dimensional code; and / or, modulation and embedding are performed in the high-frequency components of the known publicly disclosed two-dimensional code.
[0015] The present invention also provides a method for authenticating or detecting the authenticity of the manufactured anti-copy two-dimensional code by using an imaging device. It includes: an anti-copy two-dimensional code positioning method, an image matrix acquisition method for the anti-counterfeiting feature texture, a decoding method for the anti-counterfeiting feature texture, and a method for authenticating the authenticity of the copy detection information.
[0016] The method for authenticating the authenticity of the copy detection information further includes: a threshold calculation method for the difference in correlation coefficients of the anti-counterfeiting texture, which sets a threshold standard for distinguishing between the original printed two-dimensional code and its replica; a method for distinguishing authenticity by using the peak points irregularly distributed in the frequency spectrum diagram of the input anti-copy two-dimensional code captured; a method for comprehensively evaluating multiple features of the input two-dimensional code image by using a machine learning model; a method for detecting the high-frequency components of the copy detection information embedded in the first layer of publicly disclosed two-dimensional code.
[0017] The present invention further includes that, in order to track the transfer of articles, the coding information of the anti-copy two-dimensional code as the unique identifier of the article is recorded in a database together with other supply chain-related data. By retrieving the unique identifier, the origin and country of origin of the goods can be traced.
[0018] The present invention provides an anti-copy two-dimensional code generation and detection method, including an anti-copy two-dimensional code generation method and an authenticity detection method for the anti-copy two-dimensional code; specifically, the anti-copy two-dimensional code generation method includes the following steps:
[0019] Step 1: Generate the first - layer public QR code using an encoding method compatible with existing publicly available QR codes; the first - layer information is presented in the form of a QR code. An encoding method compatible with known publicly available QR codes (including but not limited to QR codes, DataMatrix codes, PDF417 codes, etc.) is used to keep the functional patterns such as position tags, alignment patterns, and finder patterns consistent; ensure that the first - layer public QR code can be recognized by existing QR code hardware or software scanners.
[0020] Step 2: Integrate the second - layer copy - detection information to generate the anti - copy QR code.
[0021] The generation method of the second - layer copy - detection information includes replacing all or part of the black modules and / or all or part of the areas of the known first - layer public QR code with specific anti - counterfeiting feature textures; and / or, modulating and embedding the second - layer copy - detection information onto the high - frequency components of the first - layer public QR code.
[0022] The second - layer copy - detection information contains a set of specific anti - counterfeiting feature textures and data encoding.
[0023] The set of anti - counterfeiting feature textures contains q anti - counterfeiting feature textures. To prevent possible errors in specific anti - counterfeiting feature textures during printing and recognition, the difference between the set of anti - counterfeiting feature textures recognized by the scanner and the set of anti - counterfeiting feature textures used during encoding is controlled within a range that does not affect the correctness of the decoding result.
[0024] Specifically, in the design of anti - counterfeiting feature textures, keeping the black pixel density in the pattern consistent helps to ensure that the structure of the anti - counterfeiting feature texture is not affected even when there are errors during printing or scanning, thus ensuring the accuracy of recognition.
[0025] In addition, keeping the spectral characteristics of the designed anti - counterfeiting textures consistent helps to accurately recognize them under different lighting conditions and reduces the risk of misrecognition.
[0026] In a specific implementation, the selection conditions for the anti - counterfeiting feature textures need to simultaneously meet the following: (1) The pixel size is greater than or equal to 1×1 and less than or equal to 12×12; (2) The density of black pixels in the anti - counterfeiting feature texture is greater than or equal to 40% and less than or equal to 70%; (3) The number of anti - counterfeiting feature textures is less than or equal to 16.
[0027] The data encoding means using the texture number of the anti - counterfeiting feature texture as the encoding, representing the texture numbers with 0 to (q - 1) in base q; the generated encoded data is first subjected to error - correction encoding to improve fault tolerance, then the error - corrected base - q data stream is encrypted, and then one or more anti - counterfeiting feature textures in the set of anti - counterfeiting feature textures are used to replace all or part of the black modules and / or all or part of the areas of the public QR code.
[0028] The method for replacing the module for detecting the second - layer copy detection information includes the following:
[0029] For the black modules of the first - layer public two - dimensional code, all or part of the data modules (black modules) are replaced one by one with anti - counterfeiting feature textures. Denote the total number of modules of the first - layer public two - dimensional code as N 2 , the number of black modules to be replaced is pieces, the ratio of the effective information bits in the error - correction code is k / n, and it can store bits of q - ary data. By ensuring that the density ratio of the black pixel points in the anti - counterfeiting feature texture is greater than or equal to 40% and less than or equal to 70%, the anti - counterfeiting feature texture is recognized as a black module by the existing two - dimensional code scanner; or,
[0030] Utilize the error - tolerant data modules of the first - layer public two - dimensional code, remove the data modules in the central area or other appropriate areas of the two - dimensional code, and embed the texture modules of the second - layer copy detection information. The texture modules and the data modules of the public two - dimensional code adopt different pixel sizes; one or more anti - counterfeiting feature textures are included in the texture modules; or,
[0031] The technical solution of integrating the second - layer copy detection information into the first - layer public two - dimensional code further includes a method of modulating and embedding the second - layer copy detection information onto the high - frequency components of the first - layer public two - dimensional code:
[0032] Normalize the grayscale values of the first - layer public two - dimensional code and the second - layer copy detection information respectively, and then perform Fourier or DCT transforms on the first - layer and second - layer information to obtain the frequency - domain diagrams F layer1 and F layer2 , create a mask according to F layer1 to retain the low - frequency part of the first - layer public two - dimensional code, embed the frequency - domain information of the second - layer copy detection information into the high - frequency part of F layer1 , then perform the inverse Fourier transform and binarization to generate a complete anti - copy two - dimensional code, whose shape is the same as that of the first - layer public two - dimensional code, and the spectrum information of the second - layer copy detection information is embedded in the black modules.
[0033] As a further optimization solution, in a specific embodiment, the anti - copy performance of the two - dimensional code can also be improved through a double positioning pattern; the double positioning pattern includes the positioning pattern of the original public two - dimensional code and the added anti - counterfeiting dot matrix (including the positioning frame and / or positioning points);
[0034] Specifically, the double positioning pattern includes: a positioning pattern of a known first-layer public two-dimensional code; and a square positioning frame or positioning point with a width of 1 to 10 pixels is added at a position 1 to 20 pixels between the edge of the generated anti-copy two-dimensional code and the two-dimensional code, or a square positioning frame and positioning point with a width of 1 to 10 pixels is added at a position 1 to 10 pixels between the edge of the second-layer copy detection information module and the copy detection information module; the data ranges involved above can all take both end points.
[0035] The authenticity detection method of the anti-copy two-dimensional code includes: performing graphic and imaging processing on the two-dimensional code image captured by an imaging device (such as a smartphone camera, scanner, etc.) to identify whether it is an original.
[0036] Specifically, the authenticity detection method of the anti-copy two-dimensional code includes the following steps:
[0037] Step A: Locate the anti-copy two-dimensional code through the positioning pattern, and extract the image matrix of the anti-copy two-dimensional code to be identified and the image matrix of the copy detection information;
[0038] If the search for the positioning pattern fails, it means that the two-dimensional code is a replica or has been modified in other forms; if the positioning pattern is successfully found, the subsequent steps are carried out;
[0039] After the positioning pattern detection is completed, the decoding of the first-layer public two-dimensional code is obtained by extracting the image matrix of the anti-copy two-dimensional code.
[0040] The acquisition methods of the image matrix of the anti-copy two-dimensional code and the image matrix of the copy detection information include the following:
[0041] The first method: Use the corner points of the positioning pattern of the known public two-dimensional code of the first-layer information, and perform perspective transformation according to the corner points to restore the image matrix of the anti-copy two-dimensional code; then extract the image matrix of the copy detection information according to the relative position between the first-layer public two-dimensional code and the second-layer copy detection information.
[0042] The second method: Refer to adding a square dot positioning frame with 1 to 10 pixels at a certain distance between the edge of the generated anti-copy two-dimensional code and the two-dimensional code. The number of added dots is 0 to 64, and the distance between the positioning frame and the two-dimensional code is set to several times the module size. The specific steps include finding the approximate range of the positioning frame, determining the boundary of the coverage area, performing Hough transformation and Canny edge detection on the image, and obtaining the corner points and performing perspective transformation according to the corner points to restore the image matrix of the anti-copy two-dimensional code; then extract the image matrix of the copy detection information according to the relative position between the first-layer public two-dimensional code and the second-layer copy detection information;
[0043] The third method: It means adding a square dot positioning frame with 1 to 10 pixels at a certain distance from the edge of the copied detection information in the generated second layer. The number of added dots ranges from 0 to 64, and the distance between the positioning frame and the second-layer copied detection information is set to several times the module size. The specific steps include finding the approximate range of the positioning frame, determining the boundary of the coverage area, performing Hough transform and Canny edge detection on the image, obtaining corner points, and performing perspective transformation based on the corner points to restore the image matrix of the anti-copy QR code; then extracting the image matrix of the second-layer copied detection information according to the relative position between the first-layer public QR code and the second-layer copied detection information.
[0044] Before step A, it also includes correcting the QR code obtained by shooting through perspective transformation; the perspective transformation belongs to the spatial transformation of the image. Using the condition that the perspective center, pixel point, and target point are collinear, according to the perspective rotation law, the projection plane rotates around the perspective axis by a certain angle, destroying the original projection light beam, and still being able to keep the projection geometric figure on the projection plane unchanged. That is, a plane is projected onto a specified plane through a projection matrix. The transformation formula is as follows:
[0045]
[0046] Among them, the coordinate vector on the left side of the equation is the coordinate vector after perspective transformation, and the right side of the equation is the input original coordinate vector and the perspective transformation matrix.
[0047] Step B: Perform texture module and texture set matching on the obtained image matrix of the copied detection information to decode the copied detection information.
[0048] Extraction of the texture module of the second-layer copied detection information. Read the pattern with slight differences from the original texture after the second-layer copied detection information goes through the printing process, calculate the characteristic texture closest to the original anti-counterfeiting feature texture through the texture pattern matching algorithm, and reconstruct each anti-counterfeiting feature texture module.
[0049] Decode the second-layer copied detection information. For the second-layer copied detection information, it can be decoded independently of the first-layer public QR code. The decoding of the first layer can be recognized by any standard QR code scanner. The following explains the decoding process of the second-layer copied detection information.
[0050] Use the texture pattern matching algorithm to match the read texture module with the textures in the texture set, and classify to obtain the data after error correction code encoding of the second-layer copied detection information.
[0051] Texture pattern matching algorithm: Using q anti-counterfeiting feature textures q(x) (x = 1...q) in the texture set as the reference for pattern matching, scan each texture module of the processed binary image one by one. For the texture module pi , calculate the Pearson correlation coefficient between it and each texture in the anti-counterfeiting feature texture set, select the largest one among q as the matching feature pattern, and use its corresponding data code as the q-binary code q_ary(i) obtained by decoding.
[0052] q_ary(i)=max(cor(q(x),P i )),x=1…q
[0053] Among them, q_ary(i) represents the texture module P i The matching result indicates that i The number of the most matching anti-counterfeiting feature texture q(x); cor(q(x),P i ) represents the anti-counterfeiting feature texture q(x) and the current image texture module P i The Pearson correlation coefficient between them is used to measure the similarity between the two.
[0054] The error correction code algorithm is used to decode the data and correct errors.
[0055] The encryption key is used to decrypt the error-corrected data. If the decryption is successful, the decoding link of the second-layer copy detection information is completed.
[0056] In a specific implementation process, it also includes decoding the second layer of copy detection information and / or the anti-counterfeiting dot matrix embedded in the blank area around the first layer of public QR code: decoding the information by identifying points of different grayscales, positions, directions, and shapes that make up the anti-counterfeiting dot matrix.
[0057] The identification / detection method of the second-layer copy detection information refers to using one or more of the following four methods to identify the authenticity of the second-layer copy detection information and to identify whether the item is an original or a counterfeit.
[0058] The first method is to use the correlation and bit error rate between the physical printed image and the original copy detection information image for identification. Due to the defects in the scanning and printing process in the manufacturing of replicas and the randomness of the material itself, the changes in the anti-counterfeiting feature texture will increase with each scanning and printing, and the correlation with the original texture will also decrease. The copy detection information image of the original texture structure is X, and its corresponding scanned and printed version is but NP and Ns are the noises caused by printing and scanning. The identification method is to determine the authenticity of the document by measuring the distortion of the image input from the imaging device, and the judgment standard is the set threshold Th. The input image is but
[0059] The function f is an arbitrary function representing the distance or correlation between images. The Pearson correlation coefficient function can be selected to calculate the correlation coefficient between each texture of the input image and the set of original textures. If the hypothesis h0 holds, the input image is a physical picture printed only once; if the hypothesis h1 holds, the input image is a copy scanned and printed at least twice.
[0060] Define the bit error rate of the copy detection information module in the texture pattern matching algorithm as: Preset the bit error rate threshold Th according to the actual situation e If the hypothesis er ≤ Th e the input image is a physical picture printed only once; if er > Th e then the input image is a copy scanned and printed at least twice.
[0061] To determine the threshold for distinguishing the original from the copy, make multiple prints and copies of the same anti-counterfeiting feature texture, measure the threshold of the texture image after scanning and printing, and calculate the average value. Then calculate the average threshold between the original and the copy as the standard threshold for distinguishing the original and the copy. Obtain as many pairs of original and physical textures as possible from the textures obtained by decoding the anti-counterfeiting QR code, and calculate their thresholds. Then compare them with the already determined standard threshold to correctly distinguish the original from the copy;
[0062] The second method: The spectrogram of the grayscale image of the anti-counterfeiting QR code input from the imaging device is an array centered on the harmonic "spikes" of the halftone frequency. The forgery traces of the QR code after printing and scanning are "amplified" in the spectrogram. In the spectrogram of the forged QR code, in addition to the peak points that are the same as those of the original anti-counterfeiting QR code spectrum, there are many irregularly distributed peak points, and these irregular peak points are the basis for determining the forged QR code.
[0063] First, perform Gaussian filtering preprocessing on the QR code image to remove noise. Since the halftone parameters and shooting parameters of the original anti-counterfeiting QR code are known during the production of the QR code, calculate the peak points in the frequency domain map after normal frequency domain transformation, and then compare them with the actually measured peak points. If there are additional peaks or unmatched peaks, it can be shown that this QR code spectrum is from a forged QR code.
[0064] Regardless of any noise or image distortion, as long as the dot matrix structure of the halftone grayscale QR code does not change significantly, the spectrogram is obtained through convolution, and the 9 peak points generated by the following two-dimensional impulse function sequence are the same:
[0065]
[0066] where M G(x) represents that the input size is k c l c pixel original QR code image, and Δx represents the vector offset error between the printing process and the shooting process. The imaging process during shooting is modeled as a convolution operation It is the original anti-copy QR code image M with an offset of Δx G convolved with a low-pass filter F c with a kernel parameter vector γ lp (·). The shooting process consists of a two-dimensional Dirac δ function and sampling vectors d c , e c where the sampling vectors represent the direction of image sampling and the pixel size during the shooting process respectively.
[0067] If there are several additional peak points in the area near the center in addition to the above-mentioned 9 core reference points, the additional peak points are the basis for determining the spectrum of the forged QR code.
[0068] The third method: The method uses a support vector regression machine learning model to comprehensively evaluate the input QR code image for multiple features (input image evaluation features). Since a single feature cannot achieve good results in determining the authenticity of the anti-copy QR code image. The method combines multiple features and uses a machine learning model to comprehensively evaluate the authenticity of the input QR code image.
[0069] First, extract the evaluation features of the input image collected by the imaging device, including the overall re-blurred DCT (discrete cosine transform) ratio at different blurring scales, the difference in re-blurred kurtosis, the difference in re-blurred skewness, the average DCT entropy value, the block re-blurred DCT ratio, the ratio of the standard deviation to the mean of the DCT coefficients, the variance in different directions of the DCT, the average value of the re-blurred gradient map, the difference in re-blurred total variation, and the Pearson correlation coefficient. The training data set T is expressed as x i represents the input of the i-th sample; y i is the regression value of the i-th sample; n represents the dimension of the feature; the feature vector after the sample is non-linearly mapped is denoted as The sample is a training picture with a true or false label;
[0070] Then, different kernel functions are selected respectively, and the optimal model parameters after training are obtained through repeated cross-validation. A support vector regression model is trained, and on this basis, the authenticity of the input QR code image is detected.
[0071] The fourth method is to calculate the maximum usage frequency and the maximum achievable frequency based on the first-layer public QR code and the anti-copying QR code embedded with the copy detection information obtained by the above method, so as to calculate the printed pixel resolution.
[0072] For the input anti-copying QR code image embedded with copy detection information, calculate F through Fourier or DCT transform. layer2 Then, restore the original second-layer copy detection information through the inverse transform of Fourier or DCT; verify and identify the restored second-layer copy detection information.
[0073] The anti-copying QR code image is digitally printed.
[0074] Specifically, the anti-copying QR code image is printed by a laser printer, or by an inkjet printer, or by laser lithography.
[0075] The anti-copying QR code image can be printed on the surfaces of paper, metal, ceramics, glass, item packages, etc.
[0076] In a specific embodiment, in order to track the transfer of items, the encoding of the anti-copying QR code with the unique identifier of each item is recorded in the database together with other supply chain-related data. By retrieving the unique code identifier, the origin and country of origin of the goods can be traced.
[0077] In the specific implementation process of the present invention, the second-layer copy detection information does not interfere with the first-layer public QR code, and the position of the positioning pattern of the public QR code remains unchanged. The scheme controls the black pixels in the texture of the replaced black module to maintain a high density in the total number of pixels of the pattern, so that when the standard QR code reader calculates the pixel value mean of this pattern, it exceeds the pixel value range threshold recognized as a black module.
[0078] In the specific implementation process of the present invention, in order to ensure the correct classification during the decoding of the second-layer copy detection information, it is necessary to ensure the distinguishability of q textures in the texture set.
[0079] Comprehensively identify the copy detection information using one or more of the above methods.
[0080] The present invention also discloses the application of the above anti-copying QR code, the above anti-copying QR code generation method, or the above anti-copying QR code detection method in commodity anti-counterfeiting, intelligent packaging, logistics tracking, supply chain management traceability, document printing, digital copyright protection, etc.
[0081] The beneficial effects of the present invention include: By introducing a second layer of copy detection information on the basis of the publicly disclosed two-dimensional code, using anti-counterfeiting feature textures to replace or embed some black modules of the publicly disclosed two-dimensional code, and combining error correction coding and encryption technologies, the present invention not only achieves full compatibility with existing two-dimensional code standards, but also enhances the fault tolerance and security of two-dimensional codes in printing and scanning; the designed anti-counterfeiting feature textures have unique spectral characteristics and pixel distribution characteristics, which can effectively distinguish the original from the replica; at the same time, by introducing double positioning patterns and texture matching algorithms, the anti-counterfeiting performance and recognition accuracy of two-dimensional codes are significantly improved; by using frequency domain information embedding and multi-feature comprehensive evaluation methods, the authenticity of two-dimensional codes can be stably identified in complex environments, thus providing an efficient, reliable and low-cost solution for item traceability and anti-counterfeiting. BRIEF DESCRIPTION OF THE DRAWINGS
[0082] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the following drawings are only some embodiments of the present invention. For those skilled in the art, without creative efforts, other drawings can be obtained based on these drawings.
[0083] Figure 1 It is a schematic diagram of some anti-counterfeiting feature textures in the embodiment.
[0084] Figure 2 It is a schematic diagram of various styles of anti-copy two-dimensional codes generated in the embodiment.
[0085] Figure 3 It is a schematic diagram of various selectable positioning patterns in the embodiment.
[0086] Figure 4 It is a design flow chart of the anti-copy two-dimensional code.
[0087] Figure 5 It is a flow chart of the identification method of the anti-copy two-dimensional code. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0088] Combined with the following specific embodiments and drawings, the present invention will be further described in detail. The processes, conditions, experimental methods, etc. for implementing the present invention, except for the specifically mentioned content below, are all general knowledge and common general knowledge in the art, and the present invention has no special restrictive content.
[0089] The present invention discloses an anti-copy two-dimensional code. The first layer of information of the anti-copy two-dimensional code uses a known publicly disclosed two-dimensional code. In this embodiment, a Quick Response Code (QR code) is used, and its positioning patterns, alignment patterns and other functional patterns are kept consistent, so that the first layer of publicly disclosed two-dimensional code can be recognized by existing hardware or software scanners.
[0090] The method for generating the second-layer copy detection information is to replace all or part of the black modules and / or all or part of the areas of a known publicly available QR code with specific anti-counterfeiting feature textures; and / or modulate and embed the copy detection information onto the high-frequency components of the first-layer publicly available QR code.
[0091] The second-layer copy detection information includes a set of specific anti-counterfeiting feature textures and data encoding. The set of anti-counterfeiting feature textures refers to a set of anti-counterfeiting feature textures with q elements (anti-counterfeiting feature textures). In this embodiment, q = 5 is taken. Figure 1 Five kinds of anti-counterfeiting feature textures are given. The pixel size of each texture is 12×12, and the density of black pixels in a single texture is 42%. In actual operation, one or more of these textures are selected to construct the set of anti-counterfeiting feature textures.
[0092] The data encoding of the second-layer copy detection information refers to using the texture number of the anti-counterfeiting feature texture for replacement as the encoding. In this embodiment, Figure 1 textures (a) and (d) are taken, which represent 0 and 1 in binary form respectively; the data after encryption and error correction coding is a binary data stream.
[0093] The method for replacing modules of the second-layer copy detection information:
[0094] In a specific embodiment, the black modules of the first-layer publicly available QR code are replaced one by one with anti-counterfeiting feature textures, including the positioning pattern and alignment pattern of the original QR code. The finally generated anti-copy QR code is as shown in Figure 2 (a). The QR code uses version 2, error correction level L, the copy detection information is 200 bits, the original image resolution is 600 ppi, and it is printed by a printing press with a maximum resolution of 1200 dpi on coated paper.
[0095] In a specific embodiment, the black data modules of the first-layer publicly available QR code are replaced with anti-counterfeiting feature textures, excluding the positioning pattern of the original QR code. The finally generated anti-copy QR code is as shown in Figure 2 (b). The QR code uses version 2, error correction level L, the copy detection information is 108 bits, the original image resolution is 600 ppi, and it is printed by a printing press with a maximum resolution of 1200 dpi on coated paper.
[0096] In a specific embodiment, by using the error tolerance rate of the first-layer publicly available QR code, the data modules in the central area of the QR code are removed and the texture modules of the second-layer copy detection information are embedded. The texture modules and the data modules of the publicly available QR code have different pixel sizes. The finally generated anti-copy QR code is as shown in Figure 2As shown in Figure (c), the QR code uses version 4, error correction level H, the copy detection information is 16 bits, the original image resolution is 600 ppi, and it is printed by a printing press with a maximum resolution of 1200 dpi on coated paper.
[0097] In a specific embodiment, the anti-counterfeiting feature texture is used to replace the black data modules of the first-layer public QR code, excluding the positioning patterns of the original QR code, and a positioning frame is added around the QR code. The finally generated anti-copying QR code is as Figure 2 As shown in Figure (d), the QR code uses version 2, error correction level L, the copy detection information is 108 bits, the original image resolution is 600 ppi, and it is printed by a printing press with a maximum resolution of 1200 dpi on coated paper.
[0098] In a specific embodiment, a single positioning pattern design is adopted, such as Figure 3 As shown in Figure (a), the positioning pattern of the first-layer QR code is used;
[0099] In a specific embodiment, a double positioning pattern design is adopted, such as Figure 3 As shown in Figure (b), a square positioning frame with a width of 1 - 10 pixels is added at a certain distance between the edge of the anti-copying QR code and the QR code; or, as Figure 3 As shown in Figure (c), the frame-shaped positioning points at the edge of the anti-copying QR code or the copy detection information module;
[0100] In a specific embodiment, a double positioning pattern design is adopted, such as Figure 3 As shown in Figure (d), a square positioning frame and positioning points with a width of 1 - 10 pixels are added at a certain distance between the edge of the second-layer copy detection information module and the copy detection information module.
[0101] In a specific embodiment, for the anti-copying QR code as shown in Figure 2 after physical printing and taken by an imaging device (such as a smartphone camera, scanner, etc.), the following method is then used to identify its authenticity.
[0102] The first step: The input image taken is first grayscaled, sharpened, and binarized to obtain a binary image M2.
[0103] The second step: The method for obtaining the image matrix of the anti-copying QR code and the image matrix of the copy detection information is selected from one or more of the following methods:
[0104] In a specific embodiment, the corner points of the positioning pattern of the QR code in the first layer are used, and the perspective transformation is performed according to the corner points to restore the image matrix. The QR code contains three positioning patterns, and the positioning patterns present a "return" shape. The ratio of black and white modules from left to right is 1:1:3:1:1. (1) Find the black blocks in the binary image M2 that conform to the above ratio in the horizontal direction; (2) Use the same method to find the vertical lines that meet the above ratio in the vertical direction to obtain a set of candidate positioning corner points; use the angle and area relationship of the triangle formed by three points to determine the order of the positioning corner points; use the intersection of the connection lines of the lower left and upper right corner points to determine the lower right corner point. Through the four corner points, a perspective transformation is performed on the binary image M2 to extract the QR code area. The original image input by the imaging device is scaled so that the image size is normalized to a resolution of 600 ppi. Then, the image matrix of the copy detection information is extracted according to the relative position of the QR code and the copy detection information in the second layer.
[0105] In a specific embodiment, at the edge of the generated anti-copy QR code or copy detection information module, a square positioning frame or positioning points are adopted. The Hough transform and Canny edge detection are performed on the input binary image M2, and the four vertices of the square are calculated as the required corner points. According to the corner points, the perspective transformation is performed to restore the image matrix of the copy detection information, and the positioning accuracy rate reaches 100%.
[0106] The third step is to decode the image matrix of the extracted copy detection information. The decoding of the first layer can be recognized by any standard QR code scanner. The texture pattern matching algorithm is used in the decoding process of the copy detection information in the second layer. Specifically: Figure 1 Based on the anti-counterfeiting feature texture electronic images of (a) and (e) in the shown texture set, the image matrix of the copy detection information is scanned. For the texture module P i , the Pearson correlation coefficients between it and the textures (a) and (e) are calculated respectively, and the binary copy detection information is decoded.
[0107] The fourth step: The method for authenticating the authenticity of the copy detection information in the second layer.
[0108] In a specific embodiment, the correlation and error rate between the physical printed image and the original copy detection information image are used for authentication.
[0109] Select a smart phone to capture and collect the original anti-copy QR code and its copy. The same printed piece is photographed 5 times, and the angle selected each time is slightly different. After decoding to obtain the Pearson correlation coefficients, the maximum and minimum values are removed, and the remaining values are averaged. The correlation coefficient range of the original is [0.261, 0.3852], and the correlation coefficient range of the copy is [0.191, 0.255]. The value of the correlation coefficient of the original is always higher than that of the copy.
[0110] Two-dimensional codes as unique identifiers of items have been widely used and are printed on the surface of objects or on the packaging of items. However, existing public two-dimensional codes (such as Quick Response Codes (QR codes), Datamatrix, etc.) themselves cannot prevent replication, which allows criminals and illegal merchants to easily produce replicas of items. For example, forging official documents and contracts printed on paper, manufacturing fake and shoddy goods, and so on. How to use two-dimensional codes as unique identifiers to identify whether the above items are originals or replicas is a worldwide technical problem that has not been solved yet.
[0111] The present invention proposes a method for manufacturing and a method for authenticating a two-dimensional code that can achieve anti-replication, and the anti-replication two-dimensional code is fully compatible with existing public two-dimensional codes. The anti-replication two-dimensional code has two layers of information. The public two-dimensional code as its first layer of information can be recognized by existing scanners. The second layer of replication detection information is to replace all or part of the black modules and / or all or part of the areas of the public two-dimensional code with anti-counterfeiting feature textures; and / or, modulate and embed in the high-frequency components of the known public two-dimensional code.
[0112] And the present invention provides a method for authenticating the authenticity of the anti-replication two-dimensional code by using an imaging device. It includes: a method for positioning the anti-replication two-dimensional code, a method for obtaining the image matrix of the anti-counterfeiting feature texture, a method for decoding the anti-counterfeiting feature texture, and a method for authenticating the authenticity of the replication detection information.
[0113] The method for authenticating the authenticity of the replication detection information further includes: a method for calculating the threshold of the difference in correlation coefficients of the anti-counterfeiting texture, which sets a threshold standard for distinguishing between the printed original and the replica of the two-dimensional code; a method for distinguishing authenticity by using the peak points irregularly distributed in the frequency spectrum diagram of the input anti-replication two-dimensional code captured; a method for comprehensively evaluating multiple features of the input two-dimensional code image by using a machine learning model; a method for detecting the high-frequency components of the replication detection information embedded in the first layer of public two-dimensional code.
[0114] Pattern design, generation method, decoding method, and authentication method for distinguishing originals and replicas of anti-replication two-dimensional codes.
[0115] In terms of two-dimensional code design, in order to improve the recognition accuracy, the present invention additionally designs a method for positioning double patterns, adds a positioning frame and / or positioning points around the two-dimensional code or replication detection information, uses Hough transform and Canny transform for precise positioning, and uses perspective transform to restore the image matrix.
[0116] The present invention provides four methods for authenticating the authenticity of the replication detection information. Since using only a single method may not accurately define the authenticity of the replication detection information, multiple methods can be used simultaneously for comprehensive authentication in actual cases.
[0117] A dynamic calculation method for defining a threshold standard to distinguish between original and replicated items is defined.
[0118] The present invention designs an anti-counterfeiting two-dimensional code with two layers of information. The publicly available two-dimensional code, which is the first layer of information, can be recognized by existing scanners, achieving compatibility with the widely used two-dimensional codes. The second layer of replication detection information replaces all or part of the black modules, and / or all or part of the areas of the publicly available two-dimensional code with anti-counterfeiting feature textures; and / or, modulates and embeds in the high-frequency components of the known publicly available two-dimensional code. The second layer of information is used to authenticate the authenticity of the two-dimensional code, enabling the two-dimensional code to have the function of distinguishing between the original and the replicated items.
[0119] The present invention provides a method for authenticating the authenticity of an anti-counterfeiting two-dimensional code using an imaging device. It includes:
[0120] (1) An anti-counterfeiting two-dimensional code positioning method. The present invention adopts a double positioning pattern design, which can accurately locate the publicly available two-dimensional code of the first layer and the replication detection information of the second layer.
[0121] (2) The present invention provides a method for obtaining the image matrix of the anti-counterfeiting feature texture, which can accurately extract the image matrix of the anti-counterfeiting feature texture from the two-dimensional code image captured by the imaging device.
[0122] (3) The present invention provides encoding and decoding methods for the anti-counterfeiting feature texture.
[0123] (4) The present invention provides various methods for authenticating the authenticity of replication detection information. It includes: a threshold calculation method for the difference in correlation coefficients of anti-counterfeiting textures, which sets a threshold standard for distinguishing between the printed original and replicated two-dimensional codes; a method for distinguishing authenticity using the peak points irregularly distributed in the frequency spectrum diagram of the input anti-counterfeiting two-dimensional code captured; a method for comprehensively evaluating multiple features of the input two-dimensional code image using a machine learning model; a method for detecting the high-frequency components of the replication detection information embedded in the first-layer publicly available two-dimensional code. The present invention proposes to comprehensively authenticate the replication detection information using the above methods, enabling effective and accurate distinction between the original and the replicated items from the captured image.
[0124] The protection scope of the present invention is not limited to the above embodiments. Without departing from the spirit and scope of the inventive concept, all changes and advantages that those skilled in the art can think of are included in the present invention, and the scope of protection is defined by the appended claims.
Claims
1. An anti-copying QR code, characterized in that, The two-dimensional code is a two-dimensional code in which all or part of the black modules and / or all or part of the areas in a known publicly available two-dimensional code are replaced by anti-counterfeiting feature textures; and / or, a second-layer copy detection information is modulated and embedded in the high-frequency components of the known publicly available two-dimensional code; The anti-counterfeiting feature textures include one or more, which contain copy detection information; The pixel size of the anti-counterfeiting feature textures is greater than or equal to 1×1 and less than or equal to 12×12; The density of black pixels in the anti-counterfeiting feature textures is greater than or equal to 40% and less than or equal to 70%.
2. The two-dimensional code according to claim 1, characterized in that, Anti-counterfeiting dot matrices are set around the replaced partial areas and / or around the known publicly available two-dimensional code.
3. A method for generating an anti-copying QR code as claimed in claim 1, characterized in that, The generation method includes the following steps: Step 1, generate a first-layer publicly available two-dimensional code by using an encoding method compatible with the existing publicly available two-dimensional code; Step 2, fuse the second-layer copy detection information to generate the anti-copy two-dimensional code; The fusion method of the second-layer copy detection information includes: Using anti-counterfeiting feature textures to replace all or part of the black modules and / or all or part of the areas of the first-layer publicly available two-dimensional code; and / or, Modulating and embedding the second-layer copy detection information on the high-frequency components of the first-layer publicly available two-dimensional code.
4. The generation method according to claim 3, wherein In Step 1, the first-layer publicly available two-dimensional code uses encoding methods including QR code, DataMatrix code, and PDF417 code, and keeps the function patterns including position tags, positioning patterns, and alignment patterns consistent.
5. The generation method according to claim 3, characterized in that, In Step 2, the second-layer copy detection information includes an anti-counterfeiting feature texture set and data encoding; The anti-counterfeiting feature texture set contains q anti-counterfeiting feature textures; the pixel size of the anti-counterfeiting feature textures is greater than or equal to 1×1 and less than or equal to 12×12; and, the density of black pixels of the anti-counterfeiting feature textures is greater than or equal to 40% and less than or equal to 70%; and, the number of the anti-counterfeiting feature textures is less than or equal to 16; The data encoding means using the texture numbers of the anti-counterfeiting feature textures to be replaced as encoding, representing the texture numbers with 0 to (q - 1) in base q respectively, and replacing all or part of the black modules and / or all or part of the areas of the publicly available two-dimensional code.
6. The generation method according to claim 3, characterized in that In Step 2, the method of module replacement includes: Replace all or part of the black modules in the first-layer public two-dimensional code with anti-counterfeiting feature textures. Denote the total number of modules in the first-layer public two-dimensional code as N 2 , the number of replaced black modules is pieces, the ratio of the effective information bits in the error correction code is k / n, and store bits of q-ary data; or Embedding texture modules containing one or more anti-counterfeiting feature textures with different pixel sizes from the data modules of the first-layer publicly available two-dimensional code into the area including the central area of the first-layer publicly available two-dimensional code.
7. The generation method according to claim 3, wherein In Step 2, modulating and embedding the second-layer copy detection information on the high-frequency components of the first-layer publicly available two-dimensional code includes the following steps: Normalize the grayscale values of the first-layer public QR code and the second-layer copy detection information respectively, and then perform Fourier or DCT transformation on the first-layer public QR code information and the second-layer copy detection information respectively to obtain the frequency domain graphs F layer1 and F layer2 , according to F layer1 Create a mask to retain the low-frequency part of the first-layer public QR code, and embed the frequency domain information of the second-layer copy detection information into the high-frequency part of F layer1 , then perform inverse Fourier transform and binarization.
8. The generation method according to claim 3, characterized in that, After Step 2, it may further include setting anti-counterfeiting dot matrices around the replaced partial areas and / or around the known publicly available two-dimensional code to form a double positioning pattern to improve the anti-copy performance of the two-dimensional code; The double positioning pattern includes: The positioning pattern of the known first-layer publicly available two-dimensional code, and adding a square positioning frame or positioning point with a width of 1 to 10 pixels at a position 1 - 20 pixels away from the edge of the generated anti-copy two-dimensional code to the two-dimensional code; or, The known positioning pattern of the first-layer public QR code, and a square positioning frame and positioning points with a width of 1 to 10 pixels are added at a position 1 - 10 pixels between the edge of the second-layer copy detection information module and the copy detection information module.
9. A detection method for anti-copying QR codes as described in claim 1, characterized in that, The detection method detects and identifies whether it is the original QR code by performing graphic and imaging processing on the QR code image captured by the imaging device; it includes the following steps: Step A: Locate the anti-copying QR code through the positioning pattern, and extract the image matrix of the anti-copying QR code to be identified and the image matrix of the copy detection information; Step B: Perform texture module and texture set matching on the obtained image matrix of the copy detection information, and decode the copy detection information; Step C: Detect and identify the authenticity of the decoded copy detection information.
10. The detection method according to claim 9, characterized in that, Before step A, it also includes correcting the captured QR code through perspective transformation; The formula of the perspective transformation is shown as follows: Among them, the coordinate vector on the left side of the equation is the coordinate vector after perspective transformation, and the right side of the equation is the input original coordinate vector and the perspective transformation matrix.
11. The detection method according to claim 9, wherein In step A, the acquisition of the image matrix of the anti-copying QR code and the image matrix of the copy detection information includes the following steps: Restore the image matrix of the anti-copying QR code through QR code corner point positioning, and extract the image matrix of the copy detection information according to the relative position between the first-layer public QR code and the second-layer copy detection information; Or, Restore the image matrix of the anti-copying QR code through QR code corner points and the positioning frame and / or positioning points on the outer edge of the QR code, and extract the image matrix of the copy detection information according to the relative position between the first-layer public QR code and the second-layer copy detection information; Or, Restore the image matrix of the anti-copying QR code through QR code corner points and the positioning frame and / or positioning points on the outer edge of the copy detection information, and extract the image matrix of the copy detection information according to the relative position between the first-layer public QR code and the second-layer copy detection information.
12. The detection method according to claim 9, characterized in that, In step B, calculate and extract the texture closest to the original anti-counterfeiting feature texture in the second-layer copy detection information through the texture pattern matching algorithm, and perform reconstruction; The texture pattern matching algorithm includes the following: Using q anti-counterfeiting feature textures q(x) in the texture set, where x = 1...q, as the reference for pattern matching, scan each texture module of the second-layer replicated detection information one by one. For texture module P i , calculate the Pearson correlation coefficient between it and each texture in the anti-counterfeiting feature texture set, select the largest one among the q as the matching feature pattern, and use its corresponding data encoding as the q-ary encoding q_ary(i) obtained by decoding; q_ary(i) = max(cor(q(x), P i )), x = 1…q, Among them, q_ary(i) represents the matching result of the texture module P i , indicating the number of the anti-counterfeiting feature texture q(x) that best matches P i ; cor(q(x), P i ) represents the Pearson correlation coefficient between the anti-counterfeiting feature texture q(x) and the current image texture module P i , which is used to measure the similarity between the two; And / or, decode the anti-counterfeiting dot matrix embedded in the blank area around the second-layer copy detection information and / or the first-layer public QR code: Decode the information by identifying the dots with different grayscales, positions, directions, and shapes that make up the anti-counterfeiting dot matrix.
13. The detection method according to claim 9, characterized in that, Step C uses one or more identification methods to detect and identify the copy detection information, and the identification methods include the following: According to the preset threshold, calculate the correlation and bit error rate between the physical printed image and the original copy detection information image, and identify the copy detection information; er ≤ Th e ,er > Th e , Among them, the copy detection information image of the original texture structure is X, and its corresponding once-scanned-and-printed version is Then NP and Ns are noises brought by printing and scanning; Th is a preset correlation threshold; When the calculation result of the correlation satisfies h0, the input image is a physical picture printed only once; if the calculation result of the correlation satisfies h1, the input image is a copy scanned and printed at least twice; The bit error rate is calculated as follows: Th e is a preset bit error rate threshold; when the bit error rate result satisfies er ≤ Th e the input image is a physical picture printed only once; if the bit error rate result satisfies er > Th e the input image is a copy scanned and printed at least twice; Or, Identify the copy detection information based on whether there are peak points with irregular distributions in the spectrogram of the input QR code image; perform Gaussian filtering preprocessing on the QR code image to remove noise, calculate the peak points in the normal frequency-domain graph obtained after frequency-domain transformation, and then compare them with the actually measured peak points. If there are additional peaks or unmatched peaks, the actually measured QR code spectrum comes from a forged QR code; Or, Use a support vector regression machine learning model to perform multi-feature comprehensive evaluation of the input image evaluation features of the input QR code image; Extract the evaluation features of the input image collected by the imaging device, including the overall re-blurring DCT ratio, the difference in re-blurring kurtosis, the difference in re-blurring skewness, the mean value of DCT entropy values at different blurring scales, the block re-blurring DCT ratio, the ratio of the standard deviation to the mean value of DCT coefficients, the variances in different directions of DCT, the mean value of the re-blurring gradient map, the difference in re-blurring total variation, and the Pearson correlation coefficient; the training data set T is expressed as x i represents the input of the i-th sample; y i is the regression value of the i-th sample; n represents the dimension of the feature; the sample is non-linearly mapped and the feature vector after that is denoted as The sample is a training picture with true or false labels; Then, select different kernel functions respectively, obtain the optimal model parameters after training through repeated cross-validation, train a support vector regression model, and perform authenticity detection of the input QR code image through the support vector regression model; Or, Based on the first-layer publicly disclosed QR code and the anti-copy QR code embedded with copy detection information obtained by the above method, calculate the maximum usage frequency and the maximum achievable frequency, and thus calculate the printed pixel resolution; For the anti-copy QR code image of the input embedded copy detection information, calculate F through Fourier or DCT transform layer2 , and then restore the original second-layer copy detection information through the inverse transform of Fourier or DCT; verify and detect the restored second-layer copy detection information.
14. The detection method according to claim 13, wherein The preset threshold is obtained by making multiple prints and replicas of the same anti-counterfeiting feature texture, measuring the threshold of the texture image after scanning and printing, calculating the average value, and then calculating the average threshold between the original and the replica as the standard threshold for distinguishing the original from the replica.
15. The detection method according to claim 13, wherein Obtain the spectrogram through convolution, and the peak points in the normal frequency-domain graph are obtained by the following formula: Among them, M G (x) represents the original QR code image with an input size of k c l c pixels, Δx represents the vector offset error between the printing process and the shooting process, and the imaging process during shooting is modeled as a convolution operation The original anti-copy QR code image M with an offset of Δx G is convolved with a low-pass filter F c with a kernel parameter vector γ lp (·); the shooting process consists of a two-dimensional Dirac δ function and sampling vectors d c and e c where the sampling vectors represent the direction of image sampling and the size of pixels during the shooting process, respectively.
16. The application of the anti-copy QR code according to claim 1 or 2, the method for generating the anti-copy QR code according to any one of claims 3-8, or the method for detecting the anti-copy QR code according to any one of claims 9-15 in commodity anti-counterfeiting, intelligent packaging, logistics tracking, supply chain management traceability, printed documents, and digital copyright protection.
Citation Information
Patent Citations
Method for robust asymmetric modulation spatial marking with spatial sub-sampling
US7492920B2
Method for preventing counterfeiting or alteration of a printed or engraved surface
US7684088B2
Method to apply an invisible mark on a media
US7965862B2
Cited By
QR two-dimensional code anti-counterfeiting method and QR two-dimensional code anti-counterfeiting system
CN122113975A
Methods and systems for generating and detecting Anti-copy two-dimensional code, storage medium, and electronic device
WO2026179396A1