Anti-counterfeiting identification method and device based on AI (Artificial Intelligence)

Through the AI-based anti-counterfeiting recognition method, the feature vector and image correlation of the printed object image are calculated, which solves the problem of insufficient accuracy in authenticity and false identification of printed objects in traditional methods, and achieves higher recognition accuracy and robustness.

CN120339656APending Publication Date: 2025-07-18ACSON (SHENZHEN) INTELLIGENT TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510479302.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-16
Publication Date
2025-07-18

AI Technical Summary

Technical Problem

In the prior art, the accuracy of authenticity identification of printed objects is insufficient, and traditional methods are difficult to correct distortions caused by shooting angles or lighting differences, and cannot effectively capture high-precision anti-counterfeiting features, resulting in a high misjudgment rate.

Method used

An AI-based anti-counterfeiting recognition method is adopted to obtain images of the printed object to be identified and the reference printed object, calculate the feature vector correlation and image correlation, and combine gradient similarity and key point matching to determine the authenticity of the printed object.

Benefits of technology

It improves the accuracy and robustness of authenticity identification of printed objects, adapts to different lighting and texture conditions, and enhances the image comparison and recognition capabilities in complex scenes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120339656A_ABST
    Figure CN120339656A_ABST
Patent Text Reader

Abstract

The invention discloses an anti-counterfeiting identification method and device based on AI. The method comprises the steps that a first image and a second image are obtained, the first image is an image obtained by shooting a to-be-recognized printed matter, and the second image is an image obtained by shooting a reference printed matter; calculating feature vector correlation between the first image and the second image based on the feature vectors of the first image and the second image; based on the printing characteristics of the first image and the second image, calculating the image correlation between the first image and the second image; and based on the feature vector correlation and the image correlation, calculating the similarity between the first image and the second image, and based on the similarity, judging whether the printed matter to be identified is the reference printed matter so as to determine the authenticity of the printed matter to be identified. The technical problem of inaccurate anti-counterfeiting identification in the prior art is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computers, and in particular, to an anti-counterfeiting recognition method and device based on AI. Background Art

[0002] Traditional anti-counterfeiting identification technologies for printed materials mostly rely on basic image processing and shallow feature matching, and have significant limitations. In the preprocessing stage, general algorithms (such as Gaussian filtering, binarization) are difficult to correct geometric distortions and noise interference caused by the shooting angle or lighting difference of printed materials. In addition, existing methods often use a single feature (such as texture statistics or color histogram) to characterize printed materials, and cannot effectively capture high-precision anti-counterfeiting features (such as microtext or ink diffusion patterns), and the similarity calculation is mostly based on a linear model (such as Euclidean distance), lacking adaptive processing of non-linear feature distributions and noise, resulting in a relatively high false positive rate.

[0003] In view of the above problems, no effective solution has been proposed yet. Summary of the Invention

[0004] Embodiments of the present invention provide an anti-counterfeiting recognition method and device based on AI to at least solve the technical problem of insufficient accuracy in authenticating the authenticity of printed materials in the prior art.

[0005] According to one aspect of an embodiment of the present invention, an anti-counterfeiting recognition method based on AI is provided, including: obtaining a first image and a second image, where the first image is an image obtained by photographing a printed material to be recognized, and the second image is an image obtained by photographing a reference printed material; calculating the feature vector correlation between the first image and the second image based on the feature vectors of the first image and the second image; and calculating the image correlation between the first image and the second image based on the printing features of the first image and the second image; calculating the similarity between the first image and the second image based on the feature vector correlation and the image correlation, and determining whether the printed material to be recognized is the reference printed material based on the similarity to determine the authenticity of the printed material to be recognized.

[0006] According to another aspect of the embodiments of the present invention, there is also provided an AI-based anti-counterfeiting identification device, including: an acquisition module configured to acquire a first image and a second image, where the first image is an image obtained by photographing a printed matter to be identified, and the second image is an image obtained by photographing a reference printed matter; a calculation module configured to calculate the feature vector correlation between the first image and the second image based on the feature vectors of the first image and the second image; and calculate the image correlation between the first image and the second image based on the printing features of the first image and the second image; a judgment module configured to calculate the similarity between the first image and the second image based on the feature vector correlation and the image correlation, and determine whether the printed matter to be identified is the reference printed matter based on the similarity to determine the authenticity of the printed matter to be identified.

[0007] In the embodiments of the present invention, an AI-based anti-counterfeiting identification method is adopted. By acquiring a first image and a second image, where the first image is an image obtained by photographing a printed matter to be identified, and the second image is an image obtained by photographing a reference printed matter; calculating the feature vector correlation between the first image and the second image based on the feature vectors of the first image and the second image; calculating the image correlation between the first image and the second image based on the printing features of the first image and the second image; calculating the similarity between the first image and the second image based on the feature vector correlation and the image correlation, and determining whether the printed matter to be identified is the reference printed matter based on the similarity to determine the authenticity of the printed matter to be identified. Through the above method, the technical problem of insufficient accuracy in identifying the authenticity of printed matter in the prior art is solved. BRIEF DESCRIPTION OF THE DRAWINGS

[0008] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The illustrative embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:

[0009] Figure 1 is a flowchart of an AI-based anti-counterfeiting identification method according to an embodiment of the present invention;

[0010] Figure 2 is a flowchart of another anti-counterfeiting identification method based on printing features according to an embodiment of the present invention;

[0011] Figure 3 is a flowchart of a method for calculating similarity according to an embodiment of the present invention;

[0012] Figure 4It is a flowchart of another image recognition method based on image feature similarity judgment according to an embodiment of the present invention;

[0013] Figure 5 It is a flowchart of a method for obtaining an image and preprocessing the image according to an embodiment of the present invention;

[0014] Figure 6 It is a flowchart of a method for calculating the correlation of feature vectors according to an embodiment of the present invention;

[0015] Figure 7 It is a flowchart of a method for calculating the correlation of images according to an embodiment of the present invention;

[0016] Figure 8 It is a schematic structural diagram of an anti-counterfeiting recognition device based on AI according to an embodiment of the present invention;

[0017] Figure 9 It shows a schematic structural diagram of an electronic device suitable for implementing the embodiments of the present disclosure. Detailed implementation manners

[0018] In order to enable those skilled in the art to better understand the solution of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.

[0019] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and do not necessarily need to be used to describe a specific order or sequence. It should be understood that such data can be interchanged under appropriate circumstances so that the embodiments of the present invention described here can be implemented in an order other than those illustrated or described here. In addition, the terms "comprising" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device comprising a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products or devices.

[0020] According to an embodiment of the present invention, a method embodiment of an anti-counterfeiting recognition method based on AI is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in a different order than here.

[0021] Figure 1 is an anti-counterfeiting recognition method based on AI according to an embodiment of the present invention, as Figure 1 shown, the method includes the following steps:

[0022] Step S102, obtain a first image and a second image, where the first image is an image obtained by photographing a printed matter to be recognized, and the second image is an image obtained by photographing a reference printed matter;

[0023] First, obtain the first image and the second image, and after obtaining the first image and the second image, detect a first preset area in the first image to obtain a first standard image, and detect a second preset area in the second image to obtain the second standard image.

[0024] For example, detect a first vertex set of the first preset area in the first image to identify the first preset area, and perform a perspective transformation on the first image based on the first vertex set to obtain the first standard image corresponding to the first preset area; detect a second vertex set of the second preset area in the second image to identify the second preset area, and perform a perspective transformation on the second image based on the second vertex set to obtain the second standard image corresponding to the second preset area. Accurately extract the target area through vertex detection and perspective transformation, eliminate the influence of perspective distortion, and improve the accuracy of subsequent feature matching, which is applicable to the standardized processing of regular shapes such as documents and license plates.

[0025] Step S104, calculate the feature vector correlation between the first image and the second image based on the feature vectors of the first image and the second image; and calculate the image correlation between the first image and the second image based on the printing features of the first image and the second image;

[0026] First, calculate the eigenvector correlation. The eigenvector correlation is used to characterize the correlation of the texture of the carrier medium such as paper. For example, extract the first eigenvector from the first standard image and the second eigenvector from the second standard image as the eigenvectors of the first image and the second image. Specifically, divide the first image into uniform grids; calculate the first weighted centroid coordinates of the pixel gray values within each grid; combine the first weighted centroid coordinates in the grid order to form the first eigenvector; divide the second image into uniform grids; calculate the second weighted centroid coordinates of the pixel gray values within each grid; combine the second weighted centroid coordinates in the grid order to form the second eigenvector. By calculating the weighted centroid coordinates through grid partitioning, the local structural features of the image are effectively extracted, enhancing the robustness of the algorithm to illumination changes and small deformations, and improving the stability and discrimination of feature expression. Then, based on the eigenvectors of the first image and the second image, calculate the eigenvector correlation between the first image and the second image.

[0027] Next, calculate the image correlation. For example, based on the gradient maps of the first image and the second image, calculate the gradient similarity between the first image and the second image; and / or based on the pixel values of the non-background regions of the first image and the second image, perform Pearson correlation calculation to obtain the gray similarity between the first standard image and the second standard image; wherein, the image correlation includes the gradient similarity and / or the gray similarity. Through the double verification of gradient similarity and gray correlation, the reliability of image matching is enhanced, adapting to different illumination and texture conditions, and improving the accuracy and robustness of the algorithm in complex scenarios.

[0028] Among them, the calculation method of the gradient similarity is as follows: perform edge region screening on the gradient maps of the first image and the second image to obtain the screened gradient values; calculate the means and covariances of the screened gradient values of the first image and the second image respectively; generate a gradient correlation coefficient as the gradient similarity based on the means and covariances of the screened gradient values of the first image and the second image; or perform edge region screening on the gradient maps of the first image and the second image respectively to form edge buffer regions; within each edge buffer region, divide it into multiple stages based on the ink diffusion region, fit each stage, and encode the fitting results into ink diffusion feature vectors in units of regions; calculate the gradient similarity based on the ink diffusion feature vectors of multiple stages. By gradient statistics or ink diffusion feature analysis, the structural features of the image are accurately captured, effectively enhancing the robustness and discrimination of similarity calculation, and being particularly suitable for document anti-counterfeiting and printed matter comparison.

[0029] Step S106: Calculate the similarity between the first image and the second image based on the feature vector correlation and the image correlation, and determine whether the printed matter to be recognized is the reference printed matter based on the similarity, so as to determine the authenticity of the printed matter to be recognized.

[0030] Calculate the similarity between the first image and the second image based on the feature vector correlation and the image correlation.

[0031] In some other embodiments, the similarity between the first image and the second image may also be calculated based on the feature vector correlation, the image correlation, and the number of matching points. For example, extract the key points and descriptors of the first standard image and the second standard image through the SIFT or SURF algorithm, and perform feature matching on the first standard image and the second standard image based on the key points and the descriptors to obtain the number of matching points; calculate the similarity between the first image and the second image based on the feature vector correlation, the image correlation, and the number of matching points. Combining the feature vector correlation, the image correlation, and the number of key point matches to comprehensively calculate the image similarity improves the matching accuracy and robustness, and is applicable to image comparison and recognition in complex scenarios.

[0032] Figure 2 It is a flowchart of another anti-counterfeiting recognition method based on printing features provided by an embodiment of the present invention. In this embodiment, taking the recognition of a two-dimensional code in an image as an example, as Figure 2 shown, the method includes the following steps:

[0033] Step S202: Image preprocessing.

[0034] First, read the image data of the first image and the second image to be compared from the storage path respectively to ensure that the image format is correct and successfully loaded. Subsequently, perform a white balance correction operation on each image. After white balance adjustment, convert the color image to a grayscale image to reduce the data dimension and facilitate subsequent image analysis and processing. The grayscale conversion uses the cvtColor function in OpenCV, and uses the COLOR_BGR2GRAY flag to convert the three-channel image into a single-channel image. Subsequently, use the adaptive Gaussian threshold method to perform binaryzation processing on the grayscale image to obtain the significant edge structure in the image. Then, use the adaptiveThreshold function to generate an adaptive binary image based on the statistical information of the local neighborhood around each pixel, effectively suppressing the interference brought by different illumination conditions to the image edge recognition. Finally, calculate the gradient magnitude of the grayscale image through the Sobel operator to generate an image with gradient magnitude.

[0035] In the embodiment of the present invention, the perfect reflection algorithm is used to automatically adjust the white balance of the image, making the image color more truly restored, reducing the color deviation caused by the difference in illumination conditions, and thus improving the robustness of subsequent image analysis. In addition, by analyzing the area with the highest brightness in the image, the light source color is estimated and normalized, so that the gray distribution in the image is closer to the real scene.

[0036] Step S204, identify the preset area.

[0037] Perform contour extraction on the binary image. Use the findContours function in combination with the RETR_LIST and CHAIN_APPROX_SIMPLE modes to extract all possible contour information of the preset area (taking the two-dimensional code as an example in this embodiment). Then, in combination with morphological operations, such as opening operation (the morphologyEx function with the MORPH_OPEN structural element), enhance the connectivity of the two-dimensional code edge contour and the regularity of the geometric shape. Screen according to the area size, aspect ratio of each contour, and the rotation angle of the circumscribed rectangle, and retain the contours that meet the characteristics of the two-dimensional code positioning points.

[0038] Furthermore, to accurately determine whether the contour is the three positioning corner blocks of the two-dimensional code, the present invention provides a method for judging the horizontal black and white ratio rule. Specifically, calculate the horizontal black and white pixel ratio in the cropped candidate area, and detect whether it conforms to the characteristics of the typical two-dimensional code center positioning module of 1:1:3:1:1. If it matches, confirm that this area is a valid two-dimensional code positioning point. For the three successfully recognized two-dimensional code corner points, further calculate their centroid coordinates. By judging the distance between the three-point connections, determine the pair with the largest distance as the baseline point, and calculate its midpoint. Then, select the vertex farthest from this midpoint from the four corner points of the third point as a vertex of the two-dimensional code area. Then, use the edge extension of other positioning points to calculate the edge intersection points, and deduce the remaining three vertices of the two-dimensional code rectangular area, and finally determine the complete quadrilateral two-dimensional code area.

[0039] Step S206, image perspective correction.

[0040] After extracting the four vertices of the two-dimensional code area, correct this area from an inclined or deformed state to a standard rectangular form for subsequent consistency comparison between images. First, define the four-point coordinates of the standard two-dimensional code in the target image, which are arranged clockwise from the upper left corner by default as: (0,0), (w,0), (w,h), (0,h), where w and h are the width and height of the target standard image, which can be set according to actual needs.

[0041] Next, use the findHomography function to calculate the perspective transformation matrix H based on the four vertices of the original image and the four standard corner points of the target image. This matrix reflects the mapping relationship of any point in the original image on the target plane. Apply this transformation matrix through the warpPerspective function to project the image onto the standard plane, completing the geometric correction and alignment of the image. Perform the above transformation processing on the first image and the second image respectively to obtain the standard images dst1 and dst2 with exactly the same size, angle, and proportion.

[0042] Step S208, extract feature vectors.

[0043] For the standard image after perspective correction, divide it into a fixed number of grid regions for fine-grained image feature extraction. Preferably, divide the image into a 20-row × 20-column grid, with a total of 400 small block regions. In each small block region, calculate the gray centroid coordinates of the region with its pixel gray value as the weight, specifically including the weighted average positions of the x-axis and y-axis.

[0044] When traversing each grid region, ignore the pixels with gray values exceeding a specific threshold (such as 150) to avoid the offset of the centroid calculation caused by highlighted or noisy pixels. For the remaining pixels, accumulate and calculate Σ(x·g), Σ(y·g), and Σ(g) according to their positions (x, y) and gray values g in the grid. Finally, the x centroid of this grid block is Σ(x·g) / Σ(g), and the y centroid is Σ(y·g) / Σ(g). Perform the above operations on all grids in sequence, and splice all centroid coordinates into a one-dimensional feature vector in order, that is, each image has a feature vector of 400 blocks × 2 coordinates = 800 dimensions.

[0045] Step S210, perform similarity calculation.

[0046] The method of similarity calculation is as Figure 3 shown, including the following steps:

[0047] Step S2102, calculate the correlation of feature vectors.

[0048] In this step, the feature vectors Ev1 and Ev2 of the first image and the second image are obtained respectively, and the Pearson correlation coefficient is used to calculate the similarity degree between them. First, the means Avg1 and Avg2 of Ev1 and Ev2 are calculated respectively. Then, the covariance term Σ((x1 - Avg1)*(x2 - Avg2)) is obtained by multiplying the difference between each vector element and its mean and then summing them up. Next, the variances Σ((x1 - Avg1)^2) and Σ((x2 - Avg2)^2) of the two vectors are calculated respectively. Finally, the correlation coefficient is obtained using the Pearson formula K1 = Cov(Ev1, Ev2) / (Std(Ev1)*Std(Ev2)). The value range of this coefficient is [-1, 1]. The closer the value is to 1, the closer the two images are in the distribution of regional centroids and the stronger the structural similarity. An empirical threshold (such as 0.85) can be set to preliminarily judge whether the images have a consistent spatial layout.

[0049] Step S2104, key point matching.

[0050] To further improve the accuracy and robustness of image recognition, this step introduces the SIFT (Scale-Invariant Feature Transform) algorithm to extract the local key point information of the images. First, the SIFT feature detection is performed on the standard images dst1 and dst2 respectively to identify the key points in the images and calculate their descriptors. This descriptor is the encoding of the gradient direction distribution of the local image patches around the key points and has scale and rotation invariance.

[0051] Subsequently, the FLANN (Fast Library for Approximate Nearest Neighbors) matching algorithm is used to efficiently match the feature descriptors of the two images. Each key point descriptor searches for its nearest neighbor in the other image and filters out the false matching points according to the Lowe ratio criterion. That is, the matching pairs with the ratio of the distance between the nearest neighbor and the second nearest neighbor less than 0.3 are retained to ensure the accuracy of the matching.

[0052] Finally, the number nFt of the remaining valid matching points is counted, and this value is used as the matching strength index of the images in terms of local structural features.

[0053] Step S2106, compare and analyze the image gradients and calculate the image correlation.

[0054] The image correlation is the similarity of the image edges and texture changes and is used to verify the authenticity of the images through printing features. First, the Sobel edge detection operation is performed on the standard images dst1 and dst2 respectively to extract the horizontal and vertical direction gradient maps of the images. Then, the gradient maps of the Sobel X and Y directions are fused by weighting to generate the unified image gradient maps G1 and G2.

[0055] Select the valid pixels in the middle region of the gradient map (i.e., the pixel points with gray values greater than a specific threshold and not in the edge region), count their gradient values, and calculate the average gradient values of G1 and G2 respectively. Subsequently, based on these two average values, centralize the gradient value of each valid pixel, and calculate the gradient similarity GradK between them using the Pearson correlation coefficient formula, which is used to measure the consistency of the image in texture features and is especially suitable for judging the matching degree of two images in printing details. If GradK is higher than the empirical threshold (such as 0.75), it can be determined that the image texture structures are similar.

[0056] Step S2108, calculate the overall similarity of the images.

[0057] After completing the feature vector correlation (K1), key point matching (nFt), and gradient analysis (GradK), comprehensively evaluate the overall similarity of the images by combining these three indicators. Set the judgment thresholds for the three parameters, such as K1 > 0.85, nFt > 20, GradK > 0.75. If all three conditions are met, it is considered that the images are highly consistent and the recognition result is successful.

[0058] In addition, weights can be assigned to the three indicators to construct a weighted scoring function Score = w1K1 + w2(nFt / maxPts) + w3*GradK, where w1 + w2 + w3 = 1 and maxPts is the upper limit of the number of matching points. Further improve the hierarchical discrimination ability of the recognition according to the Score value.

[0059] Figure 4 is a flowchart of another image recognition method based on image feature similarity judgment according to an embodiment of the present invention. As Figure 4 shown, the method includes the following steps:

[0060] Step S402, obtain an image and preprocess the image.

[0061] As Figure 5 shown, the method for obtaining an image and preprocessing the image includes the following steps:

[0062] Step S4022, obtain two images to be compared and read them in the form of an image matrix.

[0063] In this embodiment, first, two images to be compared are read, denoted as the first image and the second image respectively. The system loads the image file corresponding to the original image path as a three-channel color image matrix through the imread() image reading interface of OpenCV, so as to facilitate subsequent image preprocessing, feature extraction, and similarity analysis operations. To ensure the validity of the image, after reading, the image data is first judged for validity. If the image data is empty, it means that the path is incorrect or the file is damaged, and the system will return an error message and abort the processing flow to ensure the correctness of the image data source.

[0064] Step S4024: Detect the QR code positioning area of the first image and the second image respectively.

[0065] To improve the accuracy of subsequent image comparison, the QR code area in the image is extracted and standardized. The system automatically identifies the area where the QR code pattern is located through contour detection and locator shape recognition methods.

[0066] Specifically, first, the input image is converted to a grayscale image, and the Gaussian adaptive threshold method is used for binarization processing to enhance the contrast of the edge structure and the QR code pattern. Subsequently, the system uses the edge contour detection algorithm findContours() to extract the contours of all connected regions in the image, and calculates the minimum bounding rectangle for each candidate contour.

[0067] The aspect ratio of each rectangular candidate region is analyzed, and regions approximately square (aspect ratio greater than 0.85) are selected. At the same time, it is limited that its maximum size cannot exceed 1 / 3 of the image width or height to exclude interference items in non-QR code regions. Among the candidate regions, further screening is carried out in combination with the structural feature of the horizontal black and white ratio of 1:1:3:1:1 of the QR code. The specific method is to extract the pixel values of several rows in the horizontal center region and count the projection ratio of the black and white changes, so as to judge whether it meets the typical structural requirements of the QR code. Through the above operations, the centers of the three locators of the QR code in the image and the coordinates of its four vertices can be accurately obtained, providing a key geometric basis for the next image perspective correction.

[0068] Step S4026: Perform perspective correction on the image based on the QR code vertex coordinates to obtain a standard image.

[0069] After the vertex coordinates of the QR code are extracted, the perspective transformation technology is used to regularize the QR code area in the image to ensure a unified geometric reference system among subsequent images. Specifically, the four vertices of the QR code are mapped to the coordinates of a preset standard rectangular area, and a homography transformation matrix from the original image plane to the standard image plane is constructed. The findHomography() function provided by OpenCV is called to estimate the transformation matrix, and the warpPerspective() function is used to perform a perspective transformation operation on the original image, outputting a QR code image with unified dimensions and standardized structure.

[0070] Perform white balance processing on the perspective-corrected image to eliminate color deviations caused by different lighting conditions. To further enhance the contrast of the image in different shooting environments, this embodiment introduces a white balance algorithm to perform color correction processing on the QR code image after perspective transformation. Specifically, the white balance algorithm based on the perfect reflection model (Simple White Balance) implemented in the OpenCV library is used. By adaptively adjusting the brightness distribution of the image, the gray scale and brightness distribution in the image tend to be unified, thereby weakening the interference of lighting changes on the image texture, color, and edge information, and providing a consistent input basis for subsequent gray scale similarity, gradient similarity, and eigenvector analysis.

[0071] Step S404, calculate the eigenvector correlation.

[0072] As Figure 6 shown, the method for calculating the eigenvector correlation includes:

[0073] Step S4042, extract the two-dimensional structure eigenvector of the image.

[0074] After image perspective correction and white balance processing, regional feature analysis is performed on the image to extract structural feature vectors representing the local gray-scale distribution law of the image. According to the gray-scale amplitude and the edge shape of the input image, the block size is automatically adjusted (such as 8x8 pixels for fine regions and 16x16 pixels for repetitive classes) to ensure the alignment and expression display of the structural features. A specific Fast Discrete Mapping (FDM) is performed on the gray-scale distribution in each block, that is, the gray-scale values are applied linearly in four-axis directions. According to the constraint contract degree and mean index of the gray scale, four types of structures are defined: dispersed type, aggregated type, significant direction type, and non-prominent type. Each type forms a corresponding feature vector module for subsequent grouped statistics. Then, according to the grouping information shown by all the block feature vectors, a classification distribution statistical table (such as "proportion of class A" and "mean gray scale of class B") is established, and the structural composition and element density characteristics of the texture of all paper classes on the drawing are described in the form of relative value difference and variance. Further AI classification coding is carried out in combination with the known paper material feature model. For example, the FDM grouping structures of the textures of official document paper and certificate paper are significantly different. Compared with the existing technologies that extract feature vectors using traditional methods such as gray-level co-occurrence matrix (GLCM) and local binary pattern (LBP), this method further constructs a regional grouped feature representation structure, which not only improves the feature contrast but also enhances the consistency and robustness of the texture form expression, showing significant technological progress.

[0075] Step S4044, calculate the correlation of feature vectors between the first image and the second image.

[0076] After the feature vector extraction is completed, the feature vectors Ev1 and Ev2 of the two images are obtained respectively, and the Pearson correlation coefficient is used as the measurement index. Specifically, first, the sum calculations are performed on Ev1 and Ev2 respectively to obtain the average values Avg1 and Avg2 of the two feature vectors. Then, each component is subtracted from the corresponding average value to obtain the centered difference sequence, and the covariance product between the two and the sum of the squares of their respective variances are calculated based on these differences.

[0077] Finally, the covariance numerator is divided by the two standard deviation denominators to obtain the correlation coefficient EvK of the feature vectors, which reflects the degree of linear correlation between the two images in terms of structural distribution. If EvK is close to 1, it indicates that the two images are highly consistent in the spatial arrangement of the local gray-scale centers of gravity.

[0078] Step S406, calculate the image correlation.

[0079] As Figure 7 shown, calculating the image correlation includes the following steps:

[0080] Step S4062, perform global correlation calculation on the image gray-scale distribution to obtain the gray-scale similarity.

[0081] To evaluate the consistency of the overall brightness structure of an image, the system introduces a grayscale similarity index to measure the global distribution relationship of pixel grayscale values in the image in space. First, the color channel of the input image is judged. If it is a color image, it is converted into a grayscale image. Subsequently, the grayscale image is binarized using the Gaussian adaptive threshold method to distinguish the foreground area from the background area. This binary image will be used in the subsequent pixel selection process to ensure that grayscale analysis is only performed within the background area (i.e., the black and white area of the QR code).

[0082] Next, the middle area of the image is screened. The middle area is defined as the central part of the image after excluding 10 pixels from each of the top, bottom, left, and right to avoid interference from edge occlusion, noise, or printing defects. Within this area, the corresponding values of the pixels in the binary image are checked, and only those pixels with binary pixel values lower than a set threshold (such as 10) are counted. These pixels are regarded as the structurally valid area. Subsequently, the sum and average of the valid grayscale pixel values in the two images are calculated respectively to obtain their respective grayscale means. On this basis, the cumulative sum of the product of the differences of each pixel (i.e., covariance calculation) and the cumulative sum of the squared differences (i.e., variance calculation) are performed, and finally, the grayscale similarity value K is output according to the Pearson correlation formula. This index reflects the consistency of the two images in terms of overall brightness, grayscale level, and texture smoothness, and is especially suitable for rapid comparison scenarios of high-contrast images such as QR codes and printed materials.

[0083] Step S4064, extract the gradient information of the image and perform gradient similarity calculation.

[0084] To further obtain the similarity of images at the structural detail level, in this embodiment, first, the images are processed separately in the three RGB channels. In each channel, the edges are extracted by the Canny or Sobel operator, and a buffer area is formed by expanding the edges by a certain number of pixel widths for the diffusion analysis of the gray-level gradient. Then, the diffusion area of the printing medium, such as ink, is divided into different stages. In each edge buffer area, the gray-level values are sampled along the normal direction to generate a transition contour, and the ink diffusion area is divided into three stages: "diffusion start section", "transition center section", and "edge attenuation section". A first-degree or second-degree polynomial curve is fitted to each stage respectively, and statistics such as curvature, bandwidth, and slope change are extracted. The fitting results are encoded as ink diffusion feature vectors in units of regions and are independently encoded according to the three RGB channels. Finally, the complete ink printing features F1 and F2 are generated through a weighted fusion method. While maintaining the authenticity of physical properties, this method introduces the way of regional modeling and channel layering, enabling the quantitative recognition of ink penetration changes, and is particularly suitable for high-precision scenarios such as microprinting and dot matrix anti-counterfeiting. Compared with the prior art, this application uses integrated processing such as color channel layering, regional segmentation, and curve fitting cascade, and can better handle the differential features of different ink color diffusions, showing stronger hierarchical analysis capabilities.

[0085] Next, the dynamic time warping (DTW) algorithm and the Hausdorff distance are used for diffusion feature matching to calculate the gradient similarity. The specific implementation methods include: First, calculate the minimum alignment distance as the similarity score of the alignment distance. In this embodiment, the diffusion curves representing the same printing area in F1 and F2 are respectively converted into one-dimensional grayscale sequences, and the two sequences are non-linearly aligned by DTW, and the minimum alignment distance is calculated as the similarity score. The specific process includes: For each pair of regional diffusion curves, construct their grayscale value vector sequences F1_i = [g1, g2,..., gn], F2_i = [g1', g2',..., gm]; use the DTW algorithm to dynamically construct an n×m distance matrix and iteratively calculate the optimal matching path; take the total distance corresponding to this path divided by the path length as the normalized similarity score Sim_F_dtw; after multi-region parallel processing, take the weighted average of the scores of all matching regions as the overall SimF index. The DTW method in this embodiment has the robustness against regional starting misalignment and local deformation, and is particularly suitable for the actual printing diffusion profile with random fluctuations in the diffusion gradual change process. Then, calculate the two-dimensional point set distance. Specifically, each ink diffusion boundary contour (such as the edge points obtained by isograyline fitting or Canny edge detection) extracted from F1 and F2 is regarded as two-dimensional point sets A and B, and the distance between the two-dimensional point sets is calculated. Specifically, calculate the edge diffusion point sets for each color channel respectively; use KD-Tree or Ball-Tree to accelerate the nearest neighbor search to improve the calculation efficiency; calculate the distance of the maximum bidirectional two-dimensional point sets in the corresponding regions of the original image and the image to be measured respectively; based on this, calculate the similarity scores of each region, and further combine them with the similarity score of the alignment distance to form a composite feature similarity as the gradient similarity.

[0086] This embodiment adopts a dual feature similarity matching method of the similarity score of the alignment distance and the distance of the two-dimensional point set, which significantly enhances the alignment degree of the ink diffusion structure and the matching ability of the spatial form, and has good adaptability especially to situations such as non-linear diffusion, edge fracture, and complex texture changes.

[0087] Step S408, perform matching based on the local feature descriptors of the image key points, and calculate the number of feature point matches.

[0088] In some embodiments, local stable features of an image can be further extracted to describe key point information that remains consistent under different scales and angles. For this purpose, the SIFT (Scale-Invariant Feature Transform) algorithm is used as the main feature extraction method in this embodiment. First, the two white balance and perspective-corrected images are respectively converted into single-channel grayscale images to simplify the subsequent computational complexity. Subsequently, the SIFT::create() interface provided by OpenCV is used to instantiate the feature extractor, and the detectAndCompute() method is called respectively to perform key point detection and descriptor calculation on the two images, and finally two sets of key point positions and their corresponding feature vector descriptors are obtained.

[0089] After the feature description is completed, the FLANN matcher is used to perform K-nearest neighbor matching on the set of descriptor vectors. Each group of matches outputs two candidate matching points, and the Lowe’s ratio method is used to evaluate the matching quality. Specifically, if the distance ratio between the first match and the second match is lower than a set threshold (e.g., 0.3), then the matching point is considered to have high credibility and is retained. The number of all qualified "good matches" is counted and output as the number of feature point matches, which is one of the important bases for measuring image similarity. This method not only ensures the local feature similarity between the matching point pairs, but also can effectively eliminate false matches and pseudo-matching points, improving the accuracy of image discrimination.

[0090] Step S410, comprehensively consider the feature vector similarity, key point matching degree, grayscale similarity, and gradient similarity to determine the image similarity result.

[0091] Some or all of the above-obtained various image similarity metrics are normalized and comprehensively processed to construct an integrated image similarity determination model. The weights of each metric can be preset to form a weighted score model; or the weight distribution can be learned and optimized based on historical samples. If the comprehensive similarity exceeds the set threshold, or the number of feature point matches exceeds a certain lower limit, it can be determined that the images are highly similar, otherwise they are considered mismatched. This method fully combines image structure, texture, grayscale, and edge information, and has strong robustness and discrimination ability, especially suitable for high-precision image recognition fields such as printed matter detection, pattern comparison, and anti-counterfeiting verification.

[0092] This application also provides an anti-counterfeiting recognition device based on AI, such as Figure 8As shown, it includes: an acquisition module 82 configured to acquire a first image and a second image, where the first image is an image obtained by photographing a printed matter to be identified, and the second image is an image obtained by photographing a reference printed matter; a calculation module 84 configured to calculate the feature vector correlation between the first image and the second image based on the feature vectors of the first image and the second image, and calculate the image correlation between the first image and the second image based on the printing features of the first image and the second image; and a judgment module 86 configured to calculate the similarity between the first image and the second image based on the feature vector correlation and the image correlation, and determine whether the printed matter to be identified is the reference printed matter based on the similarity to determine the authenticity of the printed matter to be identified.

[0093] It should be noted that: for the AI-based anti-counterfeiting identification device provided in the above embodiment, only the division of the above functional modules is used for illustration. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the AI-based anti-counterfeiting identification device provided in the above embodiment and the method embodiment of the AI-based anti-counterfeiting identification method belong to the same concept. For the specific implementation process, please refer to the method embodiment and will not be elaborated here.

[0094] Figure 9 The structural schematic diagram of an electronic device suitable for implementing the embodiments of the present disclosure is shown. It should be noted that Figure 9 The electronic device shown is only an example and should not impose any limitations on the functions and usage scope of the embodiments of the present disclosure.

[0095] As Figure 9 shown, the electronic device includes a central processing unit (CPU) 1001, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 1002 or the program loaded from the storage part 1008 into the random access memory (RAM) 1003. In the RAM 1003, various programs and data required for system operation are also stored. The CPU 1001, ROM 1002, and RAM 1003 are connected to each other through a bus 1004. The input / output (I / O) interface 1005 is also connected to the bus 1004.

[0096] The following components are connected to the I / O interface 1005: an input section 1006 including a keyboard, a mouse, etc.; an output section 1007 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc. as well as a speaker, etc.; a storage section 1008 including a hard disk, etc.; and a communication section 1009 including a network interface card such as a LAN card, a modem, etc. The communication section 1009 performs communication processing via a network such as the Internet. A drive 1010 is also connected to the I / O interface 1005 as required. A removable medium 1011, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is mounted on the drive 1010 as required so that a computer program read therefrom is installed into the storage section 1008 as required.

[0097] The above are only the preferred embodiments of the present application. It should be noted that for those of ordinary skill in the art, several improvements and modifications can be made without departing from the principle of the present application, and these improvements and modifications should also be regarded as the protection scope of the present application.

Claims

1. An AI-based anti-counterfeiting identification method, characterized in that, Including: Obtain a first image and a second image, where the first image is an image obtained by photographing a printed matter to be recognized, and the second image is an image obtained by photographing a reference printed matter; Based on the feature vectors of the first image and the second image, calculate the feature vector correlation between the first image and the second image; and based on the printing features of the first image and the second image, calculate the image correlation between the first image and the second image; Based on the feature vector correlation and the image correlation, calculate the similarity between the first image and the second image, and based on the similarity, determine whether the printed matter to be recognized is the reference printed matter to determine the authenticity of the printed matter to be recognized.

2. The method according to claim 1, wherein After obtaining the first image and the second image, the method further includes: Detect a first preset area in the first image to obtain a first standard image, and detect a second preset area in the second image to obtain the second standard image; Extract a first feature vector from the first standard image and extract a second feature vector from the second standard image as the feature vectors of the first image and the second image.

3. The method according to claim 2, characterized in that Detecting a first preset area in the first image to obtain a first standard image, and detecting a second preset area in the second image to obtain the second standard image includes: Detect a first vertex set of the first preset area in the first image to identify the first preset area, and perform a perspective transformation on the first image based on the first vertex set to obtain the first standard image corresponding to the first preset area; Detect a second vertex set of the second preset area in the second image to identify the second preset area, and perform a perspective transformation on the second image based on the second vertex set to obtain the second standard image corresponding to the second preset area.

4. The method according to claim 3, wherein The first vertex set and the second vertex set are respectively obtained through the following detections: Extract the contours in the binary image of the target image; Screen the extracted contours to meet the preset area and aspect ratio; Based on the screened contours, determine the area of the screened contours through geometric analysis; Based on the center point and vertex coordinates of the area, calculate multiple positioning vertices of the target image as the first vertex set or the second vertex set; where the target image is the first image or the second image.

5. The method according to claim 3, wherein Performing a perspective transformation on the first image includes: Generating a first affine transformation matrix of a standard size based on the first vertex set; Using the first affine transformation matrix to perform a perspective transformation on the first image to obtain the first standard image; Performing a perspective transformation on the second image includes: Generating a second affine transformation matrix of a standard size based on the second vertex set; Using the second affine transformation matrix to perform a perspective transformation on the second image to obtain the second standard image.

6. The method according to claim 1, wherein Extracting a first feature vector from the first image includes: dividing the first image into a uniform grid; calculating first weighted centroid coordinates of pixel gray values within each grid; combining the first weighted centroid coordinates in grid order to form the first feature vector; Extracting a second feature vector from the second image includes: dividing the second image into a uniform grid; calculating second weighted centroid coordinates of pixel gray values within each grid; combining the second weighted centroid coordinates in grid order to form the second feature vector.

7. The method according to claim 1, wherein Calculating an image correlation between the first image and the second image based on printing features of the first image and the second image includes: Calculating a gradient similarity between the first image and the second image based on gradient maps of the first image and the second image; and / or Performing Pearson correlation calculation based on pixel values of non-background regions of the first image and the second image to obtain a gray similarity between the first standard image and the second standard image; wherein the image correlation includes the gradient similarity and / or the gray similarity.

8. The method according to claim 7, wherein Calculating the gradient similarity between the first image and the second image based on gradient maps of the first image and the second image includes: Performing edge region screening on gradient maps of the first image and the second image to obtain filtered gradient values; respectively calculating means and covariances of the filtered gradient values of the first image and the second image; generating a gradient correlation coefficient as the gradient similarity based on the means and covariances of the filtered gradient values of the first image and the second image; or Performing edge region screening on gradient maps of the first image and the second image respectively to form edge buffer regions; within each edge buffer region, dividing based on an ink diffusion region into multiple stages, fitting each stage, and encoding fitting results as ink diffusion feature vectors in units of regions; calculating the gradient similarity based on ink diffusion feature vectors of multiple stages.

9. The method according to claim 2, characterized in that, Calculating a similarity between the first image and the second image based on the feature vector correlation and the image correlation includes: Extracting key points and descriptors of the first standard image and the second standard image through SIFT or SURF algorithms, and performing feature matching on the first standard image and the second standard image based on the key points and the descriptors to obtain the number of matching points; Calculating a similarity between the first image and the second image based on the feature vector correlation, the image correlation, and the number of matching points.

10. An AI-based anti-counterfeiting identification device, characterized in that, Includes: An acquisition module configured to acquire a first image and a second image, wherein the first image is an image obtained by photographing a printed matter to be recognized, and the second image is an image obtained by photographing a reference printed matter; A calculation module, configured to calculate the feature vector correlation between the first image and the second image based on the feature vectors of the first image and the second image; and calculate the image correlation between the first image and the second image based on the printing features of the first image and the second image. A judgment module, configured to calculate the similarity between the first image and the second image based on the feature vector correlation and the image correlation, and determine whether the printed material to be recognized is the reference printed material based on the similarity, so as to determine the authenticity of the printed material to be recognized.