Two-dimensional code checking method and system for paper bag production

CN122904922APending Publication Date: 2026-10-13SINBOLE PACKAGE IND
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611093871.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-22
Publication Date
2026-10-13

AI Technical Summary

Technical Problem

[0003]然而,在实际生产过程中,由于纸袋输送问题、印刷设备问题等,可能出现二维码漏印、二维码错印(在当前生产批次内印成别的产品二维码)、批次混乱(产品进入错误生产批次)等问题,导致产品追溯信息失效

Benefits of technology

本发明通过动态像素灰度阈值和有效像素点占比阈值共同进行漏印校验,能够根据不同纸袋材质、印刷深浅以及采集环境变化自动调整检测基准,降低因图像亮度变化、油墨差异等外界因素造成的校验错误率,提高漏印校验的准确性;

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122904922A_ABST
    Figure CN122904922A_ABST
Patent Text Reader

Abstract

The application provides a two-dimensional code checking method and system for paper bag production, and relates to the technical field of two-dimensional code checking, and comprises the following steps: generating code information and a check characteristic value through an encryption hash operation based on the product information of a paper bag and products in the paper bag, and printing a two-dimensional code on a first surface of the paper bag; conveying the paper bag to an image acquisition device through a conveying belt and acquiring a two-dimensional code image to be checked, and performing the following processing: performing a missing printing check; if the missing printing check is unqualified, performing missing printing abnormality tracing, if the system abnormality is traced, issuing a check system data acquisition error warning, if the system abnormality is not traced, issuing a two-dimensional code check unqualified warning; if the missing printing check is qualified, performing a wrong code check, if the wrong code check is unqualified, issuing a two-dimensional code check unqualified warning, and if the wrong code check is qualified, passing the two-dimensional code check. The application has the advantages of improving the accuracy of two-dimensional code missing printing detection and improving the comprehensiveness of paper bag two-dimensional code checking.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of QR code verification technology, and more specifically, to a QR code verification method and system for paper bag production. Background Technology

[0002] Nowadays, printing QR codes containing product manufacturing information on the surface of paper bags enables rapid identification and information association between the paper bag and the products inside.

[0003] However, in actual production, issues such as paper bag conveying problems and printing equipment malfunctions can lead to problems like missing QR codes, misprinted QR codes (printing the wrong product's QR code within the same production batch), and batch mixing (products entering the wrong production batch), rendering product traceability information invalid. Existing paper bag QR code verification methods typically extract images from the paper bag surface to evaluate image quality and QR code integrity. This evaluation method struggles to accurately detect misprinted QR codes and batch mixing issues because the QR code itself might be normal and of high quality when these occur. Furthermore, missing QR codes detected by existing methods could also be due to incorrect image extraction (e.g., incomplete extraction).

[0004] Therefore, it is urgent to optimize the QR code verification method to improve the accuracy of QR code printing omission detection and achieve consistency verification between QR code information and paper bag product information, thereby improving the comprehensiveness of paper bag QR code verification. Summary of the Invention

[0005] The purpose of this invention is to provide a QR code verification method and system for paper bag production, which can improve the accuracy of QR code printing omission detection while enhancing the comprehensiveness of QR code verification on paper bags.

[0006] This invention is achieved through the following technical solution: The QR code verification method used in paper bag production includes the following steps: Based on the product information of the paper bag and the products inside the paper bag, the encoded information and verification feature value are generated through encrypted hash operation, and a QR code is printed on the first surface of the paper bag; Paper bags from the verification batch are sequentially transported to the image acquisition device via a conveyor belt, where an image of the first surface of the paper bags is captured. Based on image recognition, a QR code is selected using a preset-sized recognition frame to obtain the QR code image to be verified. Each verification batch includes paper bags corresponding to products from one production batch. Each QR code image to be verified is processed as follows: Calculate the dynamic pixel grayscale threshold and the effective pixel percentage threshold based on the grayscale value distribution of the QR code image to be verified. The effective pixel is the pixel whose grayscale value is greater than the dynamic pixel grayscale threshold. Perform missing print verification based on the dynamic pixel grayscale threshold and the effective pixel percentage threshold. If the missing print verification fails, the missing print anomaly is traced by establishing paper bag status events and image acquisition events. If the system anomaly is traced back, a verification system data acquisition error alarm is issued. If the system anomaly is not traced back, a QR code verification failure alarm is issued. If the missing code verification passes, then an error code verification is performed based on the encoding information and verification feature value recorded in the QR code. If the error code verification fails, a QR code verification failure alarm is issued. If the error code verification passes, then the QR code verification of the QR code image is successful.

[0007] Preferably, the method for generating the encoded information is as follows: ; ; in, The encoded information, For the cryptographic hash operation, The string is constructed based on the product information. This is a product information code, whereby the product information includes the product's production batch code. Production date The total number of products from the same production batch as the products inside the paper bag. and disturbance factor , This is an XOR operator used to assign paper bag numbers to products from the same production batch, based on the order in which the QR codes are printed. The number of the paper bag is represented in binary form, with the high-order bits padded with 0s to make the sum of the number of bits equal to the number of the paper bag. Consistent; The method for generating the verification feature value is as follows: ; in, The verification feature value, This refers to binary to decimal conversion operations. For modulo operation, The preset batch modulus base, It is a prime number and its value range is 1. Products from different production batches different.

[0008] Preferably, the method for performing the error code verification is as follows: verification is performed sequentially based on the encoded information and the verification feature value; if both are qualified, the error code verification is qualified; otherwise, the error code verification is unqualified.

[0009] Preferably, the method for verification based on the encoded information is as follows: The product information of the current verification batch is obtained through the production execution system, and the theoretical product information code is generated based on the product information. Based on the coding information of the paper bag and the theoretical product information code, the binary form of the paper bag number is calculated through an XOR inverse operation, and the paper bag number is obtained through data conversion, thus establishing a paper bag number set: ; in, This represents the set of paper bag numbers in the verification batch. These are the number of the i-th paper bag in the verification batch and the QR code image to be verified, respectively. When obtaining the number of each paper bag, verify the continuity of the number. If the continuity verification passes, the verification based on the coding information is qualified. If the continuity verification fails, mark the paper bag as pending verification based on the coding information. After obtaining all the paper bag numbers, arrange all the paper bag numbers in the paper bag number set in ascending order and determine whether there are duplicates or missing codes. If there are no duplicates and no missing codes, record all paper bags with pending verification results based on the coding information as qualified. Otherwise, record paper bags involving duplicates and / or missing codes as unqualified. The method for verification based on the aforementioned verification feature values ​​is as follows: A theoretical verification feature value calculation model is established for each paper bag: ; in, For the verification batch of the first The verification feature value of the paper bag theory, To obtain the first product in the verification batch based on the product information of the current verification batch The encoded information of the paper bag theory This is the batch modulo base for the current verification batch; Scan the QR code to obtain the verification batch number. The actual verification feature value of each paper bag ,like If the verification based on the verification feature value is successful, then the verification based on the verification feature value is unsuccessful; otherwise, the verification based on the verification feature value is unsuccessful.

[0010] Preferably, the dynamic pixel grayscale threshold is calculated. The method is as follows: Calculate the average grayscale value of all pixels in the QR code image to be verified. and grayscale standard deviation ; Calculate the dynamic pixel grayscale threshold of the QR code image to be verified. : ; in, and These are the first adjustment coefficient and the second adjustment coefficient, respectively. The method for calculating the effective pixel percentage threshold is as follows: Obtain the average percentage of valid pixels in multiple historical QR code verification images. and standard deviation ; Calculate the effective pixel percentage threshold : ; in, This is the third adjustment coefficient.

[0011] Preferably, the method for performing the missing print verification is as follows: Calculate the percentage of valid pixels in the QR code image to be verified. : ; in, The total number of pixels in the QR code image to be verified. The grayscale value of the QR code image to be verified is not less than The total number of pixels; If the percentage of effective pixels If the percentage of valid pixels is greater than the threshold, the missing print verification is qualified; otherwise, the missing print verification is unqualified.

[0012] Preferably, the method for establishing the paper bag state event and the image acquisition event is as follows: A photoelectric sensor is positioned along the conveyor belt path in front of the image acquisition device, and the distance between the photoelectric sensor and the image acquisition device is [distance]. ; In the verification batch The sensing time is recorded when a paper bag passes by the photoelectric sensor. And establish the first verification batch The paper bag state event of the paper bag , The value range is from 1 to the total number of paper bags in the verification batch. ; When the image acquisition device takes a picture, it records the first... The shooting time of this shot , The value range is from 1 to the total number of photos taken within the verification batch. and establish the first The image acquisition event of the next capture , For the first The QR code image to be verified was obtained from the second photograph.

[0013] Preferably, the method for tracing the source of the missing print anomaly is as follows: Calculate the first in the verification batch Time matching parameters between the paper bag status event and the image acquisition event of a paper bag : ; in, Tolerance time for deviation It is a natural exponential function. The conveyor belt's transport speed; like If the value is not less than the preset time matching parameter threshold, the result of the missing print anomaly tracing is that no system anomaly was traced; otherwise, the result of the missing print anomaly tracing is that a system anomaly was traced, and the time matching parameter threshold is 0.606.

[0014] Preferably, the tolerance deviation time is calculated by taking multiple photos of the paper bags from the same production batch. The method is as follows: According to the QR code verification method, the paper bags are transported via the conveyor belt, and K of them are photographed. The key positioning parameters of the QR code for each paper bag are recorded. ; in, For the first The set of key positioning parameters for the QR code of the paper bag. , For the first The row index of the pixel at the top left corner of the QR code image to be verified in the image of the first surface of the paper bag. For the first The maximum difference in row indices of all pixels in the QR code image to be verified in the image of the first surface of the paper bag, wherein the row index direction is opposite to the conveyor belt transport direction; Calculate the tolerance deviation time : ; in, This represents finding the minimum value under the variation of q. This represents finding the minimum value among the multiple parameters within the parentheses. To map row indices to actual transport distances, The total number of row indices in the QR code image to be verified.

[0015] This invention also provides a QR code verification system for paper bag production, applied to the aforementioned QR code verification method for paper bag production, including: The QR code generation module is used to generate encoded information and verification feature values ​​based on the product information of the paper bag and the products inside the paper bag through encrypted hash operation, and then print the QR code on the first surface of the paper bag. A conveyor belt device is used to transport paper bags within a batch for inspection. An image acquisition device is used to acquire an image of the first surface of a paper bag, and based on image recognition, selects a QR code through a recognition frame of a preset size to obtain the image of the QR code to be verified. The verification module is used to perform the missing print verification, the missing print anomaly tracing, and the error code verification.

[0016] The technical solution of the present invention has at least the following advantages and beneficial effects: This invention uses a combination of dynamic pixel grayscale threshold and effective pixel percentage threshold for missing print verification. It can automatically adjust the detection benchmark according to different paper bag materials, printing depth and changes in the collection environment, reduce the verification error rate caused by external factors such as changes in image brightness and ink differences, and improve the accuracy of missing print verification. This invention establishes a correlation between paper bag status events and image acquisition events after a missing print verification fails. By analyzing the consistency between the paper bag conveying process and the image acquisition process, the source of the missing print anomaly is traced, avoiding attributing a missing print verification failure caused by an image acquisition error to a QR code verification failure, thus further improving the reliability of missing print verification. This invention, based on product information of paper bags and products inside the paper bags, generates encoded information and verification feature values ​​through encrypted hash operations. In error code verification, the product information corresponding to the QR code is verified for consistency and uniqueness based on the encoded information and verification feature values. This effectively identifies problems such as QR codes from different batches being mixed in or QR codes being misplaced, thus improving the comprehensiveness of QR code verification. Attached Figure Description

[0017] Figure 1 This is a flowchart illustrating the QR code verification method for paper bag production provided in Embodiment 1 of the present invention. Detailed Implementation

[0018] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. The components of the embodiments of the present invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.

[0019] Example 1 This embodiment provides a QR code verification method for paper bag production. (See attached document.) Figure 1 This includes the following steps: First, based on the product information of the paper bag and the products inside the paper bag, an encoded information and verification feature value are generated through encrypted hashing, and a QR code is printed on the first surface of the paper bag.

[0020] As a preferred embodiment, the method for generating the encoded information is as follows: ; ; in, The encoded information, For the cryptographic hash operation, The string is constructed based on the product information. This is a product information code, whereby the product information includes the product's production batch code. Production date The total number of products from the same production batch as the products inside the paper bag. and disturbance factor , This is an XOR operator used to assign paper bag numbers to products from the same production batch, based on the order in which the QR codes are printed. The number of the paper bag is represented in binary form, with the high-order bits padded with 0s to make the sum of the number of bits equal to the number of the paper bag. Consistent.

[0021] This embodiment uses an XOR operation to fuse the product information code with the binary form of the paper bag number. Since the XOR operation is reversible, the encoding method described in this embodiment allows for the recovery of the corresponding paper bag number from the QR code during subsequent QR code verification by combining the product information code corresponding to the current production batch. Because the same production batch corresponds to the same product information code, while different paper bags have different paper bag numbers, only the paper bag number needs to be changed to generate different encoding information. This eliminates the need to repeatedly perform hash operations for each product in the same batch, thus improving the efficiency of QR code generation on the production line.

[0022] In addition, the string formed by concatenating the product information It can also include information such as manufacturer, product name, and specifications, set according to production needs. Products in the same production batch have the same string of product information concatenated together. The paper bag number also serves as a product number, allowing different products in the same production batch to have different coded information.

[0023] Meanwhile, the method for generating the verification feature value is as follows: ; in, The verification feature value, This refers to binary to decimal conversion operations. For modulo operation, The preset batch modulus base, It is a prime number and its value range is 1. Products from different production batches This reduces the probability of different encoded information corresponding to the same check feature value (reducing remainder clustering) and improves the discriminative power of the check feature value. By limiting its value range, it further ensures that the check feature value will not repeat too much, nor will it waste computational resources due to excessive bits.

[0024] The batch modulus cardinality is equivalent to the identification information of the production batch, which facilitates subsequent batch mixing identification. Since the batch modulus cardinality is a prime number, and the batch modulus cardinality of different production batches is different, it means that there is no common factor greater than 1 between the batch modulus cardinality of different batches.

[0025] Then, the paper bags in the verification batch are sequentially transported to the image acquisition device via a conveyor belt, where an image of the first surface of the paper bag is captured. Based on image recognition, the QR code is selected by a preset-sized recognition frame to obtain the QR code image to be verified. One verification batch includes paper bags corresponding to products from one production batch. The size of the recognition frame is set to be able to completely select the QR code. Generally, the QR code size and shooting angle of the paper bags in a production batch are the same, so a uniform-sized recognition frame can be used. The specific size design is determined based on actual conditions such as shooting posture, paper bag size, and QR code size.

[0026] Next, each QR code image to be verified is processed as follows: Step S1: Calculate the dynamic pixel grayscale threshold and the effective pixel percentage threshold based on the grayscale value distribution of the QR code image to be verified. Effective pixels are pixels with grayscale values ​​greater than the dynamic pixel grayscale threshold. Perform a missing print verification based on the dynamic pixel grayscale threshold and the effective pixel percentage threshold. If the missing print verification fails, proceed to step S2; if the missing print verification passes, proceed to step S3.

[0027] On the one hand, the dynamic pixel grayscale threshold is calculated. The method is as follows: Calculate the average grayscale value of all pixels in the QR code image to be verified. and grayscale standard deviation ; Calculate the dynamic pixel grayscale threshold of the QR code image to be verified. : ; in, and These are the first adjustment coefficient and the second adjustment coefficient, respectively. As an implementation example, The value is 1. The value is 1.2.

[0028] In the above scheme, the average gray value of all pixels is used to reflect the overall brightness level of the current QR code image, and the gray standard deviation is used to reflect the degree of gray dispersion between the black and white modules in the QR code image. When the QR code is clearly printed, there is a large gray difference between its black and white modules, so the gray standard deviation is relatively large; when the QR code has missing prints, ink diffusion, or image blurring, the corresponding gray standard deviation will decrease. At the same time, in order to avoid the difficulty in identifying local missing prints due to relying solely on overall gray information, this embodiment divides the QR code image to be verified into multiple sub-regions, and calculates the average gray value and gray standard deviation of each sub-region separately.

[0029] On the other hand, the method for setting the effective pixel percentage threshold is as follows: Obtain the average percentage of valid pixels in multiple historical QR code verification images. and standard deviation ; Calculate the effective pixel percentage threshold : ; in, This is the third adjustment coefficient. A value of 1-1.3 is acceptable.

[0030] This embodiment utilizes historical normal QR code images to establish a dynamic proportion threshold, enabling the threshold to automatically adjust according to production status. When the printing quality of historical QR codes is relatively stable, the standard deviation of its effective pixel proportion is small. At this time, the calculated effective pixel proportion threshold is closer to the historical average level, improving the sensitivity of missing print detection. Conversely, when normal QR codes experience fluctuations due to ink conditions, the standard deviation of the effective pixel proportion increases, and the effective pixel proportion threshold decreases accordingly. This allows for a certain tolerance, preventing normal QR codes from being misjudged as missing prints due to slight printing fluctuations.

[0031] Based on this, the method for performing the missing print verification is as follows: Calculate the percentage of valid pixels in the QR code image to be verified. : ; in, The total number of pixels in the QR code image to be verified. The grayscale value of the QR code image to be verified is not less than The total number of pixels; If the percentage of effective pixels If the percentage of valid pixels is greater than the threshold, the missing print verification is qualified; otherwise, the missing print verification is unqualified.

[0032] Step S2: Trace the source of printing errors by establishing paper bag status events and image acquisition events. If a system anomaly is traced, a verification system data acquisition error alarm is issued; if no system anomaly is traced, a QR code verification failure alarm is issued. It is worth noting that when a verification system data acquisition error alarm is issued, the system can be stopped for verification, and afterwards, the process can return to step S1 to verify the current paper bag.

[0033] In this embodiment, the method for establishing the paper bag state event and the image acquisition event is as follows: A photoelectric sensor is positioned along the conveyor belt path in front of the image acquisition device, and the distance between the photoelectric sensor and the image acquisition device is [distance]. ; In the verification batch The sensing time is recorded when a paper bag passes by the photoelectric sensor. And establish the first verification batch The paper bag state event of the paper bag , The value range is from 1 to the total number of paper bags in the verification batch. ; When the image acquisition device takes a picture, it records the first... The shooting time of this shot , The value range is from 1 to the total number of photos taken within the verification batch. and establish the first The image acquisition event of the next capture , For the first The QR code image to be verified was obtained from the second photograph.

[0034] Based on the above scheme, the method for tracing the source of the missing print anomaly is as follows: Calculate the first in the verification batch Time matching parameters between the paper bag status event and the image acquisition event of a paper bag : ; in, Tolerance time for deviation It is a natural exponential function. The conveyor belt's transport speed; like If the value is not less than the preset time matching parameter threshold, the result of the missing print anomaly tracing is that no system anomaly was traced; otherwise, the result of the missing print anomaly tracing is that a system anomaly was traced, and the time matching parameter threshold is 0.606.

[0035] The above method is equivalent to determining whether a complete image can be captured by calculating the difference between the theoretical time it takes for the paper bag to reach the shooting device and the shooting time.

[0036] The system is generally preset to take a picture when the paper bag reaches the center of the shooting angle. However, due to factors such as conveyor belt speed fluctuations, changes in paper bag spacing, trigger signal delays, and variations in the image acquisition device's response time, the QR code area may not be fully captured during image acquisition. Therefore, after identifying potential omissions in step S1, it is necessary to consider omissions caused by system errors (not actual omissions) to avoid misjudgment. This embodiment uses an exponentially constructed... Instead of directly adopting and The difference is used to express the degree of time matching between the paper bag state event and the image acquisition event. The purpose is to normalize the data, so that the time matching parameters of different verification scenarios (different transportation speeds, different photoelectric sensor positions, etc.) are mapped to a unified range. The same value represents the same degree of deviation. Except for threshold judgment, the degree of difference between the actual deviation time and the corresponding tolerance deviation time is clear at a glance, and the relevant threshold can be set to a unified value without modification according to different scenarios.

[0037] It should be noted that the tolerance deviation time can be calculated by taking multiple photos of the paper bags of the same production batch. The method is as follows: According to the QR code verification method, the paper bags are transported via the conveyor belt, and K of them are photographed. The key positioning parameters of the QR code for each paper bag are recorded. ; in, For the first The set of key positioning parameters for the QR code of the paper bag. , For the first The row index of the pixel at the top left corner of the QR code image to be verified in the image of the first surface of the paper bag. For the first The maximum difference in row indices of all pixels in the QR code image to be verified in the image of the first surface of the paper bag, wherein the row index direction is opposite to the conveyor belt transport direction; Calculate the tolerance deviation time : ; in, This represents finding the minimum value under the variation of q. This represents finding the minimum value among the multiple parameters within the parentheses. To map row indices to actual transport distances, The total number of row indices in the QR code image to be verified.

[0038] Based on the above tolerance deviation time This allows the time matching judgment to simultaneously adapt to situations where the main body of the paper bag is not completely centered but the QR code is still within the valid collection area.

[0039] Step S3: Perform error verification based on the encoding information and verification feature value recorded in the QR code. If the error verification fails, issue a QR code verification failure alarm. If the error verification passes, the QR code image passes the QR code verification.

[0040] The preferred error verification method in this embodiment is: The error code is verified sequentially based on the encoded information and the verification feature value. If both are qualified, the error code verification is qualified; otherwise, the error code verification is unqualified.

[0041] Specifically, the method for verification based on the encoded information is as follows: The product information of the current verification batch is obtained through the production execution system, and the theoretical product information code is generated based on the product information. Based on the coding information of the paper bag and the theoretical product information code, the binary form of the paper bag's serial number is calculated, and the serial number (i.e., the theoretical value) is obtained through data conversion. A set of paper bag serial numbers is then established. ; in, This represents the set of paper bag numbers in the verification batch. These are the number of the i-th paper bag in the verification batch and the QR code image to be verified, respectively. When obtaining the number of each paper bag, verify the continuity of the number. If the continuity verification passes, the verification based on the coding information is qualified. If the continuity verification fails, mark the paper bag as having an undetermined result based on the coding information. After obtaining all the paper bag numbers, arrange all the paper bag numbers in the paper bag number set in ascending order and determine whether there are duplicates or missing codes. If there are no duplicates and no missing codes, record all paper bags with undetermined results based on the coding information as qualified based on the coding information. Otherwise, record paper bags involving duplicates and / or missing codes as unqualified based on the coding information.

[0042] The purpose of verifying the encoded information is to check whether the encoded information (product information code and paper bag number) within a production batch is correct. This involves screening for misprinted QR codes; any error in the product information code or paper bag number will result in an incorrect calculated paper bag number. This embodiment is based on the reverse calculation of the formula: .here The actual coding information of the paper bags used. It is a theoretical value. and Any error will result in changes to the actual encoded information. It does not conform to the theory, as long as The discrepancy with the theory was obtained by reverse deduction based on the formula. If that's wrong, then the final converted paper bag number will also be wrong.

[0043] It's important to note that the paper bags can be fed onto the conveyor belt sequentially according to the order of the printed QR codes. In this case, the verification order of the paper bags is the coding order, allowing you to verify if the numbers of the obtained paper bags are consecutive. However, in reality, transportation errors may occur, causing the order in which the paper bags are fed onto the conveyor belt to be inconsistent with the order of the paper bag numbers. Therefore, if a continuity issue arises, you cannot directly determine if the QR code is incorrect. Instead, after obtaining all the paper bag numbers, verify whether the paper bag numbers are unique and whether the maximum value of the paper bag number is the total number of paper bags in that production batch (completeness). If both conditions are met, it indicates that the coding information within the batch is complete and correct.

[0044] Furthermore, the method for verification based on the aforementioned verification feature values ​​is to establish a theoretical verification feature value calculation model for each of the paper bags: ; in, For the verification batch of the first The verification feature value of the paper bag theory, To obtain the first product in the verification batch based on the product information of the current verification batch The encoded information of the paper bag theory This is the batch modulo base for the current verification batch; Scan the QR code to obtain the verification batch number. The actual verification feature value of each paper bag ,like If the verification based on the verification feature value is successful, then the verification based on the verification feature value is unsuccessful; otherwise, the verification based on the verification feature value is unsuccessful.

[0045] The purpose of verification based on the aforementioned verification feature value is to check for batch disorder. Batch modulo base. Its function is essentially a production batch identification code. Theoretically, the encoded information and the batch modulus can yield a theoretical verification characteristic value. If the current paper bag belongs to the production batch being verified (i.e., its batch modulus value is consistent with the value used in the current verification calculation), then... It will match the actual verification characteristic value of the paper bag. If the paper bag is a product from another production batch that was accidentally mixed in (the product entered the wrong production batch), its batch mold base is different from the batch mold base of the current verification batch, and it will fail the verification.

[0046] Example 2 This embodiment provides a QR code verification system for paper bag production, applied to the aforementioned QR code verification method for paper bag production, including: The QR code generation module is used to generate encoded information and verification feature values ​​based on the product information of the paper bag and the products inside the paper bag through encrypted hash operation, and then print the QR code on the first surface of the paper bag. A conveyor belt device is used to transport paper bags within a batch for inspection. An image acquisition device is used to acquire an image of the first surface of a paper bag, and based on image recognition, selects a QR code through a recognition frame of a preset size to obtain the image of the QR code to be verified. The verification module is used to perform the missing print verification, the missing print anomaly tracing, and the error code verification.

[0047] The above are merely preferred embodiments of the present invention and are not intended to limit the present invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. A QR code verification method for paper bag production, characterized in that, Includes the following steps: Based on the product information of the paper bag and the products inside the paper bag, the encoded information and verification feature value are generated through encrypted hash operation, and a QR code is printed on the first surface of the paper bag; Paper bags from the verification batch are sequentially transported to the image acquisition device via a conveyor belt, where an image of the first surface of the paper bags is captured. Based on image recognition, a QR code is selected using a preset-sized recognition frame to obtain the QR code image to be verified. Each verification batch includes paper bags corresponding to products from one production batch. Each QR code image to be verified is processed as follows: Calculate the dynamic pixel grayscale threshold and the effective pixel percentage threshold based on the grayscale value distribution of the QR code image to be verified. The effective pixel is the pixel whose grayscale value is greater than the dynamic pixel grayscale threshold. Perform missing print verification based on the dynamic pixel grayscale threshold and the effective pixel percentage threshold. If the missing print verification fails, the missing print anomaly is traced by establishing paper bag status events and image acquisition events. If the system anomaly is traced back, a verification system data acquisition error alarm is issued. If the system anomaly is not traced back, a QR code verification failure alarm is issued. If the missing code verification passes, then an error code verification is performed based on the encoding information and verification feature value recorded in the QR code. If the error code verification fails, a QR code verification failure alarm is issued. If the error code verification passes, then the QR code verification of the QR code image is successful.

2. The QR code verification method for paper bag production according to claim 1, characterized in that, The method for generating the encoded information is as follows: ; ; in, The encoded information, For the cryptographic hash operation, The string is constructed based on the product information. This is a product information code, whereby the product information includes the product's production batch code. Production date The total number of products from the same production batch as the products inside the paper bag. and disturbance factor , This is an XOR operator used to assign paper bag numbers to products from the same production batch, based on the order in which the QR codes are printed. The number of the paper bag is represented in binary form, with the high-order bits padded with 0s to make the sum of the number of bits equal to the number of the paper bag. Consistent; The method for generating the verification feature value is as follows: ; in, The verification feature value, This refers to binary to decimal conversion operations. For modulo operation, The preset batch modulus base, It is a prime number and its value range is 1. Products from different production batches different.

3. The QR code verification method for paper bag production according to claim 2, characterized in that, The method for performing the error code verification is as follows: verification is performed sequentially based on the encoded information and the verification feature value. If both are qualified, the error code verification is qualified; otherwise, the error code verification is unqualified.

4. The QR code verification method for paper bag production according to claim 3, characterized in that, The method for verification based on the encoded information is as follows: The product information of the current verification batch is obtained through the production execution system, and the theoretical product information code is generated based on the product information. Based on the coding information of the paper bag and the theoretical product information code, the binary form of the paper bag number is calculated through an XOR inverse operation, and the paper bag number is obtained through data conversion, thus establishing a paper bag number set: ; in, This represents the set of paper bag numbers in the verification batch. These are the number of the i-th paper bag in the verification batch and the QR code image to be verified, respectively. When obtaining the number of each paper bag, verify the continuity of the number. If the continuity verification passes, the verification based on the coding information is qualified. If the continuity verification fails, mark the paper bag as pending verification based on the coding information. After obtaining all the paper bag numbers, arrange all the paper bag numbers in the paper bag number set in ascending order and determine whether there are duplicates or missing codes. If there are no duplicates and no missing codes, record all paper bags with pending verification results based on the coding information as qualified. Otherwise, record paper bags involving duplicates and / or missing codes as unqualified. The method for verification based on the aforementioned verification feature values ​​is as follows: A theoretical verification feature value calculation model is established for each paper bag: ; in, For the verification batch of the first The verification feature value of the paper bag theory, To obtain the first product in the verification batch based on the product information of the current verification batch The encoded information of the paper bag theory This is the batch modulo base for the current verification batch; Scan the QR code to obtain the verification batch number. The actual verification feature value of each paper bag ,like If the verification based on the verification feature value is successful, then the verification based on the verification feature value is unsuccessful; otherwise, the verification based on the verification feature value is unsuccessful.

5. The QR code verification method for paper bag production according to claim 1, characterized in that, Calculate the dynamic pixel grayscale threshold The method is as follows: Calculate the average grayscale value of all pixels in the QR code image to be verified. and grayscale standard deviation ; Calculate the dynamic pixel grayscale threshold of the QR code image to be verified. : ; in, and These are the first adjustment coefficient and the second adjustment coefficient, respectively. The method for calculating the effective pixel percentage threshold is as follows: Obtain the average percentage of valid pixels in multiple historical QR code verification images. and standard deviation ; Calculate the effective pixel percentage threshold : ; in, This is the third adjustment coefficient.

6. The QR code verification method for paper bag production according to claim 5, characterized in that, The method for performing the missing print verification is as follows: Calculate the percentage of valid pixels in the QR code image to be verified. : ; in, The total number of pixels in the QR code image to be verified. The grayscale value of the QR code image to be verified is not less than The total number of pixels; If the percentage of effective pixels If the percentage of valid pixels is greater than the threshold, the missing print verification is qualified; otherwise, the missing print verification is unqualified.

7. The QR code verification method for paper bag production according to claim 1, characterized in that, The method for establishing the paper bag state event and the image acquisition event is as follows: A photoelectric sensor is positioned along the conveyor belt path in front of the image acquisition device, and the distance between the photoelectric sensor and the image acquisition device is [distance]. ; In the verification batch The sensing time is recorded when a paper bag passes by the photoelectric sensor. And establish the first verification batch The paper bag state event of the paper bag , The value range is from 1 to the total number of paper bags in the verification batch. ; When the image acquisition device takes a picture, it records the first... The shooting time of this shot , The value range is from 1 to the total number of photos taken within the verification batch. and establish the first The image acquisition event of the next capture , For the first The QR code image to be verified was obtained from the second photograph.

8. The QR code verification method for paper bag production according to claim 7, characterized in that, The method for tracing the source of the aforementioned printing omission anomaly is as follows: Calculate the first in the verification batch Time matching parameters between the paper bag status event and the image acquisition event of a paper bag : ; in, Tolerance time for deviation It is a natural exponential function. The conveyor belt's transport speed; like If the value is not less than the preset time matching parameter threshold, the result of the missing print anomaly tracing is that no system anomaly was traced; otherwise, the result of the missing print anomaly tracing is that a system anomaly was traced, and the time matching parameter threshold is 0.

606.

9. The QR code verification method for paper bag production according to claim 8, characterized in that, The tolerance deviation time was calculated by taking multiple photos of the paper bags from the same production batch. The method is as follows: According to the QR code verification method, the paper bags are transported via the conveyor belt, and K of them are photographed. The key positioning parameters of the QR code for each paper bag are recorded. ; in, For the first The set of key positioning parameters for the QR code of the paper bag. , For the first The row index of the pixel at the top left corner of the QR code image to be verified in the image of the first surface of the paper bag. For the first The maximum difference in row indices of all pixels in the QR code image to be verified in the image of the first surface of the paper bag, wherein the row index direction is opposite to the conveyor belt transport direction; Calculate the tolerance deviation time : ; in, This represents finding the minimum value under the variation of q. This represents finding the minimum value among the multiple parameters within the parentheses. To map row indices to actual transport distances, The total number of row indices in the QR code image to be verified.

10. A QR code verification system for paper bag production, applied to the QR code verification method for paper bag production as described in any one of claims 1-9, characterized in that, include: The QR code generation module is used to generate encoded information and verification feature values ​​based on the product information of the paper bag and the products inside the paper bag through encrypted hash operation, and then print the QR code on the first surface of the paper bag. A conveyor belt device is used to transport paper bags within a batch for inspection. An image acquisition device is used to acquire an image of the first surface of a paper bag, and based on image recognition, selects a QR code through a recognition frame of a preset size to obtain the image of the QR code to be verified. The verification module is used to perform the missing print verification, the missing print anomaly tracing, and the error code verification.