A system and method for identifying a colored code for product anti-counterfeiting, and a storage medium

By collecting and analyzing parameters such as resolution, contrast, and shape compactness of the Liuli code images in the cloud, the problem of inaccurate Liuli code recognition has been solved, achieving more efficient and reliable anti-counterfeiting verification.

CN122391689APending Publication Date: 2026-07-14ZHONGKE LIULIMA (GUANGDONG) INFORMATION TECHNOLOGY CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
ZHONGKE LIULIMA (GUANGDONG) INFORMATION TECHNOLOGY CO LTD
Filing Date
2025-12-30
Publication Date
2026-07-14

Smart Images

  • Figure CN122391689A_ABST
    Figure CN122391689A_ABST
Patent Text Reader

Abstract

The application discloses a colored glass code identification system and method for product anti-counterfeiting and a storage medium, relates to the technical field of colored glass code identification, and first collects product anti-counterfeiting colored glass code images uploaded by a user through a cloud, and identifies and analyzes the images to determine an identification result of the colored glass code, so that the authenticity of the anti-counterfeiting colored glass code can be effectively detected and verified, and the accuracy and reliability of the identification process are ensured. The result can be identification success or identification failure. If the identification fails, the system further analyzes the image uploaded by the user, obtains an identification result again, and feeds back the identification result to the user. Necessary guidance can be provided for the user, such as re-uploading the image, so as to reduce misjudgment caused by image quality or other factors. According to the feedback result, if the user is prompted to re-upload the image, the system executes the initial identification step again; and if identification failure is prompted, a notification of identification failure is directly sent to the user.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of glass code recognition technology, specifically to a glass code recognition system, method, and storage medium for product anti-counterfeiting. Background Technology

[0002] Glass codes are small patterns embedded or engraved on the surface of products using a specific process. Their complex structure makes them difficult to replicate, resulting in extremely high anti-counterfeiting capabilities. In practical applications, glass codes rely not only on visual or optical characteristics for identification but also on their unique physical parameters and embedding process to achieve highly reliable product authentication. Glass code identification systems effectively prevent product counterfeiting or tampering, ensuring brand value and consumer rights.

[0003] Existing technologies, such as the invention patent with publication number CN104820817B, describe a four-dimensional barcode, an image recognition system and method based on the four-dimensional barcode, and a retrieval system and method. All concepts in this invention are primarily based on the four-dimensional barcode, which includes a recognition image and a set of recognition data corresponding to the recognition image. The recognition image includes a true-color image, a QR code, colors superimposed on the QR code, and an ID number. The true-color image, QR code, colors superimposed on the QR code, and ID number have the same or corresponding indexes. By storing the data corresponding to the four-dimensional barcode on a server, during recognition or retrieval, scanning the four-dimensional barcode or the recognition image allows for the retrieval of the corresponding data through image recognition processing, which is then returned to the mobile terminal. This invention offers higher recognition accuracy, a wider range of applications, and can be used for various commercial purposes.

[0004] Currently, due to the complexity and diversity of the glass code manufacturing process, the identification process is not accurate and efficient enough, which may affect the accuracy of the identification system, leading to unstable identification results. In fact, misjudgments may occur due to image quality or other factors, further increasing the probability of identification failure and ultimately affecting the effectiveness of the entire anti-counterfeiting system. Summary of the Invention

[0005] To address the shortcomings of existing technologies, this invention provides a glass code identification system, method, and storage medium for product anti-counterfeiting, which can effectively solve the problems mentioned in the background art.

[0006] To achieve the above objectives, the present invention provides the following technical solution: a glass code recognition system for product anti-counterfeiting, comprising a glass code acquisition and scanning module for acquiring images of product anti-counterfeiting glass codes uploaded by users in the cloud, and performing recognition and analysis on the images of product anti-counterfeiting glass codes to obtain the recognition result of the product anti-counterfeiting glass codes, wherein the recognition result of the product anti-counterfeiting glass codes includes recognition success and recognition failure.

[0007] The glass code recognition and analysis module is used to analyze the image of the anti-counterfeiting glass code uploaded by the user when the recognition of the anti-counterfeiting glass code fails, obtain the recognition result of the anti-counterfeiting glass code uploaded by the user, and provide feedback.

[0008] The glass code recognition and display module is used to display anti-counterfeiting information based on the recognition results of the anti-counterfeiting glass code on the product.

[0009] Furthermore, the image of the product's anti-counterfeiting glass code is identified and analyzed to obtain the identification result of the product's anti-counterfeiting glass code. The specific analysis process is as follows: the anti-counterfeiting information of the identified product's anti-counterfeiting glass code is extracted, and the anti-counterfeiting information of the product's anti-counterfeiting glass code is compared with the product standard anti-counterfeiting information of the product's anti-counterfeiting glass code stored in the anti-counterfeiting information database. If the anti-counterfeiting information of the product's anti-counterfeiting glass code is consistent with the product standard anti-counterfeiting information of the product's anti-counterfeiting glass code, the identification result of the product's anti-counterfeiting glass code is defined as successful identification; if the anti-counterfeiting information of the product's anti-counterfeiting glass code is inconsistent with the product standard anti-counterfeiting information of the product's anti-counterfeiting glass code, the identification result of the product's anti-counterfeiting glass code is defined as unsuccessful identification.

[0010] Furthermore, inconsistencies between the anti-counterfeiting information of the product anti-counterfeiting glass code and the product standard anti-counterfeiting information of the product anti-counterfeiting glass code also include null values.

[0011] Furthermore, if the identification based on the product anti-counterfeiting glass code fails, the image of the product anti-counterfeiting glass code uploaded by the user is analyzed: the image of the product anti-counterfeiting glass code uploaded by the user is extracted, the image of the product anti-counterfeiting glass code is processed into grayscale to obtain a grayscale image of the product anti-counterfeiting glass code, the resolution and average contrast of the product anti-counterfeiting glass code image are extracted from the grayscale image of the product anti-counterfeiting glass code, and the first identification characterization value of the product anti-counterfeiting glass code is obtained after processing.

[0012] The image of the anti-counterfeiting glass code uploaded by the user is extracted, and the image of the anti-counterfeiting glass code is segmented to obtain the image of each segmented sub-region of the anti-counterfeiting glass code. The image of each segmented sub-region of the anti-counterfeiting glass code is processed in grayscale, and the area and perimeter of each segmented sub-region of the anti-counterfeiting glass code are counted. The total area and perimeter of each segmented sub-region of the anti-counterfeiting glass code are compared to obtain the shape compactness of each segmented sub-region of the anti-counterfeiting glass code.

[0013] The area of ​​the shadowed region and the total area of ​​each segmented sub-region of the product's anti-counterfeiting glass code are extracted from the image. After processing, the second identification influence characterization value of the product's anti-counterfeiting glass code is obtained.

[0014] Furthermore, the first identification characteristic value of the product's anti-counterfeiting glass code is analyzed under the following specific conditions:

[0015] ;

[0016] This represents the first identification characteristic value of the product's anti-counterfeiting glass code. This indicates the resolution of the product's anti-counterfeiting code image. This indicates the average contrast of the product's anti-counterfeiting glass code image. This indicates the reference resolution of the set glass code. This indicates the reference contrast of the set product anti-counterfeiting glass code image. This represents the correction factor corresponding to the set resolution. This indicates the correction factor corresponding to the set contrast.

[0017] Furthermore, the identification results of the anti-counterfeiting glass codes uploaded by users are obtained and feedback is provided. The specific process is as follows: the first identification characteristic value and the second identification influence characteristic value of the anti-counterfeiting glass codes are extracted, and compared with the set first identification characteristic threshold and second identification influence characteristic threshold of the anti-counterfeiting glass codes, respectively. If the first identification characteristic value of the anti-counterfeiting glass codes is lower than the first identification characteristic threshold or if the second identification influence characteristic value of the anti-counterfeiting glass codes is lower than the second identification influence characteristic threshold, then the identification result of the anti-counterfeiting glass codes uploaded by users is defined as a re-upload, and a feedback prompt is provided.

[0018] If the second identification influence characterization value of the product's anti-counterfeiting glass code is higher than or equal to the second identification influence characterization threshold of the product's anti-counterfeiting glass code, the identification result of the product's anti-counterfeiting glass code uploaded by the user will be defined as an unqualified glass code, and a feedback prompt will be given.

[0019] Furthermore, the process of displaying the product's anti-counterfeiting glass code based on the identification result is as follows: if the identification result of the product's anti-counterfeiting glass code is successful, then the anti-counterfeiting information of the product's anti-counterfeiting glass code is displayed.

[0020] Furthermore, the second identification influence characterization value of the product's anti-counterfeiting glass code is analyzed under the following specific conditions:

[0021] ;

[0022] In the formula, This represents the second identification influence value of the product's anti-counterfeiting glass code. This indicates the shape compactness of the j-th segment of the product's anti-counterfeiting glass code. This indicates the set reference shape compactness. This represents the area of ​​the shaded region in the j-th segment of the product's anti-counterfeiting glass code. This represents the total area of ​​the j-th segmented sub-region of the product's anti-counterfeiting glass code. This indicates the area of ​​the shaded region used to reference the product's anti-counterfeiting glass code. This represents the correction factor corresponding to the set shape compactness. This represents the correction factor corresponding to the set area of ​​the shadow region. This refers to the numbering of each sub-region of the product's anti-counterfeiting glass code. , The total number of sub-regions of the product's anti-counterfeiting glass code, where e represents the natural constant.

[0023] A second aspect of the present invention also provides a method for identifying glass codes for product anti-counterfeiting, comprising:

[0024] S1. Collect images of product anti-counterfeiting glass codes uploaded by users in the cloud, and perform recognition and analysis on the images of product anti-counterfeiting glass codes to obtain the recognition results of product anti-counterfeiting glass codes. The recognition results of product anti-counterfeiting glass codes include recognition success and recognition failure.

[0025] S2. Based on the failure to recognize the product anti-counterfeiting glass code, analyze the image of the product anti-counterfeiting glass code uploaded by the user, obtain the recognition result of the product anti-counterfeiting glass code uploaded by the user and provide feedback. If the feedback of the user's uploaded result prompts to re-upload, continue to execute S1. If the feedback of the user's uploaded result prompts that the recognition failed, directly issue a recognition failure prompt.

[0026] S3. Display anti-counterfeiting information based on the recognition result of the anti-counterfeiting code.

[0027] A third aspect of the present invention also provides a storage medium in which the computer program, when executed by a processor, implements the method as described in any of the preceding claims.

[0028] The present invention has the following beneficial effects:

[0029] This invention provides a glass code recognition system, method, and storage medium for product anti-counterfeiting. First, it collects user-uploaded images of anti-counterfeiting glass codes from the cloud, then identifies and analyzes them to determine the recognition result. This effectively detects and verifies the authenticity of the anti-counterfeiting glass codes, ensuring the accuracy and reliability of the recognition process. The result can be either successful or unsuccessful. If recognition fails, the system further analyzes the user-uploaded image, re-obtains the recognition result, and feeds it back to the user. It provides necessary guidance to the user, such as prompting them to re-upload the image, thereby reducing misjudgments caused by image quality or other factors. Based on the feedback result, if the user is prompted to re-upload the image, the system re-executes the initial recognition steps; if recognition fails, a notification of recognition failure is directly sent to the user.

[0030] This invention enables the system to quickly and accurately determine the authenticity of a product by comparing actual identification information with standard anti-counterfeiting information, thereby improving the reliability and accuracy of the anti-counterfeiting system and providing users with a safer and more reliable anti-counterfeiting verification service.

[0031] (3) This invention obtains the second identification influence characterization value of the product's anti-counterfeiting glass code through processing. This helps to comprehensively analyze the image features of the product's anti-counterfeiting glass code, evaluate the image quality from multiple angles and parameters, and improve the accuracy and reliability of identification. By combining parameters such as image resolution, contrast, shape compactness, and shadow area, the quality and effectiveness of the anti-counterfeiting glass code can be judged more accurately, thereby enhancing the effect of anti-counterfeiting verification and reducing identification errors caused by image quality problems.

[0032] (4) The present invention extracts the first identification characteristic value and the second identification influence characteristic value of the anti-counterfeiting glass code and compares them with the preset identification characteristic thresholds. This helps to ensure that in the identification of the anti-counterfeiting glass code, the glass code is only considered qualified when the key characteristic value of the image meets the set standard. Through this strict comparison mechanism, it is possible to effectively screen out cases of poor image quality or problems with the glass code itself, prevent anti-counterfeiting verification errors caused by image quality or recognition errors, thereby improving the recognition accuracy and reliability of the anti-counterfeiting glass code and ensuring the rigor and accuracy of product anti-counterfeiting.

[0033] Of course, any product implementing this invention does not necessarily need to achieve all of the advantages described above at the same time. Attached Figure Description

[0034] Figure 1 This is a schematic diagram of the overall system modules of the present invention.

[0035] Figure 2 The first identification characteristic curve of the anti-counterfeiting glass code provided by the present invention.

[0036] Figure 3 This is a schematic diagram of the method flow of the present invention. Detailed Implementation

[0037] 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. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0038] In the description of this invention, it should be understood that the terms "opening", "upper", "lower", "thickness", "top", "middle", "length", "inner", "around", etc., which indicate orientation or positional relationship, are only for the convenience of describing this invention and simplifying the description, and do not indicate or imply that the components or elements referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as limiting this invention.

[0039] Please see Figure 1 As shown, this embodiment of the invention provides a technical solution for a glass code recognition system for product anti-counterfeiting: the glass code recognition system for product anti-counterfeiting includes a glass code acquisition and scanning module, which is used to acquire images of product anti-counterfeiting glass codes uploaded by users in the cloud, and to recognize the images of product anti-counterfeiting glass codes to obtain the recognition result of product anti-counterfeiting glass codes. The recognition result of product anti-counterfeiting glass codes includes recognition success and recognition failure.

[0040] The glass code recognition and analysis module is used to analyze the image of the anti-counterfeiting glass code uploaded by the user when the recognition of the anti-counterfeiting glass code fails, obtain the recognition result of the user-uploaded anti-counterfeiting glass code and provide feedback. The recognition result of the user-uploaded anti-counterfeiting glass code includes re-uploading and glass code failure.

[0041] It should be noted that if the image of the anti-counterfeiting glass code uploaded by the user is blurry or the lighting is uneven, the system can analyze the image of the anti-counterfeiting glass code uploaded by the user and prompt the user to re-upload a clear and evenly lit image.

[0042] The glass code recognition and display module is used to display the recognition results of the anti-counterfeiting glass code on the product.

[0043] Specifically, the image of the product's anti-counterfeiting glass code is recognized to obtain the recognition result. The specific analysis process is as follows: the image of the product's anti-counterfeiting glass code is recognized, and the anti-counterfeiting information of the recognized product's anti-counterfeiting glass code is extracted. The anti-counterfeiting information of the product's anti-counterfeiting glass code is compared with the product standard anti-counterfeiting information of the product's anti-counterfeiting glass code stored in the anti-counterfeiting information database. If the anti-counterfeiting information of the product's anti-counterfeiting glass code is consistent with the product standard anti-counterfeiting information of the product's anti-counterfeiting glass code, the recognition result of the product's anti-counterfeiting glass code is defined as successful recognition. If the anti-counterfeiting information of the product's anti-counterfeiting glass code is inconsistent with the product standard anti-counterfeiting information of the product's anti-counterfeiting glass code, the recognition result of the product's anti-counterfeiting glass code is defined as unsuccessful recognition.

[0044] It should be noted that the specific process for extracting the anti-counterfeiting information from the identified product's anti-counterfeiting code is as follows: First, the image uploaded by the user is preprocessed. This includes noise reduction, grayscale processing, contrast adjustment, and illumination compensation. Next, image segmentation technology is used to divide the product's anti-counterfeiting code image into multiple sub-regions, which helps extract feature information from each region. After image preprocessing and segmentation, SIFT (Scale Invariant Feature Transform) is used to extract the key features of the anti-counterfeiting code from the image. For anti-counterfeiting codes containing characters, OCR technology can be used to extract text information from the image. Once the features are extracted, the next step is decoding. Methods such as hash matching and string comparison are used to convert the encoded information in the image into readable anti-counterfeiting information, including unique codes, production batches, and manufacturing dates. Finally, the decoded information can be compared with the product's standard anti-counterfeiting information in the database to verify the product's authenticity. Consumers can quickly query the product's anti-counterfeiting information and related traceability information by scanning the code.

[0045] It should be noted that the product standard anti-counterfeiting information of the product anti-counterfeiting glass code includes:

[0046] 1. Unique identification code (serial number), a unique code (QR code, barcode or other unique code) used to identify each product.

[0047] 2. Production date, for example, "2023-02-30".

[0048] 3. Batch number, for example, "2024-BATCH-001".

[0049] 4. Product model, for example, "ABC123".

[0050] 5. Security features, such as visual features like watermarks or tiny characters.

[0051] Specifically, the anti-counterfeiting information on the product's anti-counterfeiting glass code is inconsistent with the product standard anti-counterfeiting information on the product's anti-counterfeiting glass code, and the anti-counterfeiting information also includes null values.

[0052] It should be noted that if the anti-counterfeiting information on the product's anti-counterfeiting code is inconsistent with the standard anti-counterfeiting information in the anti-counterfeiting information database, it may include:

[0053] A1. Any one or more of the anti-counterfeiting information in the glass code, such as the unique code, production date, batch number, product model, or security features, is inconsistent with the standard anti-counterfeiting information in the anti-counterfeiting information database, or any one or more of the anti-counterfeiting information is empty.

[0054] A2. Encoding Error: The unique identification code or serial number of the glass code is incorrect, such as due to incorrect encoding or a damaged label, causing the anti-counterfeiting information of the product's anti-counterfeiting glass code to be inconsistent with the product's standard anti-counterfeiting information.

[0055] A3. Image Deviation: Due to factors such as shooting angle and lighting conditions, image features were not accurately identified, resulting in the anti-counterfeiting information of the product's anti-counterfeiting glass code being empty, i.e., a null value. Therefore, it is inconsistent with the product's standard anti-counterfeiting information.

[0056] A4. Product quality issues: Damage or deformation of the product surface causes the glass code to fail to be recognized, resulting in the anti-counterfeiting information of the product's anti-counterfeiting glass code being empty, i.e., a null value, which is inconsistent with the product standard anti-counterfeiting information of the product's anti-counterfeiting glass code.

[0057] A5. Physical damage to the glass code: Damage or wear to the surface of the glass code may cause the anti-counterfeiting information of the product's anti-counterfeiting glass code to be empty, i.e., a null value, which is inconsistent with the product's standard anti-counterfeiting information.

[0058] Specifically, based on the failure to recognize the product's anti-counterfeiting glass code, the image of the product's anti-counterfeiting glass code uploaded by the user is analyzed: the image of the product's anti-counterfeiting glass code uploaded by the user is extracted, and the image of the product's anti-counterfeiting glass code is processed into grayscale to obtain a grayscale image of the product's anti-counterfeiting glass code. The resolution and average contrast of the product's anti-counterfeiting glass code image are extracted from the grayscale image of the product's anti-counterfeiting glass code, and the first recognition characteristic value of the product's anti-counterfeiting glass code is obtained after processing.

[0059] It should be noted that the process of extracting the resolution and average contrast of the product anti-counterfeiting code image from the grayscale image is as follows: The image size information is read using an image processing library or software (such as OpenCV, PIL, etc.), directly obtaining the image's width (in pixels) and height (in pixels). The contrast ratio can be represented by the image's standard deviation. The standard deviation calculation considers the difference between the grayscale value of each pixel and the average grayscale value. Specifically, the square of the difference between the grayscale value of each pixel and the average grayscale value is calculated, and the average of all squared differences is the variance. The square root of the variance is then taken to obtain the standard deviation. The larger the standard deviation, the higher the contrast ratio, and the more pronounced the grayscale level changes in the image.

[0060] It should be noted that the specific analysis conditions for the first identification characteristic value of the product's anti-counterfeiting glass code are as follows:

[0061] ;

[0062] This represents the first identification characteristic value of the product's anti-counterfeiting glass code. This indicates the resolution of the product's anti-counterfeiting code image. This indicates the average contrast of the product's anti-counterfeiting glass code image. This indicates the reference resolution of the set glass code. This indicates the reference contrast of the set product anti-counterfeiting glass code image. This represents the correction factor corresponding to the set resolution. This indicates the correction factor corresponding to the set contrast.

[0063] It should be noted that glass codes from the same batch may have similar manufacturing parameters, thus their overall characteristics (such as color contrast, shape compactness, and shadow area area) may be consistent. Therefore, data can be collected from successfully identified glass code images of the same batch in the database, including color contrast, shape compactness, shadow area area, grayscale value, and resolution. By analyzing the successfully identified glass codes from the same batch and performing statistical analysis on their feature parameters, calculating the average value of each feature parameter, a reference feature range or standard can be established as a basis for comparison.

[0064] It should be noted that, as Figure 2 As shown, Figure 2 This is the first identification characteristic curve of the product's anti-counterfeiting glass code, specifically the first identification characteristic value of a certain product's anti-counterfeiting glass code. It represents the first identification characteristic curve corresponding to the average contrast of different anti-counterfeiting glass code images of a certain product. The x-axis represents the resolution of the product's anti-counterfeiting glass code image, and the y-axis represents the first identification characteristic value of the product's anti-counterfeiting glass code. The figure defines three different sets of example parameters, corresponding to different cases of the three curves, represented by solid lines, dashed lines, and dotted lines, respectively. The corresponding curve labels are a, b, and c. When the product's anti-counterfeiting glass code image... The relationship between the resolution of the anti-counterfeiting code image and the first recognition value of the anti-counterfeiting code is illustrated by curve a when the average contrast ratio is 2.0. Similarly, curve b shows the relationship when the average contrast ratio is 4.0, and curve c shows the relationship when the average contrast ratio is 7.0. Furthermore, the first recognition value of the anti-counterfeiting code exhibits an increasing trend as the resolution of the anti-counterfeiting code image changes. When the resolution of the anti-counterfeiting code image gradually approaches the reference resolution, the first recognition value of the anti-counterfeiting code increases significantly.

[0065] As shown in Table 1, Table 1 provides example data on the first identification characteristic value of the product's anti-counterfeiting glass code, which includes the resolution of the product's anti-counterfeiting glass code image, the average contrast of the product's anti-counterfeiting glass code image, and the first identification characteristic value of the product's anti-counterfeiting glass code.

[0066] Table 1. Example data of the first identification characteristic value curve of a product's anti-counterfeiting glass code.

[0067] 2 6 1.465 4 10 1.532 7 12 1.494

[0068] As shown in Table 1, in one specific embodiment, the reference resolution of the anti-counterfeiting code is 10 pixels / inch, the reference contrast of the product anti-counterfeiting code image is 5, the correction factor corresponding to the resolution is 0.5, and the correction factor corresponding to the contrast is 0.8. As the resolution of the product anti-counterfeiting code image changes, the first recognition characteristic value of the product anti-counterfeiting code shows an increasing trend. When the resolution of the product anti-counterfeiting code image gradually approaches the reference resolution, the first recognition characteristic value of the product anti-counterfeiting code will increase significantly.

[0069] In one specific embodiment, the correction factor corresponding to the resolution ranges from 0 to 1, representing the numerical value of the influence of image resolution on the recognition quality of the glass code. In use, the correction factor corresponding to the resolution can be directly obtained from the anti-counterfeiting information database, and the correspondence can be a pre-defined mapping relationship. For example, the resolution and the preset correction factors corresponding to the resolution in the image processing anti-counterfeiting information database form a mapping set. The actual resolution of the glass code image uploaded by the user is input into the mapping set to obtain the correction factor corresponding to the resolution. The mapping relationship can be one-to-one or many-to-one.

[0070] In one specific embodiment, the correction factor corresponding to the contrast ratio also ranges from 0 to 1, representing the degree of influence of image contrast ratio on the quality of the QR code recognition. In use, the correction factor corresponding to the contrast ratio can be directly obtained from the anti-counterfeiting information database, and the correspondence can be a pre-defined mapping relationship. For example, the contrast ratio and the pre-defined correction factors corresponding to the contrast ratio in the image processing anti-counterfeiting information database form a mapping set, and the correction factor corresponding to the contrast ratio is obtained by inputting the actual contrast ratio of the image into the mapping set. This mapping relationship can be a one-to-one correspondence or a many-to-one relationship.

[0071] In one specific embodiment, the resolution and average contrast of the product's anti-counterfeiting code image are not independent parameters. For example, image resolution affects not only the ability to capture image details but also the image's sharpness, while average contrast determines the salience of the code features within the image. Higher image resolution typically allows for more precise capture of the code's detailed features, which affects the average contrast. Lower image resolution may result in blurred details, affecting contrast accuracy and thus reducing the effectiveness of code recognition. Simultaneously, the impact of average contrast on resolution is significant; higher contrast enhances the visibility of the code, making its features clearer and improving recognition accuracy. By comprehensively analyzing both image resolution and average contrast, the image quality of the code can be better evaluated, helping to ensure higher recognition reliability and accuracy.

[0072] The image of the anti-counterfeiting glass code uploaded by the user is extracted, and the image of the anti-counterfeiting glass code is segmented to obtain the image of each segmented sub-region of the anti-counterfeiting glass code. The image of each segmented sub-region of the anti-counterfeiting glass code is processed in grayscale, and the area and perimeter of each segmented sub-region of the anti-counterfeiting glass code are counted. The total area and perimeter of each segmented sub-region of the anti-counterfeiting glass code are compared to obtain the shape compactness of each segmented sub-region of the anti-counterfeiting glass code.

[0073] It's important to note that segmenting the image of a product's anti-counterfeiting code first requires preprocessing the entire image using image processing techniques. Preprocessing steps typically include grayscale conversion, noise reduction, and contrast enhancement to highlight the key features of the code. After preprocessing, the entire code area is segmented into multiple sub-regions using the findContours function. For example, to segment the code of an electronic product, a high-resolution image of the code is first captured. After grayscale conversion, Gaussian blur is used to remove noise, followed by Canny edge detection to obtain the code's edge information. Next, a contour extraction algorithm identifies the main contours of the code. A contour can be viewed as a set of closed edges in the image; for example, each spray dot has a contour, and the contour data includes the shape, size, and position of each spray dot. The area enclosed by each contour in the image is considered a sub-region. For example, if ten spray dots are detected in the image, the contour of each spray dot represents an independent sub-region, thus dividing the entire anti-counterfeiting code image into multiple sub-regions. After segmentation, the sub-regions can be further used for subsequent anti-counterfeiting verification.

[0074] It should be noted that the area and perimeter of each segmented sub-region of the product's anti-counterfeiting code are represented in pixels. The area helps detect the integrity of the code and whether there is any damage or wear, while the perimeter helps identify complex edge structures and shape features. The shape compactness is calculated by the ratio of area to perimeter, which is used to evaluate the shape characteristics of the region.

[0075] It should be noted that the total area of ​​each segmented sub-region of the product's anti-counterfeiting code refers to the area of ​​the segmented sub-region itself, that is, the sum of all pixels in that region. Given a fixed total number of pixels in the image, it represents the true size of that sub-region within the image.

[0076] It should be noted that the compactness of the shape of each segmented sub-region of the product's anti-counterfeiting glass code is measured by comparing the area and perimeter of each segmented region. The smaller the value, the more complex or irregular the shape. This helps to detect the shape consistency of the glass code area during the embedding process and to determine whether there are any process errors or deformations.

[0077] The area of ​​the shadowed region and the total area of ​​each segmented sub-region of the product's anti-counterfeiting glass code are extracted from the image. After processing, the second identification influence characterization value of the product's anti-counterfeiting glass code is obtained.

[0078] It should be noted that the second identification influence value of the product's anti-counterfeiting glass code is analyzed under the following conditions:

[0079] ;

[0080] In the formula, This represents the second identification influence value of the product's anti-counterfeiting glass code. This indicates the shape compactness of the j-th segment of the product's anti-counterfeiting glass code. This indicates the set reference shape compactness. This represents the area of ​​the shaded region in the j-th segment of the product's anti-counterfeiting glass code. This represents the total area of ​​the j-th segmented sub-region of the product's anti-counterfeiting glass code. This indicates the area of ​​the shaded region used to reference the product's anti-counterfeiting glass code. This represents the correction factor corresponding to the set shape compactness. This represents the correction factor corresponding to the set area of ​​the shadow region. This refers to the numbering of each sub-region of the product's anti-counterfeiting glass code. , The total number of sub-regions of the product's anti-counterfeiting glass code, where e represents the natural constant.

[0081] It should be noted that glass codes from the same batch may have similar manufacturing parameters, thus their overall characteristics (such as color contrast, shape compactness, and shadow area area) may exhibit some consistency. Therefore, data can be collected from successfully identified glass code images of the same batch in the database, including color contrast, shape compactness, shadow area area, grayscale value, and resolution. By analyzing the successfully identified glass codes from the same batch and performing statistical analysis on their feature parameters, calculating the average value of each feature parameter, a reference feature range or standard can be established as a basis for comparison.

[0082] It should be noted that the concavity and convexity of each segmented sub-region of the product's anti-counterfeiting glass code, i.e., the ratio of the concave shell area to the actual area, is used to judge the smoothness of the edges and the details of the anti-counterfeiting glass code.

[0083] It should be noted that threshold segmentation technology is used to identify pixels with low grayscale values ​​in the image of the product's anti-counterfeiting code. These low grayscale pixels typically correspond to shadow areas. Shadow thresholds are extracted from the database to segment the image into shadow and non-shadow areas. The `findContours` function from OpenCV (a computer vision and image processing library) is then used to extract the regions formed by these pixels. Finally, the `contourArea` function is used to calculate the area of ​​each region.

[0084] It should be noted that, for a segmented sub-region of a product's anti-counterfeiting glass code, the first step is to obtain the set of contour points for that region through contour detection. Then, based on these contour points, the minimum convex polygon enclosing these points, i.e., the convex hull, is calculated. Finally, the area of ​​the shaded region is obtained by calculating the area of ​​the polygon enclosed by the convex hull. This process can be effectively used to evaluate the complexity and degree of concavity of the region's shape.

[0085] In one specific embodiment, the correction factor corresponding to the shape compactness ranges from 0 to 1, representing the degree of influence of shape compactness on the shape characteristics of the glass code. When used, the correction factor corresponding to the shape compactness can be directly obtained from the anti-counterfeiting information database, and the correspondence can be a pre-defined mapping relationship. For example, the shape compactness and the pre-defined correction factor corresponding to the shape compactness in the anti-counterfeiting information database form a mapping set. The correction factor corresponding to the shape compactness is obtained by inputting the shape compactness into the mapping set. The mapping relationship can be one-to-one or many-to-one.

[0086] In one specific embodiment, the correction factor corresponding to the shaded area ranges from 0 to 1, representing the degree of influence of the shaded area on the complexity of the glass code shape. When used, the correction factor corresponding to the shaded area can be obtained from the anti-counterfeiting information database, and the correspondence can be a pre-defined mapping relationship. For example, the shaded area and the pre-defined correction factors corresponding to the shaded area in the anti-counterfeiting information database form a mapping set. The correction factor corresponding to the shaded area is obtained by inputting the shaded area into the mapping set. The mapping relationship can be one-to-one or many-to-one.

[0087] In one specific embodiment, the three parameters—shape compactness, the area of ​​the shaded region of the product's anti-counterfeiting code, and the total area of ​​the product's anti-counterfeiting code—are not independent. For example, changes in shape compactness directly reflect the degree to which the actual shape of the code deviates from an ideal circle, and this deviation affects the size of the shaded region. When the shape compactness is high, the edges of the code are clearer, and the shaded region is usually smaller because the compact shape reduces unnecessary shadows. Conversely, if the shape compactness is low, the shaded region may increase because the irregularity of the shape may create more shadows at the edges. Meanwhile, the ratio of the shaded region area to the total area reveals the compactness of the actual shape of the code. A larger shaded region area and a smaller total area may indicate that the shape of the code is more dispersed or irregular. An excessively large shaded region may obscure certain features of the code, making identification difficult, which may affect the accuracy and embedding effect of the code. Furthermore, in cases of low shape compactness and a large shaded region area, it may be necessary to analyze and adjust process parameters and optimize the design and manufacturing process of the code to help ensure the stability of the anti-counterfeiting effect and the reliability of identification.

[0088] Specifically, the process involves obtaining and providing feedback on the recognition results of the anti-counterfeiting glass codes uploaded by users. The process includes extracting the first recognition characteristic value and the second recognition influence characteristic value of the anti-counterfeiting glass codes, and comparing them with the set first recognition characteristic threshold and second recognition influence characteristic threshold, respectively. If the first recognition characteristic value is lower than the first recognition characteristic threshold, or if the second recognition influence characteristic value is lower than the second recognition influence characteristic threshold, the recognition result of the user-uploaded anti-counterfeiting glass codes is defined as a re-upload, and a feedback prompt is provided.

[0089] If the second identification influence characterization value of the product's anti-counterfeiting glass code is higher than or equal to the second identification influence characterization threshold of the product's anti-counterfeiting glass code, the identification result of the product's anti-counterfeiting glass code uploaded by the user will be defined as an unqualified glass code, and a feedback prompt will be given.

[0090] It should be noted that the first recognition characteristic value of the product's anti-counterfeiting glass code analyzes the resolution and average contrast of the image. In practical applications, external factors such as lighting conditions, shooting angle, and image acquisition equipment can all affect image quality. These external conditions may cause abnormal changes in image resolution and contrast. When the first recognition characteristic value of the product's anti-counterfeiting glass code (e.g., image resolution and average contrast) is low, it may be due to poor image quality. This situation may be caused by external factors such as unclear shooting, equipment problems, or insufficient lighting, and does not necessarily reflect a quality problem with the glass code itself. Therefore, when the initial product anti-counterfeiting glass code image uploaded by the user fails to be recognized and the first recognition characteristic value of the product's anti-counterfeiting glass code is lower than the first recognition characteristic threshold of the product's anti-counterfeiting glass code, the user can be asked to re-upload a clearer, more standard-compliant image, which can effectively reduce the probability of misjudgment.

[0091] Specifically, the product's anti-counterfeiting glass code is displayed based on the recognition result. The specific process is as follows: if the recognition result of the product's anti-counterfeiting glass code is successful, the anti-counterfeiting information of the product's anti-counterfeiting glass code will be displayed.

[0092] The product anti-counterfeiting glass code recognition system also includes an anti-counterfeiting information database, which stores the product standard anti-counterfeiting information of the product anti-counterfeiting glass code, the first recognition characteristic threshold of the product anti-counterfeiting glass code, the second recognition influence characteristic threshold of the product anti-counterfeiting glass code, the reference shape compactness, the reference shaded area area, the correction factor corresponding to the shape compactness, and the correction factor corresponding to the shaded area area.

[0093] like Figure 3 As shown, a second aspect of the present invention also provides a method for identifying anti-counterfeiting glass codes for products, comprising: S1. collecting images of anti-counterfeiting glass codes uploaded by users in the cloud, and performing identification and analysis on the images of anti-counterfeiting glass codes to obtain identification results of anti-counterfeiting glass codes, wherein the identification results of anti-counterfeiting glass codes include identification success and identification failure.

[0094] S2. Based on the failure to recognize the product anti-counterfeiting glass code, analyze the image of the product anti-counterfeiting glass code uploaded by the user, obtain the recognition result of the product anti-counterfeiting glass code uploaded by the user and provide feedback. If the feedback of the user's uploaded result prompts to re-upload, continue to execute S1. If the feedback of the user's uploaded result prompts that the recognition failed, directly issue a recognition failure prompt.

[0095] S3. Display anti-counterfeiting information based on the recognition result of the anti-counterfeiting code.

[0096] A third aspect of the present invention also provides a storage medium in which the computer program, when executed by a processor, implements the method as described in any of the preceding claims.

[0097] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus.

[0098] The preferred embodiments of the present invention disclosed above are merely illustrative of the invention. These preferred embodiments do not exhaustively describe all details, nor do they limit the invention to the specific implementations described. Clearly, many modifications and variations can be made based on the content of this specification. This specification selects and specifically describes these embodiments to better explain the principles and practical applications of the invention, thereby enabling those skilled in the art to better understand and utilize the invention. The invention is limited only by the claims and their full scope and equivalents.

Claims

1. A glass code recognition system for product anti-counterfeiting, characterized in that, include: The glass code acquisition and scanning module is used to acquire images of anti-counterfeiting glass codes uploaded by users in the cloud, and to identify and analyze the images of anti-counterfeiting glass codes to obtain the identification results of anti-counterfeiting glass codes. The identification results of anti-counterfeiting glass codes include successful identification and failure identification. The glass code recognition and analysis module is used to analyze the image of the anti-counterfeiting glass code uploaded by the user when the recognition of the anti-counterfeiting glass code fails, obtain the recognition result of the anti-counterfeiting glass code uploaded by the user and provide feedback. The recognition result of the anti-counterfeiting glass code uploaded by the user includes re-uploading and glass code failure. The glass code recognition and display module is used to display anti-counterfeiting information based on the recognition results of the anti-counterfeiting glass code on the product.

2. The glass code recognition system for product anti-counterfeiting according to claim 1, characterized in that: The process of recognizing and analyzing the image of the product's anti-counterfeiting glass code to obtain the recognition result of the product's anti-counterfeiting glass code is as follows: The anti-counterfeiting information of the identified product anti-counterfeiting glass code is extracted and compared with the product standard anti-counterfeiting information of the product anti-counterfeiting glass code stored in the anti-counterfeiting information database. If the anti-counterfeiting information of the product anti-counterfeiting glass code matches the product standard anti-counterfeiting information, the identification result of the product anti-counterfeiting glass code is defined as successful identification; if the anti-counterfeiting information of the product anti-counterfeiting glass code does not match the product standard anti-counterfeiting information, the identification result of the product anti-counterfeiting glass code is defined as failed identification.

3. The glass code recognition system for product anti-counterfeiting according to claim 1, characterized in that: The inconsistency between the anti-counterfeiting information of the product anti-counterfeiting glass code and the product standard anti-counterfeiting information of the product anti-counterfeiting glass code also includes null values.

4. The glass code recognition system for product anti-counterfeiting according to claim 1, characterized in that: If the identification based on the product's anti-counterfeiting glass code fails, the image of the product's anti-counterfeiting glass code uploaded by the user will be analyzed: Extract the image of the anti-counterfeiting glass code uploaded by the user, perform grayscale processing on the image of the anti-counterfeiting glass code to obtain the grayscale image of the anti-counterfeiting glass code, extract the resolution and average contrast of the anti-counterfeiting glass code image from the grayscale image of the anti-counterfeiting glass code, and obtain the first identification characterization value of the anti-counterfeiting glass code after processing. Extract the image of the anti-counterfeiting glass code uploaded by the user, segment the image of the anti-counterfeiting glass code to obtain the image of each segmented sub-region of the anti-counterfeiting glass code, perform grayscale processing on the image of each segmented sub-region of the anti-counterfeiting glass code, and count the area and perimeter of each segmented sub-region of the anti-counterfeiting glass code. Compare the total area and perimeter of each segmented sub-region of the anti-counterfeiting glass code to obtain the shape compactness of each segmented sub-region of the anti-counterfeiting glass code. The area of ​​the shadowed region and the total area of ​​each segmented sub-region of the product's anti-counterfeiting glass code are extracted from the image. After processing, the second identification influence characterization value of the product's anti-counterfeiting glass code is obtained.

5. The glass code recognition system for product anti-counterfeiting according to claim 4, characterized in that: The first identification characteristic value of the product's anti-counterfeiting glass code, specifically analyzed under the following conditions: ; This represents the first identification characteristic value of the product's anti-counterfeiting glass code. This indicates the resolution of the product's anti-counterfeiting code image. This indicates the average contrast of the product's anti-counterfeiting glass code image. This indicates the reference resolution of the set glass code. This indicates the reference contrast of the set product anti-counterfeiting glass code image. This represents the correction factor corresponding to the set resolution. This indicates the correction factor corresponding to the set contrast.

6. The glass code recognition system for product anti-counterfeiting according to claim 5, characterized in that: The specific process of obtaining and providing feedback on the identification results of the anti-counterfeiting glass code uploaded by the user is as follows: Extract the first identification characteristic value and the second identification influence characteristic value of the product's anti-counterfeiting glass code, and compare them with the set first identification characteristic threshold and second identification influence characteristic threshold of the product's anti-counterfeiting glass code, respectively. If the first identification characteristic value of the product's anti-counterfeiting glass code is lower than the first identification characteristic threshold of the product's anti-counterfeiting glass code, or if the second identification influence characteristic value of the product's anti-counterfeiting glass code is lower than the second identification influence characteristic threshold of the product's anti-counterfeiting glass code, then define the identification result of the product's anti-counterfeiting glass code uploaded by the user as a re-upload, and provide feedback prompts. If the second identification influence characterization value of the product's anti-counterfeiting glass code is higher than or equal to the second identification influence characterization threshold of the product's anti-counterfeiting glass code, the identification result of the product's anti-counterfeiting glass code uploaded by the user will be defined as an unqualified glass code, and a feedback prompt will be given.

7. The glass code recognition system for product anti-counterfeiting according to claim 5, characterized in that: The process of displaying the product's anti-counterfeiting glass code identification result is as follows: If the product's anti-counterfeiting glass code is successfully identified, the anti-counterfeiting information of the product's anti-counterfeiting glass code will be displayed.

8. The glass code recognition system for product anti-counterfeiting according to claim 4, characterized in that: The second identification influence characterization value of the product's anti-counterfeiting glass code is analyzed under the following specific conditions: ; In the formula, This represents the second identification influence value of the product's anti-counterfeiting glass code. This indicates the shape compactness of the j-th segment of the product's anti-counterfeiting glass code. This indicates the set reference shape compactness. This represents the area of ​​the shaded region in the j-th segment of the product's anti-counterfeiting glass code. This represents the total area of ​​the j-th segmented sub-region of the product's anti-counterfeiting glass code. This indicates the area of ​​the shaded region used to reference the product's anti-counterfeiting glass code. This represents the correction factor corresponding to the set shape compactness. This represents the correction factor corresponding to the set area of ​​the shadow region. This refers to the numbering of each sub-region of the product's anti-counterfeiting glass code. , The total number of sub-regions of the product's anti-counterfeiting glass code, where e represents the natural constant.

9. A method for identifying glass codes for product anti-counterfeiting, characterized in that, include: S1. Collect images of product anti-counterfeiting glass codes uploaded by users in the cloud, and perform recognition and analysis on the images of product anti-counterfeiting glass codes to obtain the recognition results of product anti-counterfeiting glass codes. The recognition results of product anti-counterfeiting glass codes include recognition success and recognition failure. S2. Based on the failure to recognize the product anti-counterfeiting glass code, analyze the image of the product anti-counterfeiting glass code uploaded by the user, obtain the recognition result of the product anti-counterfeiting glass code uploaded by the user and provide feedback. If the user upload result feedback prompts to re-upload, continue to execute S1. If the user upload result feedback prompts to recognize failure, directly prompt the recognition failure. S3. Display anti-counterfeiting information based on the recognition result of the anti-counterfeiting code.

10. A storage medium, characterized in that, When the computer program is executed by a processor, it implements the method as described in any one of claims 1-8.