[go: up one dir, main page]

CN118967171A - A method for checking the authenticity of cigarette package printing products based on QR codes - Google Patents

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

Info

Publication number
CN118967171A
CN118967171A CN202411172426.5A CN202411172426A CN118967171A CN 118967171 A CN118967171 A CN 118967171A CN 202411172426 A CN202411172426 A CN 202411172426A CN 118967171 A CN118967171 A CN 118967171A
Authority
CN
China
Prior art keywords
image
pixel
dimensional code
value
digital
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202411172426.5A
Other languages
Chinese (zh)
Other versions
CN118967171B (en
Inventor
王彦
李灵
吝月雷
靳磊
邹辉
杜长聪
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tianjin Zhongrong Intelligent Packaging Co ltd
Original Assignee
Tianjin Zhongrong Intelligent Packaging Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tianjin Zhongrong Intelligent Packaging Co ltd filed Critical Tianjin Zhongrong Intelligent Packaging Co ltd
Priority to CN202411172426.5A priority Critical patent/CN118967171B/en
Publication of CN118967171A publication Critical patent/CN118967171A/en
Application granted granted Critical
Publication of CN118967171B publication Critical patent/CN118967171B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q30/00Commerce
    • G06Q30/018Certifying business or products
    • G06Q30/0185Product, service or business identity fraud
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K17/00Methods or arrangements for effecting co-operative working between equipments covered by two or more of main groups G06K1/00 - G06K15/00, e.g. automatic card files incorporating conveying and reading operations
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T1/00General purpose image data processing
    • G06T1/0021Image watermarking
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/11Region-based segmentation
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/70Determining position or orientation of objects or cameras
    • G06T7/77Determining position or orientation of objects or cameras using statistical methods
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2201/00General purpose image data processing
    • G06T2201/005Image watermarking
    • G06T2201/0061Embedding of the watermark in each block of the image, e.g. segmented watermarking
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/30Computing systems specially adapted for manufacturing

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Business, Economics & Management (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Evolutionary Biology (AREA)
  • Development Economics (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Entrepreneurship & Innovation (AREA)
  • Accounting & Taxation (AREA)
  • Probability & Statistics with Applications (AREA)
  • Economics (AREA)
  • Finance (AREA)
  • Marketing (AREA)
  • Strategic Management (AREA)
  • General Business, Economics & Management (AREA)
  • Editing Of Facsimile Originals (AREA)

Abstract

The invention provides a method for checking the authenticity of a tobacco package printed product based on a two-dimensional code, which relates to the technical field of printing anti-counterfeiting, and comprises the steps of encrypting an original digital image by changing coordinates of pixel points, partitioning the encrypted image, calculating the sum of a central correlation value and an edge correlation value of each partitioned image block, selecting W partitioned image blocks with front ordering to be used for embedding W digital watermarks, carrying out threshold sampling and binarization calculation in a distribution probability range on the image embedded with the digital watermarks, obtaining a first two-dimensional code image, carrying out threshold sampling and binarization calculation in the distribution probability range on the image embedded with the digital watermarks, obtaining a second two-dimensional code image, calculating pixel difference values of the first two-dimensional code image and the second two-dimensional code image, forming a binary digital sequence by the pixel difference values, converting the binary digital sequence into decimal numbers, and comparing the decimal numbers with standard numbers in a background database to verify the authenticity of the product.

Description

Method for checking authenticity of tobacco package printed product based on two-dimensional code
Technical Field
The invention relates to the technical field of printing anti-counterfeiting, in particular to a method for checking the authenticity of a tobacco package printed product based on a two-dimensional code.
Background
After the two-dimensional code encodes the information and data of the product, the information and data are converted into a two-dimensional arranged multi-grid black-white small square graph, a square black-white gray graph array with a structural function is formed by binary components and is stored, pixels are 0 and 255, and the two-dimensional code is divided into two parts: one part is a functional area, and the functional area is used for identifying the characteristics and comprises a plurality of areas, namely a position detection image, a partition area, a positioning graph and the like; the other part is a coding region which contains information such as data, error correction codes, versions and the like, the two-dimensional code can identify a plurality of characters such as letters, numbers, chinese characters and the like, and different data types form different coding modes.
The two-dimensional code graph can be scanned through a bar code reader, so that relevant information of a product is obtained. For the tobacco package printed products, each genuine product has a unique two-dimensional code, and a consumer can send the obtained information back to the central database for verification through scanning the two-dimensional code, so that the authenticity of the product is judged.
The two-dimensional code on the cigarette packet can mark brands, and the digital watermark is responsible for functions such as anti-counterfeiting, integral and the like. The consumer scans the two-dimension code to enter the cigarette brand interface, and the consumer can participate in the anti-counterfeiting and marketing links of the cigarettes by inputting the digital watermark.
The two-dimensional code can also be used for data tracing of products. In the production process of the tobacco bale printed product, the information of each link can be recorded through the two-dimensional code. Thus, once a problem occurs, the source of the problem can be quickly traced back through scanning the two-dimensional code, so that the problem is solved in time.
The method for checking the authenticity of the tobacco package printed product based on the two-dimensional code mainly comprises the following steps:
Designing and generating a two-dimensional code: in the production process of the tobacco bale printed product, a special two-dimensional code is designed. This two-dimensional code needs to contain information about the pack, such as the brand of the cigarettes, the production lot, the production date, etc. Meanwhile, the two-dimensional code also needs to contain some anti-counterfeiting information, such as encrypted digital verification codes and the like.
Printing a two-dimensional code: and printing the designed two-dimensional code on the cigarette packet. In the printing process, the definition and accuracy of the two-dimensional code need to be ensured so as to facilitate subsequent scanning and identification.
Establishing a database: and establishing a database for storing the two-dimension code information. The database needs to be capable of storing all relevant information of the tobacco package and corresponding to the two-dimensional code.
Consumer scans two-dimensional code: after a consumer purchases the cigarette packet, the two-dimensional code on the cigarette packet can be scanned through equipment such as a mobile phone. After scanning, the device will display information about the pack, such as brand, production lot, date of production, etc.
Verifying the anti-counterfeiting information: after scanning the two-dimensional code, the consumer can also input a digital verification code in the two-dimensional code to verify the authenticity of the cigarette packet. If the digital authentication code is consistent with the information stored in the database, the packet is authentic; otherwise, the packet is false.
Through the steps, a consumer can check the authenticity of the tobacco package printed product by using the two-dimensional code. Meanwhile, the method can also prevent the occurrence of counterfeit products and protect the rights and interests of consumers.
However, in the prior art, the complexity and the difficulty in interpretation of the two-dimensional code are low, so that the two-dimensional code is easy to copy and decrypt, and the accuracy of the true and false inspection of the tobacco bale printed product is greatly reduced.
Disclosure of Invention
In order to solve the technical problems, the invention provides a method for checking the authenticity of a tobacco bale printed product based on a two-dimensional code, which comprises the following steps:
Step one: encrypting the original digital image by changing the coordinates of the pixel points;
Step two: partitioning the encrypted image in the step one to obtain partitioned blocks;
Step three: calculating the sum of the center correlation value and the edge correlation value of each divided image block, sorting according to the sequence from big to small, and selecting W divided image blocks with the top sorting for embedding W digital watermarks;
step four: performing threshold sampling and binarization calculation in a distribution probability range on the image embedded with the digital watermark to obtain a first two-dimensional code diagram;
Step five: performing threshold sampling and binarization calculation in a distribution probability range on the image before embedding the digital watermark to obtain a second two-dimensional code image;
Step six: calculating pixel difference values of the first two-dimensional code image and the second two-dimensional code image, forming a binary number sequence by the pixel difference values, converting the binary number sequence into decimal numbers, and comparing the decimal numbers with standard numbers in a background database to verify the authenticity of the product.
Further, in the first step, the pixel transformation formula is as follows:
wherein x and y are coordinates of a current pixel point in the digital image to be encrypted, x 'and y' are new coordinates of the pixel point obtained after transformation, N is the width of a matrix of the pixel point of the digital image, and mod is a residual function.
Further, in the third step, the center correlation value E 1 is defined as follows:
the edge correlation value E 2 is defined as follows:
Wherein n is the total number of pixel points of each divided block, and p i represents the probability of occurrence of a correlation mutation of the pixel point i, and the following conditions are satisfied:
and calculating the sum of the center correlation value and the edge correlation value for each divided image block, sorting the divided image blocks according to the order from big to small, and selecting W divided image blocks with the top sorting for embedding W digital watermarks.
Further, in the fourth step, 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 luminance value and l_min and l_max are the minimum luminance value and the maximum luminance value.
Further, threshold sampling is performed on each distribution probability range of the image, an optimal threshold value theta in each distribution probability range is obtained, and a pixel value B i of the two-dimensional code is calculated:
Bi=THRESH(Ii,θ)
the THRESH function is used to binarize a pixel value in an image, and for each pixel value I i in each distribution probability range, a pixel value less than or equal to an optimal threshold value θ in the image is set to 0, and a pixel value greater than the optimal threshold value θ is set to 1, so that the image is divided into two black and white regions, and a two-dimensional code is formed.
Further, in the step six, a difference coefficient β between the pixel value W (I, J) at the pixel point (I, J) of the image before the digital watermark is embedded and the pixel value W' (I, J) at the pixel point (I, J) of the image after the digital watermark is embedded is calculated:
Judging whether the difference coefficient beta is larger than the lowest difference value, if the difference coefficient beta is larger than the lowest difference value, entering a step four, and if the difference coefficient beta is not larger than the lowest difference value, selecting 2W divided blocks with the front ordering for embedding 2W digital watermarks.
Further, in the second step, two random arrays, i.e., pixels and centers, are created, representing the coordinates of the pixel point array and the center array of the divided block, respectively, a two-dimensional array distances for storing distances is initialized, each pixel point and each center of the divided block are traversed through two-layer circulation, and the spatial distance between them is calculated.
Compared with the prior art, the invention has the following beneficial technical effects:
the original digital image is encrypted by changing the coordinates of the pixel points, and the local correlation and the spatial correlation among the pixel points of the original digital image are destroyed, so that the image is in a noise-like form, the complexity and the difficulty of interpretation of the image are greatly increased, and the encryption of the image is realized.
The encrypted image is segmented, the sum of the center correlation value and the edge correlation value of each segment is calculated, and the spatial correlation among pixels is maintained in the encryption process, so that the obvious degradation of the image quality is avoided.
And (3) carrying out threshold sampling and binarization calculation in a distribution probability range on the image embedded with the digital watermark to obtain a first two-dimensional code image, carrying out threshold sampling and binarization calculation in the distribution probability range on the image before the digital watermark is embedded to obtain a second two-dimensional code image, calculating pixel difference values of the first two-dimensional code image and the second two-dimensional code image, forming a binary digital sequence by the pixel difference values, converting the binary digital sequence into decimal numbers, and comparing the decimal numbers with standard numbers in a background database to verify the authenticity of the product, thereby improving the accuracy of the authenticity inspection of the tobacco package printed product.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings that are needed in the description of the embodiments will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present invention, and that other drawings may be obtained according to these drawings without inventive effort to a person skilled in the art.
Fig. 1 is a schematic flow chart of a method for checking the authenticity of a tobacco package printed product based on a two-dimensional code.
Fig. 2 is a schematic diagram of digital watermark information according to the present invention.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present application more apparent, the technical solutions of the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application, and it is apparent that the described embodiments are some embodiments of the present application, but not all embodiments of the present application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
In the drawings of the specific embodiments of the present invention, in order to better and more clearly describe the working principle of each element in the system, the connection relationship of each part in the device is represented, but only the relative positional relationship between each element is clearly distinguished, and the limitations on the signal transmission direction, connection sequence and the structure size, dimension and shape of each part in the element or structure cannot be constructed.
Example 1
Referring to fig. 1, a flow chart of a method for checking the authenticity of a tobacco package printed product based on a two-dimensional code according to the invention is shown, and the method comprises the following steps:
Step one: the encryption of the original digital image is achieved by changing the coordinates of the pixel points.
The method can destroy local correlation and spatial correlation among pixels of the original digital image so that the digital image presents a form similar to noise. When the number of iterations reaches a certain value, the encrypted digital image is restored to the original digital image.
The pixel transformation formula is as follows:
Wherein x and y are coordinates of a current pixel point in the digital image to be encrypted, x 'and y' are new coordinates of the pixel point obtained after encryption, N is the width of a matrix of the pixel point of the digital image, and mod is a residual function.
Through the above formula, the pixel is iterated for a plurality of times, each iteration needs to perform transformation on all pixel points, and the period of transformation is related to the width of the pixel matrix of the digital image, for example, the transformation times of the gray image with the size of 256×256 are 192. Through multiple iterations, the digital image is in a gradual chaotic trend, which can be restored to the original digital image state when the number of digital images is equal to the period of the transformation.
Step two: and (3) partitioning the encrypted image in the step one to obtain a partitioned image block.
First two random arrays, pixels and centers, are created, representing the coordinates of the pixel point array and the center array of the split tile, respectively. A two-dimensional array distances for storing distances is initialized, each pixel point and each segmented tile center are traversed through a two-layer loop, and the spatial distance between them is calculated.
And dividing the image embedded with the digital watermark by using a linear iterative pixel division method to obtain a divided block.
The image with the embedded digital watermark is converted into a color space, and the space distance D between each pixel point coordinate (L 1i,A1i,B1i,X1i,Y1i) and the center (L 2j,A2j,B2j,X2j,Y2j) of the segmentation block in the color space is calculated.
S and m are the length and width of the original divided block respectively, (L 1i,A1i,B1i,X1i,Y1i) are the brightness value, the chromaticity A value, the chromaticity B value and the coordinate value of the color space of the ith pixel point respectively; (L 2j,A2j,B2j,X2j,Y2j) respectively obtaining a luminance value, a chromaticity A value, a chromaticity B value and a coordinate value of a color space of the center of the jth divided block, obtaining D c as a chromaticity luminance distance, obtaining D s as a coordinate distance, comparing the coordinate distance with an initialization distance value, and if D is smaller than the initialization distance, obtaining D as a new initialization distance, updating the length and the width of the divided block, and obtaining the average value of all pixel points of the block in the new divided block as the center of the new divided block;
And (3) circulating the above process, updating the distance value until the space distance D is smaller than the self-adaptive threshold value, completing the segmentation, and obtaining the segmented image blocks.
Step three: and calculating the sum of the center correlation value and the edge correlation value of each divided image block, sorting the divided image blocks according to the order from big to small, and selecting W divided image blocks with the top sorting for embedding W digital watermarks.
In digital images, there is a strong two-dimensional spatial correlation between adjacent pixels. If there is a significant change in the spatial correlation of adjacent pixels during data manipulation, the visual quality of the image may be degraded. This is because the perception of an image by the human eye is highly dependent on the spatial relationships between pixels, and when these relationships are broken, the image appears blurred, distorted, or noisy. In the encryption process, if the encryption algorithm improperly changes the spatial correlation between pixels, the decrypted image may lose its original sharpness and detail.
The spatial correlation of adjacent pixels can be measured using the center correlation value and the edge correlation value.
The center correlation value E 1 represents the spatial correlation between image pixels, and the definition formula is as follows:
Wherein, p i represents the probability of occurrence of the correlation mutation of the adjacent pixel point i, and the following conditions are satisfied:
the edge correlation value E 2 is an index representing the edge correlation of the image, and the definition formula is as follows:
and calculating the sum of the center correlation value and the edge correlation value for each divided image block, sorting according to the order from big to small, and selecting W divided image blocks with the top sorting for embedding W digital watermarks to obtain an image with embedded digital watermarks. Preferably, each selected segment is embedded with 1bit digital watermark information in the digital watermark embedding stage, the digital watermark information being as shown in fig. 2.
Step four: and carrying out threshold sampling and binarization calculation in a distribution probability range on the image embedded with the digital watermark to obtain a first two-dimensional code image.
S41: and preprocessing the brightness channel of the image embedded with the digital watermark to ensure that the pixel value of the brightness channel is distributed in [0-255].
Since the luminance channels (luminance channels) in the LAB color space are represented by floating point numbers, and the a and B channels are integers in the range of 0,255, it may be necessary to process the luminance channels separately.
For the luminance channel, it needs to be normalized to be in the range of [0,255 ]. The normalized luminance channel luminance value l_n is obtained by the following formula:
L_n=(L-L_min)*(255/(L_max-L_min))
Where L is the original luminance channel value and l_min and l_max are the minimum and maximum values of the luminance channel.
S42: and C is used as a step to sample the threshold value of each distribution probability range of the image, the optimal threshold value is obtained, and the first two-dimensional code diagram is calculated.
And counting the pixel value distribution of the brightness channels from the image embedded with the digital watermark to obtain the distribution probability p I of the brightness channels. The distribution probability may be in the form of a histogram representing the frequency of occurrence of each pixel value.
The value of the steps C and C is selected according to the characteristics of the image and the required processing precision, so that the precision of threshold sampling is determined, and the larger the C is, the finer the sampling is, and the larger the calculated amount is.
Thresholding the image in steps of C means selecting a series of thresholds at intervals of C within each distribution probability p I. I.e. a series of possible thresholds is selected in fixed steps C within each distribution probability p I. For example, if a certain distribution probability p I is in the range 155 to 255 and c=50, we will choose 155,205,255 as a possible threshold.
The best threshold is selected from the possible thresholds according to the evaluation index. The optimal threshold should be one that maximizes or minimizes the evaluation index. For the optimal threshold value θ, it is checked whether the value of the split tile is greater than the optimal threshold value θ, if so, the corresponding pixel value in the two-dimensional code map B i is 1, otherwise it is 0.
Bi=THRESH(Ii,θ)
B i is a pixel value of the two-dimensional code obtained by binarizing the I i according to the optimal threshold θ. B i is the same dimension as I i, but each pixel value therein is converted to either 0 or 1.
The THRESH function is used to binarize pixel values in an image, and receives two parameters: one is the pixel value I i in the array of pixel values of the LAB three-channel segment tile, and the other is the optimal threshold θ. For each pixel, the pixel value smaller than or equal to the threshold value in the image is set to 0, and the pixel value larger than the threshold value is set to 1, so that the image is divided into two black and white areas, and a two-dimensional code is formed.
Preferably, for each LAB channel, THRESH (I i, θ) is binarized by:
if I i [ L ] [ A ] [ B ] > θ, then B i [ L ] [ A ] [ B ] =1;
otherwise, B i [ L ] [ a ] [ B ] =0.
I i represents the pixel values of the LAB three-channel segmentation tile of the image. θ is an optimal threshold, and B i is a pixel value of the two-dimensional code obtained by binarizing I i according to the optimal threshold θ.
Step five: and carrying out threshold sampling and binarization calculation in a distribution probability range on the image before embedding the digital watermark, and obtaining a second two-dimensional code image.
And referring to the process of the step four, performing threshold sampling and binarization calculation on the image before embedding the digital watermark, and obtaining a corresponding second two-dimensional code image.
Step six: calculating pixel difference values of the first two-dimensional code image and the second two-dimensional code image, forming a binary number sequence by the pixel difference values, converting the binary number sequence into decimal numbers, and comparing the decimal numbers with standard numbers in a background database to verify the authenticity of the product.
And traversing each pixel point in the two-dimensional code image, comparing the pixel values of the first two-dimensional code image and the second two-dimensional code image at the same position, and calculating the difference of the pixel values of the two-dimensional code images at the point for each pixel point, wherein the difference of the pixel values is either 0 or 1, so that the pixel difference value forms a binary digital sequence.
In the binary digit sequence, the position number of each bit represents a power of 2, the binary digit (0 or 1) on each position number is multiplied by the power of 2 of the corresponding position number, and then the products are summed to be converted into decimal digits.
For example, binary sequence 10110:
The rightmost zero position is 0, representing 0 x 2 0 =0
Then the first bit is 1, representing 1× 1 =2
And then 1 on the second bit, representing 1× 2 =4
And then 0 in the third position, representing 0× 3 =0
The leftmost fourth bit is 1, representing 1× 4 =16
Summing these products yields a decimal number:
0+2+4+0+16=22
Printing the first two-dimensional code image and the second two-dimensional code image on a cigarette packet, after a consumer purchases a product, scanning two-dimensional codes on the cigarette packet successively by using equipment with a code scanning function (such as a smart phone), and comparing the extracted decimal numbers with standard numbers in a background database by a verification system after verification, wherein the process can be completed through online verification or an application program.
If the numbers obtained by scanning the two-dimension codes are matched with the standard numbers in the background database, the product is verified as a genuine product. If any number does not match, the product may be counterfeit and the consumer should be careful to handle.
Example 2
On the basis of the technical scheme of the embodiment 1, in the third step, the difference coefficient between the image after the digital watermark is embedded and the image before the digital watermark is embedded is calculated, so that the image after the digital watermark is embedded and the image before the digital watermark is embedded can be ensured to be larger than the minimum difference value, and thus the image is not easy to imitate.
A coefficient of difference β between a pixel value W (I, J) at a pixel point (I, J) of an image before embedding the digital watermark and a pixel value W' (I, J) at a pixel point (I, J) of an image after embedding the digital watermark is calculated.
The difference coefficient β is defined as:
Judging whether the difference coefficient beta is larger than the lowest difference value, if the difference coefficient beta is larger than the lowest difference value, entering a step four, if the difference coefficient beta is not larger than the lowest difference value, selecting 2W segmented blocks with the front sequence to be used for embedding 2W digital watermarks, and after embedding additional W digital watermarks, recalculating the difference coefficient between images and verifying whether the requirement of the lowest difference value is met. If so, the flow may continue; if not, this process may need to be repeated.
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.
In a preferred embodiment, this coefficient of difference may be based on other image features than pixel values, such as color distribution, texture features, etc.
In the above embodiments, it may be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented in software, may 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 loaded and executed on a computer, produces a flow or function in accordance with embodiments of the present application, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable apparatus. The computer instructions may be stored in or transmitted across a computer-readable storage medium. The computer readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. that contains an integration of one or more available media. The usable medium may be a magnetic medium (e.g., floppy disk, hard disk, tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid State Disk (SSD)), etc.
While the application has been described with reference to certain preferred embodiments, it will be understood by those skilled in the art that various changes and substitutions of equivalents may be made and equivalents will be apparent to those skilled in the art without departing from the scope of the application. Therefore, the protection scope of the application is subject to the protection scope of the claims.

Claims (7)

1.一种基于二维码对烟包印刷产品真假进行检验的方法,其特征在于,包括如下步骤:1. A method for verifying the authenticity of printed cigarette packs based on a two-dimensional code, characterized in that it comprises the following steps: 步骤一:通过改变像素点的坐标实现对原始数字图像的加密;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; 步骤三:计算每一个分割图块的中心相关值与边缘关联值之和,按照从大到小顺序排序,选取排序靠前的W个分割图块用来嵌入W个数字水印;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; 步骤四:对嵌入数字水印后的图像进行分布概率范围内的阈值采样及二值化计算,获取第一二维码图;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.根据权利要求1所述的基于二维码对烟包印刷产品真假进行检验的方法,其特征在于,所述步骤一中,像素点变换公式如下: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 point transformation formula is as follows: 其中,x、y为当前像素点在待加密数字图像中的坐标,x′、y′为经变换后得到的像素点的新坐标,N为数字图像像素点矩阵的宽度,mod为求余函数。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. 3.根据权利要求1所述的基于二维码对烟包印刷产品真假进行检验的方法,其特征在于,所述步骤三中,中心相关值E1定义公式如下: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 step 3, the central correlation value E1 is defined by the following formula: 边缘关联值E2定义公式如下:The edge correlation value E2 is defined as follows: 其中,n为每一个分割图块的像素点总数,pi表示像素点i发生相关性突变的概率,满足以下条件:Where n is the total number of pixels in each segmented block, and pi represents the probability of correlation mutation of pixel i, satisfying the following conditions: 对每一个分割图块计算中心相关值和边缘关联值之和,按照从大到小顺序排序,选取排序靠前的W个分割图块用来嵌入W个数字水印。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. 4.根据权利要求1所述的基于二维码对烟包印刷产品真假进行检验的方法,其特征在于,所述步骤四中,对嵌入数字水印后的图像的亮度通道进行预处理,得到归一化亮度值L_n:4. The method for verifying the authenticity of printed cigarette packages based on a two-dimensional code according to claim 1 is 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))L_n=(L-L_min)*(255/(L_max-L_min)) 其中L是原始的亮度值,L_min和L_max是最小亮度值和最大亮度值。Where L is the original brightness value, L_min and L_max are the minimum and maximum brightness values. 5.根据权利要求4所述的基于二维码对烟包印刷产品真假进行检验的方法,其特征在于,对图像每个分布概率范围进行阈值采样,获取每个分布概率范围内的最佳的阈值θ,计算二维码的像素值Bi5. The method for verifying the authenticity of printed cigarette packages based on a two-dimensional code according to claim 4 is characterized in that a threshold sampling is performed on each distribution probability range of the image, an optimal threshold value θ in each distribution probability range is obtained, and a pixel value Bi of the two-dimensional code is calculated: Bi=THRESH(Ii,θ)B i =THRESH(I i ,θ) THRESH函数用于将图像中的像素值二值化处理,对于每个分布概率范围内的每个像素值Ii,将图像中小于或等于最佳的阈值θ的像素值设为0,将大于最佳的阈值θ的像素值设为1,从而将图像分为黑白两个区域,形成二维码。The THRESH function is used to binarize the pixel values in the image. For each pixel value I i within each distribution probability range, the pixel values in the image that are less than or equal to the optimal threshold θ are set to 0, and the pixel values that are greater than the optimal threshold θ are set to 1, thereby dividing the image into two black and white areas to form a QR code. 6.根据权利要求1所述的基于二维码对烟包印刷产品真假进行检验的方法,其特征在于,所述步骤六中,计算嵌入数字水印前的图像的像素点(I,J)处的像素值W(I,J)和嵌入数字水印后的图像的像素点(I,J)处的像素值W'(I,J)之间的差异系数β: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 step 6, the difference coefficient β between the pixel value W(I,J) at the pixel point (I,J) of the image before the digital watermark is embedded and the pixel value W'(I,J) at the pixel point (I,J) of the image after the digital watermark is embedded is calculated: 判断差异系数β是否大于最低差异值,差异系数β若大于最低差异值,则进入步骤四,差异系数β若没有大于最低差异值,那么需要选择选取排序靠前的2W个分割图块用来嵌入2W个数字水印。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. 7.根据权利要求1所述的基于二维码对烟包印刷产品真假进行检验的方法,其特征在于,所述步骤二中,创建两个随机数组pixels和centers,分别代表像素点数组和分割图块中心数组的坐标,初始化用于存储距离的二维数组distances,通过循环遍历每个像素点和每个分割图块中心,并计算它们之间的空间距离。7. According to the method for verifying the authenticity of printed cigarette packages based on two-dimensional codes as described in claim 1, it is characterized in that in the step 2, two random arrays pixels and centers are created, which respectively represent the coordinates of the pixel point array and the segmented block center array, and the two-dimensional array distances for storing distances is initialized, and each pixel point and each segmented block center are traversed by looping, and the spatial distance between them is calculated.
CN202411172426.5A 2024-08-26 2024-08-26 Method for checking authenticity of tobacco package printed product based on two-dimensional code Active CN118967171B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202411172426.5A CN118967171B (en) 2024-08-26 2024-08-26 Method for checking authenticity of tobacco package printed product based on two-dimensional code

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202411172426.5A CN118967171B (en) 2024-08-26 2024-08-26 Method for checking authenticity of tobacco package printed product based on two-dimensional code

Publications (2)

Publication Number Publication Date
CN118967171A true CN118967171A (en) 2024-11-15
CN118967171B CN118967171B (en) 2025-05-16

Family

ID=93392312

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202411172426.5A Active CN118967171B (en) 2024-08-26 2024-08-26 Method for checking authenticity of tobacco package printed product based on two-dimensional code

Country Status (1)

Country Link
CN (1) CN118967171B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN120563297A (en) * 2025-08-04 2025-08-29 山西黑与白品牌策划有限公司 An intelligent anti-counterfeiting detection method and system for packaging design drawings based on artificial intelligence

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111754379A (en) * 2020-06-11 2020-10-09 西安深信科创信息技术有限公司 Digital watermark processing method and device, electronic equipment and storage medium
CN115526282A (en) * 2021-06-25 2022-12-27 理光软件研究所(北京)有限公司 Watermark encryption method, watermark extraction method, device and storage medium
CN117275055A (en) * 2023-02-24 2023-12-22 深圳市琪智科技有限公司 Human code comparison two-dimensional code preparation method based on face recognition

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111754379A (en) * 2020-06-11 2020-10-09 西安深信科创信息技术有限公司 Digital watermark processing method and device, electronic equipment and storage medium
CN115526282A (en) * 2021-06-25 2022-12-27 理光软件研究所(北京)有限公司 Watermark encryption method, watermark extraction method, device and storage medium
CN117275055A (en) * 2023-02-24 2023-12-22 深圳市琪智科技有限公司 Human code comparison two-dimensional code preparation method based on face recognition

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
YULONG YAN 等: "An IoT-Based Anti-Counterfeiting System Using Visual Features on QR Code", 《IEEE INTERNET OF THINGS JOURNAL》, vol. 8, no. 8, 15 April 2021 (2021-04-15), pages 6789 - 6799, XP011848456, DOI: 10.1109/JIOT.2020.3035697 *
李福: "面向二维码防伪认证的数字水印算法设计与实现", 中国优秀硕士学位论文全文数据库 信息科技辑, 15 June 2022 (2022-06-15), pages 138 - 7 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN120563297A (en) * 2025-08-04 2025-08-29 山西黑与白品牌策划有限公司 An intelligent anti-counterfeiting detection method and system for packaging design drawings based on artificial intelligence

Also Published As

Publication number Publication date
CN118967171B (en) 2025-05-16

Similar Documents

Publication Publication Date Title
US7702162B2 (en) Mixed code, and method and apparatus for generating the same
US10373033B2 (en) Two dimensional barcode and method of authentication of such barcode
US6807634B1 (en) Watermarks for customer identification
CN113313225B (en) Anti-counterfeiting method based on sparse dot matrix code
WO2008065267A1 (en) Methods and devices for authenticating a product and a two-dimensional code and novel application of a two-dimensional code
Gupta et al. A Study on Source Device Attribution Using Still Images: S. Gupta et al.
JP2020507830A (en) Method and computing device for determining whether a mark is authentic
CN115293311B (en) Color watermark anti-counterfeiting method and device based on micro-point code
Ouyang et al. A semi-fragile watermarking tamper localization method based on QDFT and multi-view fusion
CN116757904A (en) Information hiding and verifying method and device based on digital image watermark
CN110942076A (en) A method and system for generating anti-counterfeiting marks of ceramic products
CN118967171B (en) Method for checking authenticity of tobacco package printed product based on two-dimensional code
US8038073B2 (en) Tamper detection of documents using encoded dots
CN118709234A (en) A data analysis anti-counterfeiting traceability processing method and system based on QR code
Demircan et al. A Novel LSB Steganography Technique Using Image Segmentation.
Tahaoglu et al. Robust copy-move forgery detection technique against image degradation and geometric distortion attacks
CN110009080B (en) Two-dimensional code generation method, verification method, server and two-dimensional code
CN115423063A (en) Anti-copying shading anti-counterfeiting method and device based on micro dot codes
CN120764569A (en) Method, system and related device for generating encrypted QR code
CN117436907B (en) Anti-fake information tracing method based on combination of mobile phone scanning dot matrix code and digital watermark
CN112733987A (en) Two-dimensional code, identification method and identification device thereof, and electronic equipment
CN119272793B (en) A recyclable electronic price-calculating scale with anti-counterfeiting and anti-cheating functions
US12205189B1 (en) Anti-leak digital document marking system and method using distributed ledger
CN117499551B (en) A method for encrypted anti-counterfeiting printing based on binary signals
CN120449914A (en) Pattern encoding method, pattern decoding method, device, medium and equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant