A dual-stage QR code anti-counterfeiting authentication method and system
By calculating the texture patterns of the double-order QR codes and setting the authentication threshold dynamically, the problem of low anti-counterfeiting authentication of double-order QR codes in the prior art is solved, and higher accuracy and robustness are achieved.
Patent Information
- Application Number
- CN202210346774.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-02
- Publication Date
- 2025-04-18
- Estimated Expiration
- 2042-04-02
AI Technical Summary
In the prior art, the anti-counterfeiting authentication accuracy of double-order QR codes is low, mainly due to the use of the same authentication threshold, which leads to a large threshold deviation.
By performing Tamura roughness calculation on the scanned texture pattern of the double-order QR code, a personalized authentication threshold is dynamically calculated to improve the accuracy and robustness of authentication.
It effectively improves the accuracy and robustness of the anti-counterfeiting authentication of double-order QR codes, avoids the problem of large threshold deviation, and enhances the ability to identify the authenticity of double-order QR codes.
Smart Images

Figure CN114742189B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of multimedia image security anti-counterfeiting, and more specifically, to an anti-counterfeiting authentication method and system for a dual-stage two-dimensional code. Background Art
[0002] With the rapid development of Internet of Things technology, the use scenarios of QR code technology have become more and more extensive. Due to the significant advantages of QR code technology such as fast recognition, large storage capacity of information, and low cost relative to radio frequency identification technology; QR code technology is currently widely used in the following scenarios: mobile payment, document authentication, product traceability and other fields. QR code technology mainly studies how to represent information with QR codes. However, due to the rapid development of high-precision printing and scanning equipment, the cost of copying or forging QR codes is getting lower and lower. The forged QR code obtained by copying greatly reduces the data security in the field using QR code technology, thereby reducing the security and reliability of systems such as product traceability and document authentication. Therefore, studying anti-counterfeiting QR codes to counteract the counterfeiting of QR codes by criminals is a very meaningful research topic. It has a far-reaching impact on the security issues of QR code technology applications in various fields such as mobile payment, document authentication, and product traceability, especially on low-cost anti-counterfeiting applications.
[0003] The prior art discloses a method for generating a two-order two-dimensional code and an anti-copying verification method thereof. The anti-copying verification method includes inputting a two-order two-dimensional code and performing texture classification to obtain a pattern matched into a texture pattern pair; using the texture pattern pair to calculate a correlation coefficient; comparing the correlation coefficient with a verification threshold to complete the anti-copying verification of the two-order two-dimensional code; the application uses the same authentication threshold for different two-order two-dimensional codes, resulting in a large threshold deviation and a low anti-counterfeiting authentication accuracy problem. Summary of the invention
[0004] In order to overcome the defect of low accuracy of the above-mentioned prior art two-level two-dimensional code anti-counterfeiting authentication, the present invention provides a two-level two-dimensional code anti-counterfeiting authentication method and system, which uses the Tamura roughness of the texture pattern after the two-level two-dimensional code is printed and scanned to calculate the authentication threshold of the anti-counterfeiting authentication, better reflect the information loss in the two-level two-dimensional printing and scanning process, and improve the accuracy and robustness of the authentication method.
[0005] In order to solve the above technical problems, the technical solution of the present invention is as follows:
[0006] The present invention provides an anti-counterfeiting authentication method for a dual-stage two-dimensional code, comprising:
[0007] S1: Generate a dual-level QR code based on an existing texture pattern set;
[0008] S2: Print and scan the dual-order two-dimensional code twice to obtain first data and second data;
[0009] S3: performing texture classification on the first data and the second data, and calculating the Tamura roughness of the classification results;
[0010] S4: Calculate the certification threshold based on the Tamura roughness of the classification result;
[0011] S5: Scan the dual-level QR code to be authenticated, extract its texture pattern, and calculate the Tamura roughness mean value of the dual-level QR code to be authenticated;
[0012] S6: Compare the Tamura roughness mean value of the dual-level QR code to be authenticated with the authentication threshold to complete the anti-counterfeiting authentication.
[0013] The present invention generates a two-order two-dimensional code based on a texture pattern set. After the two-order two-dimensional code is printed and scanned, the Tamura roughness of the texture pattern is used to calculate the authentication threshold of the two-order two-dimensional code anti-counterfeiting authentication. Compared with the prior art, the Tamura roughness is used instead of the correlation coefficient to better reflect the information loss generated in the printing and scanning process of the two-order two-dimensional code, and improve the problem of small difference between true and false samples of the correlation coefficient. In addition, a corresponding authentication threshold is calculated for each two-order two-dimensional code, which effectively avoids the defect of large threshold deviation when different two-order two-dimensional codes are jointly calculated and the same authentication threshold is used in the prior art. Finally, the Tamura roughness mean value of the two-order two-dimensional code to be authenticated is calculated and compared with the authentication threshold, which effectively improves the accuracy and robustness of the two-order two-dimensional code anti-counterfeiting authentication.
[0014] Preferably, in step S1, the specific method of generating a dual-order two-dimensional code according to the existing texture pattern set is:
[0015] S1.1: Generate the original QR code based on the actual information;
[0016] S1.2: Scan the original QR code line by line to obtain the dark modules in the encoding area of the original QR code;
[0017] S1.3: Select an existing texture pattern set according to Replace the dark modules in the original QR code encoding area one by one in the order of generating a dual-level QR code I 0 ;in, Represent the texture pattern set P 0 The first, second and third texture patterns in .
[0018] Preferably, in step S2, the dual-order two-dimensional code is printed and scanned twice, and the specific method for obtaining the first data and the second data is:
[0019] S2.1: Double-stage QR code I 0 Perform the first print and obtain the first paper version of the two-stage QR code Ip1 ;
[0020] S2.2: Double-stage QR code I for the first paper version p1 Perform the first scan to obtain the first scanned version of the two-stage QR code I 1 ;
[0021] S2.3: First electronic version of the two-stage QR code I 1 Print a second time to get the second paper version of the two-stage QR code I p2 ;
[0022] S2.4: For the second paper version of the two-stage QR code I p2 Perform a second scan to obtain the second scanned version of the dual-stage QR code I 2 ;
[0023] S2.5: Scan the first dual-stage QR code I 1 As the first data, the second scanned version of the two-stage QR code I 2 as the second data.
[0024] Preferably, the step S3 specifically includes:
[0025] S3.1: extracting texture patterns of the first data and the second data, and classifying the texture patterns of the first data and the second data respectively, to obtain a first data classification result and a second data classification result;
[0026] S3.2: Calculate the Tamura roughness of the first data classification result and the second data classification result respectively.
[0027] Preferably, the step S3.1 specifically includes:
[0028] Extract all texture patterns in the first data, classify them, and obtain the first data classification result in, and Respectively represent the first scan version of the two-stage QR code I 1 The i-th one is Texture pattern; n 0 ,n 1 ,n 2 are all positive integers;
[0029] Extract all texture patterns in the second data, classify them, and obtain the second data classification result in, and Respectively represent the second scan version of the double-stage QR code I 2 The i-th one is Texture pattern; n 0,n 1 ,n 2 All are positive integers.
[0030] Preferably, the step S3.2 specifically includes:
[0031] S3.2.1: First data classification result P 1 Texture pattern In the example, set the size to 2 k ×2 k active window of pixels;
[0032] S3.2.2: Calculate the average grayscale value of the pixels in the active window. The calculation formula is:
[0033]
[0034] In the formula, A k (x,y) represents the average gray value of the pixel (x,y), and f(a,b) represents the gray level of the pixel (x,y);
[0035] S3.2.3: For each pixel, calculate the average intensity difference between the non-overlapping active windows in the horizontal direction according to its average grayscale value. The calculation formula is:
[0036] E k,h (x,y)=|A k (x+2 k-1 ,y)-A k (x-2 k-1 ,y)|
[0037] In the formula, E k,h (x,y) represents the average intensity difference between active windows that do not overlap horizontally at pixel point (x,y);
[0038] S3.2.4: Calculate the k value when the average strength difference reaches the maximum, and calculate the optimal size based on the obtained k value. The calculation formula is:
[0039] S best (x,y)=2 k
[0040] E k,h (x,y)=E max =max(E 1,h (x,y),E 2,h (x,y),…,)
[0041] S3.2.5: Calculate texture pattern based on optimal size The Tamura roughness is calculated as follows:
[0042]
[0043] In the formula, Represents a texture pattern Tamura roughness, m and n represent the texture pattern Width and height;
[0044] S3.2.6: Using the above method, calculate the texture pattern separately The Tamura roughness of the first data classification result and the Tamura roughness of the second data classification result are obtained.
[0045] Preferably, in step S4, the specific method for calculating the authentication threshold according to the Tamura roughness of the classification result is:
[0046] According to the first data classification result P 1 and the second data classification result P 2 The Tamura roughness of the texture pattern in , and the certification threshold is calculated:
[0047]
[0048] Where TH represents the authentication threshold.
[0049] Preferably, step S5 comprises:
[0050] S5.1: Scan the two-stage QR code to be authenticated and obtain the scanned version of the QR code to be authenticated I t ;
[0051] S5.2: Based on the scanned version of the QR code to be authenticated I t , calculate the mean Tamura roughness of all texture patterns in the dual-order QR code to be authenticated, and the calculation formula is:
[0052]
[0053] In the formula, Indicates the two-stage QR code to be authenticated I t The mean Tamura roughness of all texture patterns in , N represents the dual-level QR code to be authenticated I t The number of texture patterns in PS j represents the jth texture pattern.
[0054] Preferably, in step S6, the Tamura roughness mean value of the dual-order two-dimensional code to be authenticated is compared with the authentication threshold, and the specific method for completing the anti-counterfeiting authentication is:
[0055] Compare the Tamura roughness mean value of the dual-order QR code to be authenticated with the authentication threshold; if the Tamura roughness mean value of the dual-order QR code to be authenticated is greater than the authentication threshold, the dual-order QR code to be authenticated is true; otherwise, the dual-order QR code to be authenticated is false.
[0056] Preferably, the original two-dimensional code is a QR code.
[0057] The present invention also provides a dual-stage two-dimensional code anti-counterfeiting authentication system, based on the above anti-counterfeiting authentication method, comprising:
[0058] A two-dimensional code generation module, used for generating a two-level two-dimensional code according to an existing texture pattern set;
[0059] A two-dimensional code processing module, used for printing and scanning the dual-stage two-dimensional code twice to obtain first data and second data;
[0060] A roughness calculation module, used for performing texture classification on the first data and the second data, and calculating the Tamura roughness of the classification results;
[0061] A certification threshold calculation module is used to calculate the certification threshold according to the Tamura roughness of the classification result;
[0062] The authentication module is used to scan the dual-level QR code to be authenticated, extract its texture pattern, and calculate the Tamura roughness mean value of the dual-level QR code to be authenticated;
[0063] The comparison module is used to compare the Tamura roughness mean value of the dual-order two-dimensional code to be authenticated with the authentication threshold to complete the anti-counterfeiting authentication.
[0064] Compared with the prior art, the technical solution of the present invention has the following beneficial effects:
[0065] The present invention generates a two-order two-dimensional code based on a texture pattern set; after the two-order two-dimensional code is printed and scanned twice, the authentication threshold of the two-order two-dimensional code is calculated using the Tamura roughness of the texture pattern; compared with the prior art, the Tamura roughness is used instead of the correlation coefficient, which better reflects the information loss generated in the printing and scanning process of the two-order two-dimensional code, and improves the problem of small difference between true and false samples of the correlation coefficient; and the corresponding authentication threshold is calculated for each two-order two-dimensional code, which effectively avoids the defect of large threshold deviation when different two-order two-dimensional codes are calculated together and the same authentication threshold is used in the prior art; finally, the Tamura roughness mean of the authenticated two-order two-dimensional code is calculated and compared with the authentication threshold, which effectively improves the accuracy and robustness of the anti-counterfeiting authentication of the two-order two-dimensional code. BRIEF DESCRIPTION OF THE DRAWINGS
[0066] Figure 1 This is a flow chart of the anti-counterfeiting authentication method of a dual-stage QR code described in Example 1.
[0067] Figure 2 The texture pattern described in Example 2 is concentrated Schematic diagram of the texture pattern.
[0068] Figure 3 The texture pattern described in Example 2 is concentrated Schematic diagram of the texture pattern.
[0069] Figure 4 The texture pattern described in Example 2 is concentrated Schematic diagram of the texture pattern.
[0070] Figure 5 Schematic diagram of the dual-order two-dimensional code described in Example 2.
[0071] Figure 6 Schematic diagram of the double printing and scanning process of the dual-stage two-dimensional code described in Example 2.
[0072] Figure 7 This is a schematic structural diagram of a dual-stage two-dimensional code anti-counterfeiting authentication system described in Example 3. DETAILED DESCRIPTION
[0073] The drawings are for illustrative purposes only and should not be construed as limiting the present patent;
[0074] In order to better illustrate the present embodiment, some parts in the drawings may be omitted, enlarged or reduced, and do not represent the size of the actual product;
[0075] It is understandable to those skilled in the art that some well-known structures and their descriptions may be omitted in the drawings.
[0076] The technical solution of the present invention is further described below in conjunction with the accompanying drawings and embodiments.
[0077] Example 1
[0078] This embodiment provides a dual-stage two-dimensional code anti-counterfeiting authentication method, such as Figure 1 As shown, including:
[0079] S1: Generate a dual-level QR code based on an existing texture pattern set;
[0080] S2: Print and scan the dual-order two-dimensional code twice to obtain first data and second data;
[0081] S3: performing texture classification on the first data and the second data, and calculating the Tamura roughness of the classification results;
[0082] S4: Calculate the certification threshold based on the Tamura roughness of the classification result;
[0083] S5: Scan the dual-level QR code to be authenticated, extract its texture pattern, and calculate the Tamura roughness mean value of the dual-level QR code to be authenticated;
[0084] S6: Compare the Tamura roughness mean value of the dual-level QR code to be authenticated with the authentication threshold to complete the anti-counterfeiting authentication.
[0085] This embodiment generates a two-level two-dimensional code based on a texture pattern set. After the two-level two-dimensional code is printed and scanned, the Tamura roughness of the texture pattern is used to calculate the authentication threshold of the two-level two-dimensional code anti-counterfeiting authentication. Compared with the prior art, the Tamura roughness is used instead of the correlation coefficient to better reflect the information loss generated in the printing and scanning process of the two-level two-dimensional code, and improve the problem of small difference between true and false samples of the correlation coefficient. In addition, a corresponding authentication threshold is calculated for each two-level two-dimensional code, which effectively avoids the defect of large threshold deviation when different two-level two-dimensional codes are calculated together and the same authentication threshold is used in the prior art. Finally, the mean Tamura roughness of the two-level two-dimensional code to be authenticated is calculated and compared with the authentication threshold, which effectively improves the accuracy and robustness of the two-level two-dimensional code anti-counterfeiting authentication.
[0086] Example 2
[0087] This embodiment provides a dual-stage two-dimensional code anti-counterfeiting authentication method, including:
[0088] S1: Generate a two-level QR code based on an existing texture pattern set, specifically:
[0089] S1.1: Generate the original QR code based on the actual information;
[0090] S1.2: Scan the original QR code line by line to obtain the dark modules in the encoding area of the original QR code;
[0091] S1.3: Select an existing texture pattern set according to Replace the dark modules in the original QR code encoding area one by one in the order of generating a dual-level QR code I 0 ;in, Represent the texture pattern set P 0 The first, second, and third texture patterns in Figure 2 , Figure 3 , Figure 4 As shown, the generated two-stage QR code I 0 like Figure 5 As shown;
[0092] S2: Print and scan the dual-stage two-dimensional code twice to obtain first data and second data; Figure 6 As shown, the specific method is:
[0093] S2.1: Double-stage QR code I 0 Perform the first print and obtain the first paper version of the two-stage QR code I p1 ;
[0094] S2.2: Double-stage QR code I for the first paper version p1 Perform the first scan to obtain the first scanned version of the two-stage QR code I 1 ;
[0095] S2.3: First electronic version of the two-stage QR code I 1 Print a second time to get the second paper version of the two-stage QR code I p2 ;
[0096] S2.4: For the second paper version of the two-stage QR code I p2 Perform a second scan to obtain the second scanned version of the dual-stage QR code I 2 ;
[0097] S2.5: Scan the first dual-stage QR code I 1 As the first data, the second scanned version of the two-stage QR code I 2 As the second data;
[0098] S3: performing texture classification on the first data and the second data, and calculating the Tamura roughness of the classification results;
[0099] S3.1: extracting the texture patterns of the first data and the second data, and classifying the texture patterns of the first data and the second data respectively, to obtain the first data classification result and the second data classification result; specifically:
[0100] Extract all texture patterns in the first data, classify them, and obtain the first data classification result in, and Respectively represent the first scan version of the two-stage QR code I 1 The i-th one is Texture pattern; n 0 ,n 1 ,n 2 All are positive integers;
[0101] Extract all texture patterns in the second data, classify them, and obtain the second data classification result in, and Respectively represent the second scan version of the double-stage QR code I 2 The i-th one is Texture pattern; n 0 ,n 1 ,n2 All are positive integers;
[0102] S3.2: Calculate the Tamura roughness of the first data classification result and the second data classification result respectively; specifically:
[0103] S3.2.1: First data classification result P 1 Texture pattern In the example, set the size to 2 k ×2 k active window of pixels;
[0104] S3.2.2: Calculate the average grayscale value of the pixels in the active window. The calculation formula is:
[0105]
[0106] In the formula, A k (x,y) represents the average gray value of the pixel (x,y), and f(a,b) represents the gray level of the pixel (x,y);
[0107] S3.2.3: For each pixel, calculate the average intensity difference between the non-overlapping active windows in the horizontal direction according to its average grayscale value. The calculation formula is:
[0108] E k,h (x,y)=|A k (x+2 k-1 ,y)-A k (x-2 k-1 ,y)|
[0109] In the formula, E k,h (x,y) represents the average intensity difference between active windows that do not overlap horizontally at pixel point (x,y);
[0110] S3.2.4: Calculate the k value when the average strength difference reaches the maximum, and calculate the optimal size based on the obtained k value. The calculation formula is:
[0111] S best (x,y)=2 k
[0112] E k,h (x,y)=E max =max(E 1,h (x,y),E 2,h (x,y),…,)
[0113] S3.2.5: Calculate texture pattern based on optimal size The Tamura roughness is calculated as follows:
[0114]
[0115] In the formula, Represents a texture pattern Tamura roughness, m and n represent the texture pattern Width and height;
[0116] S3.2.6: Using the above method, calculate the texture pattern separately Tamura roughness of the first data classification result and the second data classification result;
[0117] Similar texture patterns can be matched into texture pattern pairs, specifically:
[0118]
[0119] S4: Calculate the certification threshold based on the Tamura roughness of the classification result; the calculation formula is:
[0120]
[0121] In the formula, TH represents the authentication threshold;
[0122] S5: Scan the dual-level QR code to be authenticated, extract its texture pattern, and calculate the Tamura roughness mean value of the dual-level QR code to be authenticated; specifically:
[0123] S5.1: Scan the two-stage QR code to be authenticated and obtain the scanned version of the QR code to be authenticated I t ;
[0124] S5.2: Based on the scanned version of the QR code to be authenticated I t , calculate the mean Tamura roughness of all texture patterns in the dual-order QR code to be authenticated, and the calculation formula is:
[0125]
[0126] In the formula, Indicates the two-stage QR code to be authenticated I t The mean Tamura roughness of all texture patterns in , N represents the dual-level QR code to be authenticated I t The number of texture patterns in PS j represents the jth texture pattern;
[0127] S6: Compare the Tamura roughness mean value of the dual-level QR code to be authenticated with the authentication threshold to complete the anti-counterfeiting authentication; specifically:
[0128] Compare the Tamura roughness mean value of the dual-order QR code to be authenticated with the authentication threshold; if the Tamura roughness mean value of the dual-order QR code to be authenticated is greater than the authentication threshold, the dual-order QR code to be authenticated is true; otherwise, the dual-order QR code to be authenticated is false.
[0129] In the specific implementation process, taking QR code as the original two-dimensional code as an example, the original QR code is generated according to the actual information of the object; the texture pattern set is obtained according to the texture pattern generation principle and selection principle. Scan the dark modules of the original QR code encoding area line by line, and use the texture pattern set P 0 ,according to Replace the dark modules in the original QR code encoding area one by one in the order of generating a dual-level QR code I 0 ;
[0130] Printing dual-level QR code I 0 , obtained the first paper version of the two-stage QR code I p1 , scan to get the first scanned version of the two-stage QR code I 1 ; Then print the first scanned version of the two-level QR code I 1 , get the second paper version of the two-stage QR code I p2 , scan to get the second scan version of the double-stage QR code I 2 ; will I 1 and I 2 as first data and second data;
[0131] Extract the texture features of the first data and classify them to obtain the first data classification result Similarly, the second data classification result is obtained Calculate P 1 and P 2 The Tamura roughness of each texture pattern in the image is calculated, and then the authentication threshold TH is calculated according to the calculated Tamura roughness;
[0132] First paper version of the two-stage QR code I p1 It is used as a normal item identification and circulated in the market; when the QR code on an item needs to be authenticated for anti-counterfeiting, scan it. p1 , get the scanned version of the QR code to be authenticated t ; Calculation I t The mean roughness of the Tamura texture of all texture patterns in
[0133] Compare the mean roughness of the Tamura texture of the QR code to be authenticated and authentication threshold TH, if Then the two-stage QR code to be authenticated is true; if Then the two-stage QR code to be authenticated is false;
[0134] The authentication threshold TH is only applied to the dual-stage QR code I 0 The anti-counterfeiting authentication of the printed version avoids the problem of large threshold deviation when the existing technology calculates a batch of different dual-stage QR codes together and uses the same authentication threshold, greatly improving the accuracy and robustness of anti-counterfeiting authentication.
[0135] Example 3
[0136] This embodiment provides a dual-stage two-dimensional code anti-counterfeiting authentication system, based on the anti-counterfeiting authentication method described in embodiment 1 or 2, such as Figure 7 As shown, including:
[0137] A two-dimensional code generation module, used for generating a two-level two-dimensional code according to an existing texture pattern set;
[0138] A two-dimensional code processing module, used for printing and scanning the dual-stage two-dimensional code twice to obtain first data and second data;
[0139] A roughness calculation module, used for performing texture classification on the first data and the second data, and calculating the Tamura roughness of the classification results;
[0140] A certification threshold calculation module is used to calculate the certification threshold according to the Tamura roughness of the classification result;
[0141] The authentication module is used to scan the dual-level QR code to be authenticated, extract its texture pattern, and calculate the Tamura roughness mean value of the dual-level QR code to be authenticated;
[0142] The comparison module is used to compare the Tamura roughness mean value of the dual-order two-dimensional code to be authenticated with the authentication threshold to complete the anti-counterfeiting authentication.
[0143] The same or similar reference numerals correspond to the same or similar components;
[0144] The terms used in the drawings to describe positional relationships are only used for illustrative purposes and should not be construed as limiting this patent;
[0145] Obviously, the above embodiments of the present invention are merely examples for clearly illustrating the present invention, and are not intended to limit the embodiments of the present invention. For those skilled in the art, other different forms of changes or modifications can be made based on the above description. It is not necessary and impossible to list all the embodiments here. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the claims of the present invention.
Claims
1. A dual-stage QR code anti-counterfeiting authentication method, characterized in that: include: S1: Generate a dual-level QR code based on an existing texture pattern set; S2: Print and scan the dual-order two-dimensional code twice to obtain first data and second data; S3: performing texture classification on the first data and the second data, and calculating the Tamura roughness of the classification results; S3.1: extracting the texture patterns of the first data and the second data, and classifying the texture patterns of the first data and the second data respectively, to obtain the first data classification result and the second data classification result; specifically: Extract all texture patterns in the first data, classify them, and obtain the first data classification result in, and They represent the i-th one in the first scanned version of the two-stage QR code I1. Texture pattern; n0, n1, n2 are all positive integers; Extract all texture patterns in the second data, classify them, and obtain the second data classification result in, and They represent the i-th one in the second scanned version of the two-stage QR code I2. Texture pattern; n0, n1, n2 are all positive integers; S3.2: Calculate the Tamura roughness of the first data classification result and the second data classification result respectively; specifically: S3.2.1: Texture pattern in the first data classification result P1 In the example, set the size to 2 k ×2 k active window of pixels; S3.2.2: Calculate the average grayscale value of the pixels in the active window. The calculation formula is: In the formula, A k (x,y) represents the average gray value of the pixel (x,y), and f(a,b) represents the gray level of the pixel (x,y); S3.2.3: For each pixel, calculate the average intensity difference between the non-overlapping active windows in the horizontal direction according to its average grayscale value. The calculation formula is: AND k,h (x,y)=|A k (x+2 k-1 ,already k (x-2 k-1 ,and)| In the formula, E k,h (x,y) represents the average intensity difference between active windows that do not overlap horizontally at pixel point (x,y); S3.2.4: Calculate the k value when the average strength difference reaches the maximum, and calculate the optimal size based on the obtained k value. The calculation formula is: S best (x,y)=2 k AND k,h (x,y)=E max =max(E 1,h (x,y),E 2,h (x,y),…,) S3.2.5: Calculate texture pattern based on optimal size The Tamura roughness is calculated as follows: In the formula, Represents a texture pattern Tamura roughness, m and n represent the texture pattern Width and height; S3.2.6: Using the above method, calculate the texture pattern separately Tamura roughness of the first data classification result and the second data classification result; S4: Calculate the certification threshold based on the Tamura roughness of the classification result; the calculation formula is: In the formula, TH represents the authentication threshold; S5: Scan the dual-level QR code to be authenticated, extract its texture pattern, and calculate the Tamura roughness mean value of the dual-level QR code to be authenticated; S6: Compare the Tamura roughness mean value of the dual-level QR code to be authenticated with the authentication threshold to complete the anti-counterfeiting authentication.
2. The anti-counterfeiting authentication method of a dual-stage two-dimensional code according to claim 1, characterized in that: In step S1, the specific method for generating a dual-order two-dimensional code according to the existing texture pattern set is: S1.1: Generate the original QR code based on the actual information; S1.2: Scan the original QR code line by line to obtain the dark modules in the encoding area of the original QR code; S1.3: Select an existing texture pattern set according to …in the order of replacing the dark modules in the original two-dimensional code encoding area one by one to generate a two-level two-dimensional code i0; where They respectively represent the first, second, and third texture patterns in the texture pattern set P0.
3. The anti-counterfeiting authentication method of a dual-stage two-dimensional code according to claim 2, characterized in that: In step S2, the dual-order two-dimensional code is printed and scanned twice to obtain the first data and the second data in the following specific method: S2.1: Print the dual-level QR code I0 for the first time to obtain the first paper version of the dual-level QR code I p1 ; S2.2: Double-stage QR code I for the first paper version p1 Perform the first scan to obtain the first scanned version of the two-stage QR code I1; S2.3: Print the first electronic version of the two-level two-dimensional code I1 for the second time to obtain the second paper version of the two-level two-dimensional code I p2 ; S2.4: For the second paper version of the two-stage QR code I p2 Perform a second scan to obtain a second scanned version of the dual-stage QR code I2; S2.5: The first scanned version of the dual-level two-dimensional code I1 is used as the first data, and the second scanned version of the dual-level two-dimensional code I2 is used as the second data.
4. The anti-counterfeiting authentication method of a dual-stage two-dimensional code according to claim 3, characterized in that: The step S5 comprises: S5.1: Scan the two-stage QR code to be authenticated and obtain the scanned version of the QR code to be authenticated I t ; S5.2: Based on the scanned version of the QR code to be authenticated I t , calculate the mean Tamura roughness of all texture patterns in the dual-order QR code to be authenticated, and the calculation formula is: In the formula, Indicates the two-stage QR code to be authenticated I t The mean Tamura roughness of all texture patterns in , N represents the dual-level QR code to be authenticated I t The number of texture patterns in PS j represents the jth texture pattern.
5. The anti-counterfeiting authentication method of a dual-stage two-dimensional code according to claim 4, characterized in that: In step S6, the Tamura roughness mean value of the dual-order two-dimensional code to be authenticated is compared with the authentication threshold, and the specific method for completing the anti-counterfeiting authentication is: Compare the Tamura roughness mean value of the dual-order QR code to be authenticated with the authentication threshold; if the Tamura roughness mean value of the dual-order QR code to be authenticated is greater than the authentication threshold, the dual-order QR code to be authenticated is true; otherwise, the dual-order QR code to be authenticated is false.
6. A dual-stage QR code anti-counterfeiting authentication system, characterized in that: include: A two-dimensional code generation module, used for generating a two-level two-dimensional code according to an existing texture pattern set; A two-dimensional code processing module, used for printing and scanning the dual-stage two-dimensional code twice to obtain first data and second data; The roughness calculation module is used to perform texture classification on the first data and the second data and calculate the Tamura roughness of the classification results, including: Extract the texture patterns of the first data and the second data, and classify the texture patterns of the first data and the second data respectively to obtain the first data classification result and the second data classification result; specifically: Extract all texture patterns in the first data, classify them, and obtain the first data classification result in, and They represent the i-th one in the first scanned version of the two-stage QR code I1. Texture pattern; n0, n1, n2 are all positive integers; Extract all texture patterns in the second data, classify them, and obtain the second data classification result in, and They represent the i-th one in the second scanned version of the two-stage QR code I2. Texture pattern; n0, n1, n2 are all positive integers; The Tamura roughness of the first data classification result and the second data classification result are calculated respectively; specifically: The texture pattern in the first data classification result P1 In the example, set the size to 2 k ×2 k active window of pixels; Calculate the average gray value of the pixels in the active window. The calculation formula is: In the formula, A k (x,y) represents the average gray value of the pixel (x,y), and f(a,b) represents the gray level of the pixel (x,y); For each pixel, the average intensity difference between the non-overlapping active windows in the horizontal direction is calculated according to its average gray value. The calculation formula is: AND k,h (x,y)=|A k (x+2 k-1 ,already k (x-2 k-1 ,and)| In the formula, E k,h (x,y) represents the average intensity difference between active windows that do not overlap horizontally at pixel point (x,y); Calculate the k value when the average strength difference reaches the maximum, and calculate the optimal size based on the obtained k value. The calculation formula is: S best (x,y)=2 k AND k,h (x,y)=E max =max(E 1,h (x,y),E 2,h (x,y),…,) Calculate texture pattern based on optimal size The Tamura roughness is calculated as follows: In the formula, Represents a texture pattern Tamura roughness, m and n represent the texture pattern Width and height; Calculate texture patterns separately Tamura roughness of the first data classification result and the second data classification result; The certification threshold calculation module is used to calculate the certification threshold according to the Tamura roughness of the classification result; the calculation formula is: In the formula, TH represents the authentication threshold; The authentication module is used to scan the dual-level QR code to be authenticated, extract its texture pattern, and calculate the Tamura roughness mean value of the dual-level QR code to be authenticated; The comparison module is used to compare the Tamura roughness mean value of the dual-order two-dimensional code to be authenticated with the authentication threshold to complete the anti-counterfeiting authentication.
Citation Information
Patent Citations
Commodity two-dimensional code anti-fake method and system provided with covering layer and based on background texture feature extraction algorithm
CN104537544A
Method for generating double-order two-dimensional code and anti-copy verification method of double-order two-dimensional code
CN110633774A