A method for checking the authenticity of cigarette package printing products based on QR codes

By encrypting pixel point coordinates on QR code images and embedding digital watermarks, the local correlation and spatial correlation of the image are damaged, and the problem of QR codes being easily copied and decrypted in the prior art is solved, and the accuracy of authenticity and false inspection of cigarette pack products is improved.

CN118967171BActive Publication Date: 2025-05-16TIANJIN ZRP PRINTING TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411172426.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-26
Publication Date
2025-05-16
Estimated Expiration
2044-08-26

AI Technical Summary

Technical Problem

In the prior art, the complexity and difficulty in interpreting QR codes are not high, resulting in easy copying and decryption, which greatly reduces the accuracy of the authenticity of cigarette pack printing products.

Method used

Encrypting the original digital image by changing the coordinates of pixel points, destroying the local and spatial correlations of the image, making the image appear in a noise-like form. Then the encrypted image is chunked, the sum of the center correlation value and edge correlation value of each segmented tile is calculated, and the segmented tile with the top sort is selected to embed digital watermarks. Finally, the pixel difference values ​​of the two different processed QR code images are calculated, converted into decimal numbers, and compared with the standard numbers in the background database to verify the authenticity of the product.

Benefits of technology

It improves the accuracy of the authenticity of cigarette packaging printing products, increases the complexity and difficulty of interpretation of images, prevents the emergence of counterfeit products, and protects consumers' rights and interests.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118967171B_ABST
    Figure CN118967171B_ABST
Patent Text Reader

Abstract

The present invention proposes a method for checking the authenticity of printed cigarette packages based on a two-dimensional code, which relates to the technical field of printing anti-counterfeiting. The method comprises the following steps: encrypting an original digital image by changing the coordinates of pixel points, dividing the encrypted image into blocks, calculating the sum of the center correlation value and the edge correlation value of each segmented image block, selecting W segmented image blocks with the highest sorting order to embed W digital watermarks, performing threshold sampling and binarization calculation within a distribution probability range on the image after embedding the digital watermark, obtaining a first two-dimensional code image, performing threshold sampling and binarization calculation within a distribution probability range on the image before embedding the digital watermark, obtaining a second two-dimensional code image, calculating pixel difference values ​​between the first two-dimensional code image and the second two-dimensional code image, composing the pixel difference values ​​into a binary digital sequence, converting the binary digital sequence into a decimal number, and comparing the result with a standard number in a background database to verify the authenticity of the product.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of printing anti-counterfeiting technology, and in particular to a method for verifying the authenticity of printed cigarette packages based on a two-dimensional code. Background Art

[0002] After encoding the product information and data, the QR code is converted into a two-dimensional arrangement of multiple black and white small squares. It is a square black and white structured grayscale graphic array composed of binary and stored, with pixels of 0 and 255. The QR code is divided into two parts: one part is the functional area, which is used to identify features, including multiple areas, namely position detection images, segmentation areas, positioning graphics, etc.; the other part is the coding area, which contains data, error correction codes, versions and other information. The QR code can recognize most characters such as letters, numbers, and Chinese characters. Different data types constitute different coding modes.

[0003] The QR code can be scanned by a barcode reader to obtain relevant information about the product. For printed cigarette packages, each genuine product has its own unique QR code. Consumers can scan the QR code and send the information back to the central database for verification to determine the authenticity of the product.

[0004] The QR code on the cigarette pack can identify the brand, while the digital watermark is responsible for anti-counterfeiting, points and other functions. Consumers scan the QR code to enter the cigarette brand interface, and can participate in the anti-counterfeiting and marketing of cigarettes by entering the digital watermark.

[0005] QR codes can also be used for product data traceability. In the production process of cigarette packaging printing products, information at each stage can be recorded through QR codes. In this way, once a problem occurs, the source of the problem can be quickly traced back by scanning the QR code, so that it can be solved in time.

[0006] The method for verifying the authenticity of printed cigarette packs based on QR codes mainly includes the following steps:

[0007] Design and generate QR code: During the production process of cigarette package printing products, a unique QR code is designed. This QR code needs to contain relevant information about the cigarette package, such as the brand, production batch, production date, etc. At the same time, this QR code also needs to contain some anti-counterfeiting information, such as an encrypted digital verification code, etc.

[0008] Printing QR code: Print the designed QR code on the cigarette pack. During the printing process, the clarity and accuracy of the QR code must be ensured for subsequent scanning and recognition.

[0009] Establish a database: Establish a database for storing QR code information. This database needs to be able to store all relevant information of the cigarette package and correspond to the QR code.

[0010] Consumers scan QR codes: After purchasing a pack of cigarettes, consumers can scan the QR code on the pack through a mobile phone or other device. After scanning, the device will display relevant information about the pack, such as brand, production batch, production date, etc.

[0011] Verify anti-counterfeiting information: After scanning the QR code, consumers can also enter the digital verification code in the QR code to verify the authenticity of the cigarette package. If the digital verification code is consistent with the information stored in the database, then the cigarette package is authentic; otherwise, the cigarette package is fake.

[0012] Through the above steps, consumers can use the QR code to check the authenticity of the printed products on cigarette packages. At the same time, this method can also prevent the emergence of counterfeit products and protect the rights and interests of consumers.

[0013] However, in the prior art, the complexity and difficulty of interpreting the QR code are not high, which makes it easy to copy and decrypt, greatly reducing the accuracy of authenticity inspection of printed cigarette packages. Summary of the invention

[0014] In order to solve the above technical problems, the present invention proposes a method for verifying the authenticity of printed cigarette packs based on a two-dimensional code, comprising the following steps:

[0015] Step 1: Encrypt the original digital image by changing the coordinates of the pixel points;

[0016] Step 2: Divide the encrypted image in step 1 into blocks to obtain segmented blocks;

[0017] Step 3: Calculate the sum of the center correlation value and the edge correlation value of each segmented image block, sort them in descending order, and select the top W segmented image blocks to embed W digital watermarks;

[0018] Step 4: Perform threshold sampling and binarization calculation within the distribution probability range on the image embedded with the digital watermark to obtain the first two-dimensional code image;

[0019] Step 5: Perform threshold sampling and binarization calculation within the distribution probability range on the image before embedding the digital watermark to obtain a second two-dimensional code image;

[0020] Step 6: Calculate the pixel difference between the first QR code image and the second QR code image, compose the pixel difference value into a binary digital sequence, convert the binary digital sequence into a decimal number, and compare it with the standard number in the background database to verify the authenticity of the product.

[0021] Furthermore, in step 1, the pixel transformation formula is as follows:

[0022]

[0023] Wherein, x and y are the coordinates of the current pixel in the digital image to be encrypted, x′ and y′ are the new coordinates of the pixel obtained after transformation, N is the width of the digital image pixel matrix, and mod is the remainder function.

[0024] Furthermore, in step 3, the central correlation value E1 is defined by the following formula:

[0025]

[0026] The edge association value E2 is defined as follows:

[0027]

[0028] Among them, n is the total number of pixels in each segmented block, p i Represents the probability of correlation mutation of pixel i, satisfying the following conditions:

[0029]

[0030] The sum of the center correlation value and the edge correlation value is calculated for each segmented block, and the blocks are sorted in descending order. The top W segmented blocks are selected to embed W digital watermarks.

[0031] Furthermore, in step 4, the brightness channel of the image embedded with the digital watermark is preprocessed to obtain a normalized brightness value L_n:

[0032] L_n=(L-L_min)*(255 / (L_max-L_min))

[0033] Where L is the original brightness value, L_min and L_max are the minimum and maximum brightness values.

[0034] Furthermore, threshold sampling is performed on each distribution probability range of the image to obtain the best threshold θ in each distribution probability range and calculate the pixel value B of the QR code. i :

[0035] B i =THRESH(I i ,θ)

[0036] The THRESH function is used to binarize the pixel values ​​in the image. For each pixel value I within each distribution probability range, i , set the pixel values ​​in the image that are less than or equal to the optimal threshold θ to 0, and set the pixel values ​​that are greater than the optimal threshold θ to 1, thereby dividing the image into two black and white areas to form a QR code.

[0037] Furthermore, in step 6, the difference coefficient β between the pixel value W(I,J) at the pixel point (I,J) of the image before embedding the digital watermark and the pixel value W'(I,J) at the pixel point (I,J) of the image after embedding the digital watermark is calculated:

[0038]

[0039] Determine whether the difference coefficient β is greater than the minimum difference value. If the difference coefficient β is greater than the minimum difference value, proceed to step 4. If the difference coefficient β is not greater than the minimum difference value, then it is necessary to select the top 2W segmented blocks to embed 2W digital watermarks.

[0040] Furthermore, in the step 2, two random arrays pixels and centers are created, representing the coordinates of the pixel array and the segmentation block center array respectively, and a two-dimensional array distances for storing distances is initialized. Each pixel point and each segmentation block center are traversed through two layers of loops, and the spatial distance between them is calculated.

[0041] Compared with the prior art, the present invention has the following beneficial technical effects:

[0042] The encryption of the original digital image is achieved by changing the coordinates of the pixel points, destroying the local correlation and spatial correlation between the pixels of the original digital image, so that the image appears in a form similar to noise, greatly increasing the complexity and difficulty of interpreting the image, and achieving image encryption.

[0043] The encrypted image is divided into blocks, and the sum of the center correlation value and the edge correlation value of each block is calculated. The spatial correlation between pixels is maintained during the encryption process, thereby avoiding a significant decrease in image quality.

[0044] The image after embedding the digital watermark is subjected to threshold sampling and binarization calculation within the distribution probability range to obtain the first two-dimensional code image, the image before embedding the digital watermark is subjected to threshold sampling and binarization calculation within the distribution probability range to obtain the second two-dimensional code image, the pixel difference values ​​between the first two-dimensional code image and the second two-dimensional code image are calculated, the pixel difference values ​​are combined into a binary digital sequence, the binary digital sequence is converted into decimal numbers, and compared with the standard numbers in the background database to verify the authenticity of the product, thereby improving the accuracy of authenticity inspection of printed cigarette packages. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.

[0046] Figure 1 The present invention is a flow chart of a method for verifying the authenticity of printed cigarette packages based on a two-dimensional code.

[0047] Figure 2 It is a schematic diagram of the digital watermark information of the present invention. DETAILED DESCRIPTION

[0048] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0049] In the drawings of the specific embodiments of the present invention, in order to better and more clearly describe the working principles of the various components in the system, the connection relationship of the various parts in the device is shown, which only clearly distinguishes the relative position relationship between the various components, and cannot constitute a limitation on the signal transmission direction, connection sequence and size, dimensions and shape of the components or structures.

[0050] Example 1

[0051] like Figure 1 As shown, it is a schematic flow chart of a method for verifying the authenticity of printed cigarette packs based on a two-dimensional code according to the present invention, and the method comprises the following steps:

[0052] Step 1: Encrypt the original digital image by changing the coordinates of the pixel points.

[0053] By changing the coordinates of the pixels to encrypt the original digital image, this method can destroy the local correlation and spatial correlation between the pixels of the original digital image, making the digital image appear to be similar to noise. When the number of iterations reaches a certain value, the encrypted digital image will be restored to the original digital image.

[0054] The pixel transformation formula is as follows:

[0055]

[0056] Wherein, x and y are the coordinates of the current pixel in the digital image to be encrypted, x′ and y′ are the new coordinates of the pixel after encryption, N is the width of the digital image pixel matrix, and mod is the remainder function.

[0057] Through the above formula, the pixel points are iterated multiple times. Each iteration requires transformation of all pixel positions. The transformation period is related to the width of the digital image pixel matrix. For example, the number of transformations for a grayscale image with a size of 256×256 is 192. Through multiple iterations, the digital image tends to become gradually chaotic. When the number of digital images is equal to the transformation period, it can be restored to the initial digital image state.

[0058] Step 2: Divide the encrypted image in step 1 into blocks to obtain segmented blocks.

[0059] First, two random arrays pixels and centers are created, representing the coordinates of the pixel array and the segmentation tile center array respectively. A two-dimensional array distances for storing distances is initialized, and each pixel and each segmentation tile center is traversed through two layers of loops to calculate the spatial distance between them.

[0060] The image embedded with digital watermark is segmented using linear iterative pixel segmentation method to obtain segmented blocks.

[0061] Convert the image embedded with digital watermark into color space and calculate the coordinates of each pixel in the color space (L 1i , A 1i , B 1i , X 1i , Y 1i ) and the segmentation patch center (L 2j , A 2j , B 2j , X 2j , Y 2j )’s spatial distance D, in color space.

[0062]

[0063] Among them, S and m are the length and width of the initial segmentation block, respectively. 1i , A 1i , B 1i , X 1i , Y 1i ) are the brightness value, chromaticity A value, chromaticity B value, and color space coordinate value of the i-th pixel respectively; (L 2j , A 2j , B 2j , X 2j , Y 2j) are the brightness value, chromaticity A value, chromaticity B value, and color space coordinate value of the center of the jth segmented block, respectively. c is the chromaticity and brightness distance, D s The coordinate distance is compared with the initialization distance value. If D is smaller than the initialization distance, D is used as the new initialization distance, the length and width of the segmentation block are updated, and the average value of all pixels in the block of the new segmentation image is used as the center of the new segmentation block.

[0064] The above process is repeated to update the distance value until the spatial distance D is less than the adaptive threshold, the segmentation is completed, and the segmented block is obtained.

[0065] Step 3: Calculate the sum of the center correlation value and the edge correlation value of each segmented block, sort them in descending order, and select the top W segmented blocks to embed W digital watermarks.

[0066] In digital images, there is a strong two-dimensional spatial correlation between adjacent pixels. If the spatial correlation of adjacent pixels changes significantly during data operations, the visual quality of the image will be reduced. This is because the human eye's perception of images is highly dependent on the spatial relationship between pixels. When these relationships are destroyed, the image will appear blurry, distorted, or noisy. During the encryption process, if the encryption algorithm improperly changes the spatial correlation between pixels, the decrypted image may lose its original clarity and details.

[0067] The spatial correlation between adjacent pixels can be measured using center correlation value and edge correlation value.

[0068] The central correlation value E1 represents the spatial correlation between image pixels, and the definition formula is as follows:

[0069]

[0070] Among them, p i It represents the probability of correlation mutation of adjacent pixel i, which satisfies the following conditions:

[0071]

[0072] The edge correlation value E2 represents the edge correlation of the image in exponential form, and the definition formula is as follows:

[0073]

[0074] For each segmented image block, the sum of the center correlation value and the edge correlation value is calculated, and the blocks are sorted in descending order. The top W segmented image blocks are selected to embed W digital watermarks to obtain the image after embedding the digital watermark. Preferably, each selected segmented image block will be embedded with 1-bit digital watermark information in the digital watermark embedding stage. The digital watermark information is as follows: Figure 2 shown.

[0075] Step 4: Perform threshold sampling and binarization calculation within the distribution probability range on the image embedded with the digital watermark to obtain the first two-dimensional code image.

[0076] S41: Preprocess the brightness channel of the image embedded with the digital watermark so that its pixel values ​​are distributed in [0-255].

[0077] Since the luminance channel (brightness channel) in the LAB color space is represented by floating point numbers, while the A and B channels are integers in the range [0,255], it may be necessary to process the luminance channel separately.

[0078] For the brightness channel, it needs to be normalized to the range of [0,255]. The normalized brightness channel brightness value L_n is obtained by the following formula:

[0079] L_n=(L-L_min)*(255 / (L_max-L_min))

[0080] Where L is the original brightness channel value, L_min and L_max are the minimum and maximum values ​​of the brightness channel.

[0081] S42: Perform threshold sampling on each distribution probability range of the image with C as a step, obtain the best threshold, and calculate the first two-dimensional code image.

[0082] From the pixel value distribution of the brightness channel in the image embedded with the digital watermark, the distribution probability p of the brightness channel is obtained. I The distribution probability can be in the form of a histogram, which indicates the frequency of occurrence of each pixel value.

[0083] According to the characteristics of the image and the required processing accuracy, the step C is selected. The value of C determines the accuracy of threshold sampling. The larger the C, the finer the sampling and the greater the amount of calculation.

[0084] Threshold sampling of the image with a step of C means that at each distribution probability p I A series of thresholds are selected with C as intervals within the range. That is, at each distribution probability p I In the range, a series of possible thresholds are selected with a fixed step C. For example, if a distribution probability p IThe range is 155 to 255, and C = 50, then we will choose 155, 205, and 255 as possible thresholds.

[0085] According to the evaluation index, the best threshold is selected from the possible thresholds. The best threshold should be the threshold that maximizes or minimizes the evaluation index. For the best threshold θ, check whether the value of the segmented block is greater than the best threshold θ. If so, the QR code image B i The corresponding pixel value in is 1, otherwise it is 0.

[0086] B i =THRESH(I i ,θ)

[0087] B i It is based on the optimal threshold θ for I i The pixel value of the QR code obtained after binarization. i with I i The dimensions are the same, but each pixel value is converted to either 0 or 1.

[0088] The THRESH function is used to binarize the pixel values ​​in the image. This function receives two parameters: one is the pixel value I in the pixel value array of the LAB three-channel segmentation block i , and the other is the optimal threshold θ. For each pixel, the pixel value in the image that is less than or equal to the threshold is set to 0, and the pixel value greater than the threshold is set to 1, thereby dividing the image into two black and white areas to form a QR code.

[0089] Preferably, for each channel of LAB, THRESH(I i ,θ) is binarized as follows:

[0090] If I i [L][A][B]>θ, then B i [L][A][B] = 1;

[0091] Otherwise, B i [L][A][B]=0.

[0092] I i It represents the pixel value of the LAB three-channel segmentation block of the image. θ is the optimal threshold, B i It is based on the optimal threshold θ for I i The pixel value of the QR code obtained after binarization.

[0093] Step 5: Perform threshold sampling and binarization calculation within the distribution probability range on the image before embedding the digital watermark to obtain the second two-dimensional code image.

[0094] Referring to the process of step 4, threshold sampling and binarization calculation are performed on the image before embedding the digital watermark to obtain the corresponding second two-dimensional code image.

[0095] Step 6: Calculate the pixel difference between the first QR code image and the second QR code image, compose the pixel difference value into a binary digital sequence, convert the binary digital sequence into a decimal number, and compare it with the standard number in the background database to verify the authenticity of the product.

[0096] Traverse each pixel point in the two-dimensional code image, compare the pixel values ​​of the first two-dimensional code image and the second two-dimensional code image at the same position, and for each pixel point, calculate the difference in the pixel values ​​of the two two-dimensional code images at that point. Since the difference in pixel values ​​is either 0 or 1, the pixel difference value constitutes a binary digital sequence.

[0097] In a binary number sequence, each bit position number represents a power of 2. Multiply the binary digit (0 or 1) at each position number by the power of 2 of the corresponding position number, and then sum these products to convert it into a decimal number.

[0098] For example, the binary sequence 10110:

[0099] The rightmost zero position is 0, which represents 0×2 0 =0

[0100] The first digit is 1, which means 1×2 1 =2

[0101] The second digit is 1, which means 1×2 2 =4

[0102] Then the third digit is 0, which means 0×2 3 =0

[0103] The fourth digit from the left is 1, which means 1×2 4 =16

[0104] Sum these products to get the decimal number:

[0105] 0+2+4+0+16=22

[0106] The first QR code image and the second QR code image are printed on the cigarette package. After purchasing the product, the consumer uses a device with a scanning function (such as a smart phone) to scan the two QR codes on the cigarette package in succession. After verification, the verification system compares the extracted decimal number with the standard number in the background database. This can be done through online verification or an application.

[0107] If the numbers obtained from both QR code scans match the standard numbers in the backend database, the product is verified as authentic. If either number does not match, the product may be counterfeit and consumers should handle it with caution.

[0108] Example 2

[0109] On the basis of the technical solution of Example 1, in step three, the difference coefficient between the image after embedding the digital watermark and the image before embedding the digital watermark is calculated, thereby ensuring that the difference between the image after embedding the digital watermark and the image before embedding the digital watermark is greater than the minimum difference value, so that it is not easy to be counterfeited.

[0110] Calculate the difference coefficient β between the pixel value W(I,J) at the pixel point (I,J) of the image before embedding the digital watermark and the pixel value W'(I,J) at the pixel point (I,J) of the image after embedding the digital watermark.

[0111] The coefficient of variation β is defined as:

[0112]

[0113] Determine whether the difference coefficient β is greater than the minimum difference value. If the difference coefficient β is greater than the minimum difference value, you can proceed to step 4. If the difference coefficient β is not greater than the minimum difference value, you need to select the top 2W segmented blocks to embed 2W digital watermarks. After embedding the additional W digital watermarks, recalculate the difference coefficients between the images and verify whether the minimum difference value requirement is met. If it is met, the process can continue; if not, you may need to repeat this process.

[0114] This step can increase the robustness and visibility of the watermark, thereby increasing the difference between the image after embedding the digital watermark and the image before embedding the digital watermark.

[0115] In a preferred embodiment, this difference coefficient can be based on other image features besides pixel values, such as color distribution, texture features, etc.

[0116] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted through the computer-readable storage medium. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or a data center that includes one or more available media integrated. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid state disk (SSD)), etc.

[0117] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in the present application, and these modifications or replacements should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.

Claims

1. A method for verifying the authenticity of printed cigarette packages based on a QR code, characterized in that: The steps include: Step 1: Encrypt the original digital image by changing the coordinates of the pixel points; Step 2: Divide the encrypted image in step 1 into blocks to obtain segmented blocks; Step 3: Calculate the sum of the center correlation value and the edge correlation value of each segmented image block, sort them in descending order, and select the top W segmented image blocks to embed W digital watermarks; The central correlation value E1 is defined as follows: , The edge association value E2 is defined as follows: , Among them, n is the total number of pixels in each segmented block, p i Represents the probability of correlation mutation of pixel i, satisfying the following conditions: , Calculate the sum of the center correlation value and the edge correlation value for each segmented image block, sort them in descending order, and select the top W segmented image blocks to embed W digital watermarks; Step 4: Perform threshold sampling and binarization calculation within the distribution probability range on the image embedded with the digital watermark to obtain the first two-dimensional code image; Step 5: Perform threshold sampling and binarization calculation within the distribution probability range on the image before embedding the digital watermark to obtain a second two-dimensional code image; Step 6: Calculate the pixel difference between the first QR code image and the second QR code image, compose the pixel difference value into a binary digital sequence, convert the binary digital sequence into a decimal number, and compare it with the standard number in the background database to verify the authenticity of the product.

2. The method for verifying the authenticity of printed cigarette packages based on a two-dimensional code according to claim 1, characterized in that: In step 1, the pixel transformation formula is as follows: , Among them, x and y are the coordinates of the current pixel in the digital image to be encrypted. , is the new coordinate of the pixel point after transformation, N is the width of the pixel matrix of the digital image, and mod is the remainder function.

3. The method for verifying the authenticity of printed cigarette packages based on a two-dimensional code according to claim 1, characterized in that: In the step 4, the brightness channel of the image embedded with the digital watermark is preprocessed to obtain a normalized brightness value L_n: L_n = (L - L_min) * (255 / (L_max - L_min)), Where L is the original brightness value, L_min and L_max are the minimum and maximum brightness values.

4. The method for verifying the authenticity of printed cigarette packages based on a two-dimensional code according to claim 3, characterized in that: Perform threshold sampling on each distribution probability range of the image to obtain the best threshold value in each distribution probability range , calculate the pixel value B of the QR code i : , The THRESH function is used to binarize the pixel values ​​in the image. For each pixel value I within each distribution probability range, i , the image is less than or equal to the optimal threshold The pixel value is set to 0, which is greater than the optimal threshold The pixel value is set to 1, thereby dividing the image into two black and white areas to form a QR code.

5. The method for verifying the authenticity of printed cigarette packages based on a two-dimensional code according to claim 1, characterized in that: In the step 3, the difference coefficient between the pixel value W(I,J) at the pixel point (I,J) of the image before embedding the digital watermark and the pixel value W'(I,J) at the pixel point (I,J) of the image after embedding the digital watermark is calculated. : , Determine the coefficient of variation Is it greater than the minimum difference value, difference coefficient If it is greater than the minimum difference value, go to step 4, the difference coefficient If it is not greater than the minimum difference value, then it is necessary to select the top 2W segmented blocks to embed 2W digital watermarks.

6. The method for verifying the authenticity of printed cigarette packages based on a two-dimensional code according to claim 1, characterized in that: In the step 2, two random arrays pixels and centers are created to represent the coordinates of the pixel array and the segmentation block center array respectively, and a two-dimensional array distances for storing distances is initialized. Each pixel point and each segmentation block center are traversed by looping, and the spatial distance between them is calculated.

Citation Information

Patent Citations

  • Digital watermark processing method and device, electronic equipment and storage medium

    CN111754379A

  • Human code comparison two-dimensional code preparation method based on face recognition

    CN117275055A