Defect detection method and device and electronic equipment
Through the methods of feature extraction, clustering and differential comparison, the problem of misjudgment and high computational complexity in label defect detection is solved, and the accurate detection of label defects is achieved, which is suitable for industrial production.
Patent Information
- Application Number
- CN202411391496.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-30
- Publication Date
- 2025-01-07
AI Technical Summary
The prior art has problems such as misjudgment, high computational complexity and texture structure damage in label defect detection, especially in the differences between printing batches, light changes and noise interference, making it difficult to accurately detect label defects.
By obtaining the image to be tested and the template images, feature extraction and matching are performed, target spatial point mapping pairs are determined, and clustered according to the position offset of the feature point pairs, extracting image block pairs for differential comparison, and determining the defects of the identification information are determined based on the position offset of the feature point pairs. , use perspective transformation matrix and differential operations to reduce misjudgment and ensure detection accuracy.
It improves the accuracy of label defect detection, reduces the impact on the texture structure of the image to be tested, avoids misjudgment, and does not require a large number of defect samples to train, and has low computing power requirements, which is suitable for industrial production.
Smart Images

Figure CN119273662A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a defect detection method, device and electronic equipment. Background Art
[0002] In the industrial production process, accurate printing and accurate installation of product labels are key links to ensure product quality and traceability. However, various abnormalities often occur during the printing and installation process, resulting in label defects. In view of the above problems, it is particularly important to implement accurate label defect detection. Summary of the invention
[0003] The technical solutions provided in this application are as follows:
[0004] The first aspect of the present application provides a defect detection method, comprising:
[0005] Obtaining an image to be tested and a template image of a target product, wherein the image to be tested includes multiple identification information of the target product;
[0006] Performing feature extraction and matching on the image to be tested and the template image to determine at least one target space point mapping pair; the target space point mapping pair is used to represent a feature point pair in the image to be tested that matches a feature point pair in the template image;
[0007] Clustering the at least one target space point mapping pair according to the position offset of the feature point pair in the target space point mapping pair to obtain at least one cluster;
[0008] Respectively extracting image block pairs from the template image and the image to be tested corresponding to different clusters, wherein the image block pairs include at least one identification information;
[0009] Based on the difference comparison of the image blocks corresponding to different clusters, the defects existing in the identification information of the image to be tested are determined.
[0010] The extracting and matching the features of the image to be tested and the template image to determine at least one target space point mapping pair includes:
[0011] Performing feature extraction and matching on the image to be tested and the template image to determine at least one spatial point mapping pair;
[0012] Based on the identification information region extracted from the image to be tested, at least one target space point mapping pair is screened from the at least one space point mapping pair; the target space point mapping pair is used to represent the feature point pair in the identification information region that matches the feature point pair in the template image.
[0013] The extracting and matching the features of the image to be tested and the template image to determine at least one spatial point mapping pair includes:
[0014] Determine at least one first feature point of the template image and at least one second feature point of the image to be tested; the first feature point represents the feature of a first local area in the template image and the spatial position of the first local area in the template image, and the second feature point represents the feature of a second local area in the image to be tested and the spatial position of the second local area in the image to be tested;
[0015] The at least one first feature point and the at least one second feature point are matched to obtain at least one space point mapping pair.
[0016] The method further comprises:
[0017] Based on the spatial position, coordinate correction is performed on the second feature point of the identification information area in the target space point mapping pair, so that the second feature point of the identification information area is spatially consistent with the first feature point of feature matching in the template image.
[0018] The step of clustering the at least one target space point mapping pair according to the position offset of the feature point pair in the target space point mapping pair to obtain at least one cluster comprises:
[0019] According to the position offset of the feature point pair in the target space point mapping pair and the setting parameters corresponding to the target product, the at least one target space point mapping pair is clustered to obtain at least one cluster; the setting parameters represent the number of printing batches of key information of the target product.
[0020] The performing difference comparison based on the image blocks corresponding to different clusters to determine the defects existing in the identification information of the image to be tested includes:
[0021] Based on the image block pairs corresponding to different clusters, determining the perspective transformation matrices corresponding to different clusters;
[0022] Performing perspective transformation on the image blocks of the template image in the image block pairs corresponding to the cluster based on the perspective transformation matrix;
[0023] Performing a difference operation on the image blocks corresponding to the cluster after perspective transformation to obtain a difference map corresponding to the cluster;
[0024] Defects existing in the identification information of the image to be tested are determined based at least on the difference images corresponding to the clusters.
[0025] The method further comprises:
[0026] Based on the identification information region, the image block pairs corresponding to each of the clusters in the image to be tested and the template image are removed to obtain initial region image pairs in the identification information region and the region corresponding to the template image except for the image block pairs corresponding to each of the clusters;
[0027] Performing perspective transformation and differential operation on the initial region image pair to obtain a differential image corresponding to the initial region image pair;
[0028] Defects existing in the identification information in the image to be tested are determined based on the difference images corresponding to each of the clusters and the difference images corresponding to the initial region image pair.
[0029] The step of determining defects existing in identification information in the image to be tested based on the difference images corresponding to each of the clusters and the difference images corresponding to the initial region image pair includes:
[0030] splicing the difference images corresponding to each of the clusters and the difference images corresponding to the initial region image pair to obtain a target difference image;
[0031] Defects existing in identification information in the image to be tested are determined based on the target difference map.
[0032] Another aspect of the present application provides a processing device, comprising:
[0033] An acquisition module, used to obtain an image to be tested and a template image of a target product, wherein the image to be tested contains multiple identification information of the target product;
[0034] A determination module, used for performing feature extraction and matching on the image to be tested and the template image to determine at least one target space point mapping pair; the target space point mapping pair is used to represent a feature point pair in the image to be tested that matches a feature point pair in the template image;
[0035] A clustering module, configured to cluster the at least one target space point mapping pair according to the position offset of the feature point pair in the target space point mapping pair to obtain at least one cluster;
[0036] An extraction module, used to extract image block pairs from the template image and the image to be tested corresponding to different clusters, respectively, wherein the image block pairs include at least one identification information;
[0037] The comparison module is used to perform a difference comparison based on the image blocks corresponding to different clusters to determine the defects existing in the identification information in the image to be tested.
[0038] A third aspect of the present application provides an electronic device, including:
[0039] The memory is used to store computer programs;
[0040] The processor is used to execute the computer program so that the electronic device can implement any defect detection method as described above. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale.
[0042] Figure 1 A schematic flow chart of a defect detection method provided for the first embodiment of the present application;
[0043] Figure 2 A schematic diagram of an implementation scenario of a defect detection method provided in this application;
[0044] Figure 3 A schematic flow chart of a defect detection method provided for the second embodiment of the present application;
[0045] Figure 4 A schematic flow chart of a defect detection method provided for the fifth embodiment of the present application;
[0046] Figure 5 A schematic flow chart of a defect detection method provided for the sixth embodiment of the present application;
[0047] Figure 6 A schematic diagram of another implementation scenario of a defect detection method provided in this application;
[0048] Figure 7 A schematic flow chart of a defect detection method provided for the seventh implementation mode of the present application;
[0049] Figure 8 A schematic diagram of another implementation scenario of a defect detection method provided in the present application;
[0050] Fig. 9 A schematic diagram of another implementation scenario of a defect detection method provided in the present application;
[0051] Fig.10 A schematic diagram of another implementation scenario of a defect detection method provided in the present application;
[0052] Fig.11 A schematic diagram of another implementation scenario of a defect detection method provided in the present application;
[0053] Fig.12 A schematic diagram of another implementation scenario of a defect detection method provided in the present application;
[0054] Fig.13 A schematic diagram of the structure of a defect detection device provided in this application. DETAILED DESCRIPTION
[0055] The following describes the embodiments of the present application in conjunction with the drawings in the embodiments of the present application. The terms used in the implementation method section of the present application are only used to explain the specific embodiments of the present application, and are not intended to limit the present application.
[0056] The embodiments of the present application are described below in conjunction with the accompanying drawings. Those skilled in the art will appreciate that, with the development of technology and the emergence of new scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0057] The terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and need not be used to describe a specific order or sequential order. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances, which is only to describe the distinction mode adopted by the objects of the same attributes when describing in the embodiments of the present application. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, so that the process, method, system, product or equipment comprising a series of units need not be limited to those units, but may include other units that are not clearly listed or inherent to these processes, methods, products or equipment.
[0058] In modern industrial production, all kinds of products cannot do without the printing and attachment of product labels. These labels not only carry key information about the product, such as model, production date, batch number and safety warnings, but are also directly related to product identification, tracking, quality control and consumer experience. However, due to the wide variety of products, the styles and contents of labels are also highly complex and diverse, which brings great challenges to label quality assurance. Therefore, it is necessary to perform label defect detection.
[0059] At present, there are generally two technical solutions for label defect detection:
[0060] Technical Solution 1: Collect a large amount of labeled data, annotate the defects therein, and form a labeled defect segmentation data set. Build a corresponding deep learning segmentation model, input the segmentation data set into the network for training, and finally obtain an end-to-end network that can complete the labeled defect segmentation. The production line can locate the corresponding defects based on the final segmentation mask and the corresponding conditions. This solution has problems such as relying on a large number of defect samples, high computing power requirements, and easy to miss minor defects.
[0061] Technical Solution 2: Use the standard normal sample as a template, divide the template into blocks, find the blocks in the sample to be tested that are in relative position to the blocks in the template, and compare the features of the two blocks. Based on the result of feature matching, align the template with the sample to be tested and extract the corresponding defects.
[0062] The disadvantages of this scheme are as follows: 1. If the local content is misaligned due to the difference between multiple printing batches, the identification information in the two compared blocks will not correspond. When the features of the two blocks are directly compared, it will be judged that there are differences between the two blocks, and therefore it will be misjudged as a defect. 2. Under stable shooting conditions, the texture structure of the label usually exhibits a certain rigid invariance, that is, despite slight changes in perspective, illumination or noise interference, the overall texture structure of the label remains relatively stable. However, when an overly complex registration method is used, unnecessary computational complexity and parameter adjustments may be introduced, and these additional processing steps may destroy the natural rigidity of the label texture structure. Specifically, complex registration methods may attempt to perform excessive transformations on the image (such as nonlinear transformations, high-order polynomial transformations, etc.), which may not conform to the actual change laws of the label texture structure, resulting in deviations or distortions in the registration results. 3. Template matching methods usually rely on edge information to extract regions of interest. Edge information is where the grayscale or color changes sharply in the image, and is usually used to describe the contours and shapes of objects. However, in practical applications, the edge information of the label may be affected by many factors (such as illumination changes, noise interference, blur, etc.), resulting in inaccurate and unstable edge detection results. To solve the above problems, the present application provides a defect detection method to improve the accuracy of defect detection on the image to be tested of the target product.
[0063] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, the present application is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0064] Reference Figure 1 , is a flow chart of a defect detection method provided in the first embodiment of the present application. The method can be applied to electronic devices. The present application does not limit the product type of the electronic device. For example, Figure 1 As shown, the method may include but is not limited to the following steps:
[0065] Step S101: obtaining an image to be tested of a target product and a template image, wherein the image to be tested contains a plurality of identification information of the target product.
[0066] In this embodiment, the multiple identification information of the target product can be used for identification, verification, tracking and quality control of the target product.
[0067] The multiple identification information of the target product may include but is not limited to: at least two of the model name, version, production line identification, serial number, barcode, manufacturer's trademark, production date, and warning information of the target product.
[0068] The images of the target product to be tested can be obtained from a variety of channels, for example, they can be captured in real time by cameras on the production line or uploaded by users.
[0069] The template image of the target product may be selected from images that are qualified for printing the identification information of the target product.
[0070] Step S102: extracting and matching features of the image to be tested and the template image to determine at least one target space point mapping pair.
[0071] By performing feature extraction and matching on the image to be tested and the template image, a pair of feature points in the image to be tested that matches the pair in the template image can be obtained. The pair of feature points in the image to be tested that matches the pair in the template image has a matching relationship in terms of features. The features of the feature point pairs may include features representing identification information.
[0072] The feature point pairs that have a matching relationship in features also have an associated relationship in the spatial positions in the image to be tested and the template image. In order to indicate that the feature point pairs have an associated relationship in the spatial positions in the image to be tested and the template image, a target space point mapping pair can be established. The target space point mapping pair can be used to indicate the feature point pairs that match each other in the image to be tested and the template image.
[0073] For example, the feature point pair in the image to be tested that matches the feature point in the template image includes a feature point M and a feature point N, where the feature point M is one of the feature points in the image to be tested, and the feature point N is one of the feature points in the template image, the features between the feature point M and the feature point N match, and the spatial position of the feature point M in the image to be tested and the spatial position of the feature point N in the template image can be considered to be related to each other. The target space point mapping pair can at least include: the spatial position of the feature point M in the image to be tested and the spatial position of the feature point N in the template image.
[0074] Step S103: clustering at least one target space point mapping pair according to the position offset of the feature point pair in the target space point mapping pair to obtain at least one cluster.
[0075] The position offset of the feature point pair can be used to represent the relative offset relationship in spatial position between the feature point pairs that match each other in the image to be tested and in the template image.
[0076] The position offset of the feature point can be determined by:
[0077] Step S11, determining the difference between the X coordinates of two feature points in the feature point pair in their respective images to obtain a horizontal offset;
[0078] Step S12: determine the difference between the Y coordinates of two feature points in the feature point pair in their respective images to obtain a vertical offset.
[0079] In this embodiment, based on a clustering algorithm, the similarity between the position offsets of feature point pairs in different target space point mapping pairs may be determined, and at least one target space point mapping pair with close similarity may be clustered into a cluster.
[0080] Step S104: extracting image block pairs from the template image and the image to be tested corresponding to different clusters respectively, wherein the image block pairs include at least one piece of identification information.
[0081] The position offsets of the feature point pairs in each target space point mapping pair in the same cluster are similar, which can reflect that the feature points in the image to be tested corresponding to the target space point mapping pair in the same cluster have similar offset patterns relative to the feature points in the template image during the printing process. Having similar offset patterns can infer that multiple feature points in the image to be tested that have similar offset patterns relative to the feature points in the template image may be printed in the same printing batch, but due to the differences between multiple printing batches, position offsets have occurred in the image to be tested relative to the template image.
[0082] Based on the mapping pairs of target space points in the cluster, the feature points in the image to be tested that are offset from the feature points in the template image due to different printing batches can be located, and the image blocks in the template image and the image blocks in the image to be tested can be extracted. Figure 2 As shown, an image block pair including image block 1 in the template image and image block 11 in the image to be tested, an image block pair including image block 2 in the template image and image block 22 in the image to be tested, and an image block pair including image block 3 in the template image and image block 33 in the image to be tested can be extracted, the identification information in image block 11 is printed in the same batch, the identification information in image block 22 is printed in the same batch, and the identification information in image block 33 is printed in the same printing batch.
[0083] Step S105 : performing a difference comparison based on the image blocks corresponding to different clusters to determine defects in the identification information in the image to be tested.
[0084] In this embodiment, the image block pairs corresponding to each cluster may be respectively compared for differences to determine defects in the identification information in each image block in the image to be tested, such as printing errors, breaks, missing, etc.
[0085] In this embodiment, by obtaining an image to be tested and a template image of a target product, feature extraction and matching are performed on the image to be tested and the template image to determine at least one target space point mapping pair, the target space point mapping pair can be used to represent a feature point pair in the image to be tested that matches the feature point pair in the template image, and at least one target space point mapping pair is clustered according to the position offset of the feature point pair in the target space point mapping pair to obtain at least one cluster, the position offset of the feature point pair in each target space point mapping pair in the same cluster is similar, and according to the target space point mapping pair in the cluster, feature points in the image to be tested that are positionally offset relative to feature points in the template image due to different printing batches can be located, and image blocks in the template image and image blocks in the image to be tested are extracted, so that it can be ensured that the identification information in the two image blocks in the image block pair is corresponding (that is, the identification information in the two image blocks is offset in spatial position, and the features are similar), and on this basis, a difference comparison is performed based on the image block pairs corresponding to different clusters, which can reduce misjudgment when the offset is caused by differences between printing batches, and thus can improve the accuracy of determining the defects in the identification information in the image to be tested.
[0086] Furthermore, this implementation does not require training samples, and can avoid the problems of low defect detection accuracy, large deployment workload, and high deployment difficulty caused by the scarcity of defect samples.
[0087] Furthermore, the feature extraction, matching, clustering and other processes in the defect detection method provided in this embodiment do not require high computing power of the electronic device, thus ensuring the rapid execution of the defect detection method.
[0088] Furthermore, the defect detection method provided by this embodiment can ensure the accuracy of defect detection without sacrificing the texture structure of the image to be detected.
[0089] As another optional embodiment of the present application, refer to Figure 3 , is a flow chart of a defect detection method provided in the second embodiment of the present application. This embodiment is mainly an implementation of the above step S102. Figure 3 As shown, step S102 may include but is not limited to:
[0090] Step S102 may include but is not limited to the following steps:
[0091] Step S1021: extract and match features of the image to be tested and the template image to determine at least one spatial point mapping pair.
[0092] By performing feature extraction and matching on the image to be tested and the template image, a pair of feature points in the image to be tested that matches the pair in the template image can be obtained. The pair of feature points in the image to be tested that matches the pair in the template image has a matching relationship in terms of features. The features of the feature point pairs may include features representing identification information.
[0093] The feature point pairs that have a matching relationship in features also have an associated relationship in spatial positions in the image to be tested and the template image. In order to indicate that the feature point pairs have an associated relationship in spatial positions in the image to be tested and the template image, a target space point mapping pair can be established.
[0094] Step S1022: based on the identification information region extracted from the image to be tested, select at least one target space point mapping pair from at least one space point mapping pair; the target space point mapping pair is used to represent the feature point pair in the identification information region that matches the feature point pair in the template image.
[0095] In this embodiment, a part of spatial point mapping pairs can be screened out from at least one spatial point mapping pair, and based on the screened part of spatial point mapping pairs, the boundary in the image to be tested is determined, and the area within the boundary is determined as the identification information area.
[0096] Screening out a portion of the spatial point mapping pairs from at least one spatial point mapping pair may include but is not limited to:
[0097] A part of the feature point pairs can be obtained by randomly sampling from the feature point pairs that match each other in the image to be tested and the template image.
[0098] Alternatively, based on the attributes of the feature point pairs, a part of the feature point pairs can be screened out from the feature point pairs that match each other in the image to be tested and the template image; for example, based on the similarity of the feature point pairs, a part of the feature point pairs whose similarity is higher than a set threshold can be screened out from the feature point pairs that match each other in the image to be tested and the template image.
[0099] After the identification information region is extracted in the above manner, the space point mapping pair corresponding to the identification information region in the at least one space point mapping pair may be used as at least one target space point mapping pair.
[0100] In this embodiment, feature extraction and matching are performed on the image to be tested and the template image to determine at least one spatial point mapping pair. Based on the identification information area extracted from the image to be tested, at least one target spatial point mapping pair is screened from the at least one spatial point mapping pair. The target spatial point mapping pair can represent feature point pairs in the identification information area that match the template image, which can not only reduce the amount of data for subsequent clustering, but also ensure the accuracy of clustering.
[0101] Also, in local areas without obvious boundaries in the image to be tested, defects may be very subtle and easily masked by background noise or other non-target features. By extracting and identifying new areas, most of the irrelevant background information can be removed, making it easier to detect defects, thereby improving the accuracy of detection.
[0102] As another optional embodiment of the present application, a defect detection method is provided in the third embodiment of the present application. This embodiment is mainly an implementation of the above step S1021. Step S1021 may include but is not limited to:
[0103] S21. Determine at least one first feature point of the template image and at least one second feature point of the image to be measured.
[0104] In this embodiment, local area detection can be performed on the template image based on the local feature operator to obtain at least one first feature point, which can characterize the characteristics of the first local area in the template image and the spatial position of the first local area in the template image.
[0105] Similarly, local area detection can be performed on the image to be tested based on the local feature operator to obtain at least one second feature point, which can characterize the characteristics of the second local area in the image to be tested and the spatial position of the second local area in the image to be tested.
[0106] S22. Match at least one first feature point and at least one second feature point to obtain at least one space point mapping pair.
[0107] In this embodiment, the similarity between the features of each first feature point in at least one first feature point and each second feature point in at least one second feature point can be determined, and the first feature point and the second feature point whose similarity meets the set conditions are determined as a feature point pair with matching features.
[0108] An implementation of determining the similarity between the features of each first feature point in at least one first feature point and each second feature point in at least one second feature point, and determining the first feature point and the second feature point whose similarity satisfies a set condition as a feature point pair with mutually matched features may include:
[0109] For each second feature point, a KNN (K-Nearest Neighbors) algorithm is used to find K first feature points that are most similar to the feature of at least one first feature point. A first feature point with the best match is selected from the K first feature points, such as the first feature point with the highest similarity.
[0110] The best matching first feature point and second feature point are determined as a feature point pair with matching features.
[0111] Since the spatial positions of each first feature point in the template image and the spatial positions of each second feature point in the image to be tested have been determined in the stage of local area detection of the template image and the image to be tested based on the local feature operator, the spatial position of the best matching first feature point in the template image and the spatial position of the second feature point in the image to be tested in the feature point pair with matching features can be combined into a spatial point mapping pair.
[0112] In this embodiment, the accuracy of the first feature point and the second feature point can be improved by selecting a suitable local feature operator, and the accuracy of the spatial point mapping pair can be improved based on matching the more accurate first feature point and the second feature point.
[0113] As another optional embodiment of the present application, a defect detection method is provided in the fourth embodiment of the present application. This embodiment is mainly an implementation of the above step S102. Step S102 may include but is not limited to:
[0114] Step S1023: Determine at least one first feature point of the template image and at least one second feature point of the image to be measured.
[0115] Step S1024: Match at least one first feature point and at least one second feature point to obtain at least one spatial point mapping pair.
[0116] The detailed process of steps S1023-S1024 can be found in the relevant introduction of the above steps S21-S22, which will not be repeated here.
[0117] Step S1025: based on the identification information region extracted from the image to be tested, select at least one target space point mapping pair from at least one space point mapping pair; the target space point mapping pair is used to represent the feature point pair in the identification information region that matches the feature point pair in the template image.
[0118] The detailed process of step S1025 can refer to the relevant introduction of the above step S1022, which will not be repeated here.
[0119] Step S1026: Based on the spatial position, coordinate correction is performed on the feature point in the identification information area of the target space point mapping so that the second feature point in the identification information area is spatially consistent with the first feature point of the feature matching in the template image.
[0120] In this embodiment, the spatial position transformation matrix from the coordinate system of the image to be tested to the coordinate system of the template image can be determined based on the spatial position of the first local area represented by each first feature point of the template image in the template image and the spatial position of the second local area represented by each second feature point of the image to be tested in the image to be tested.
[0121] Based on the spatial position transformation matrix, the spatial position of the second feature point of the identification information area in the target spatial point mapping is transformed from the coordinate system of the image to be measured to a coordinate system consistent with the template image.
[0122] In this embodiment, by performing coordinate correction, it can be ensured that the second feature point of the identification information area is consistent with the corresponding feature point in the template image in the coordinate system, and an accurate target space point mapping pair can be provided for subsequent clustering operations.
[0123] As another optional embodiment of the present application, refer to Figure 4 , is a flowchart of a defect detection method provided in the fifth embodiment of the present application. This embodiment is mainly an implementation of the above step S103. Figure 4 As shown, step S103 may include but is not limited to:
[0124] Step S1031, clustering at least one target space point mapping pair according to the position offset of the feature point pair in the target space point mapping pair and the setting parameters corresponding to the target product to obtain at least one cluster; the setting parameters represent the number of printing batches of key information of the target product.
[0125] In an industrial production line, the key information of the same target product may be printed in batches. Each batch of printing may be affected by various external conditions such as printing equipment, material changes, and environmental factors, which may cause the printed key information to shift relative to the standard printing position. In order to capture the position shift caused by differences between printing batches, it can be set as a parameter as an important basis for clustering.
[0126] In this embodiment, the clustering algorithm can cluster at least one target space point mapping pair based on the position offset of the feature point pair in the target space point mapping pair under the guidance of the set parameters to obtain at least one cluster with the same value as the printing batch number.
[0127] In this embodiment, at least one target space point mapping pair is clustered according to the position offset of the feature point pair in the target space point mapping pair and the set parameters corresponding to the target product to obtain at least one cluster, so that different clusters correspond to different printing batches, and the feature point pairs in the target space point mapping pairs in each cluster have similar position offsets and belong to the same batch.
[0128] As another optional embodiment of the present application, refer to Figure 5 , is a flow chart of a defect detection method provided in the sixth embodiment of the present application. This embodiment is mainly an implementation of the above step S105. Figure 5 As shown, step S105 may include but is not limited to:
[0129] Step S1051: Based on the image block pairs corresponding to different clusters, determine the perspective transformation matrices corresponding to different clusters.
[0130] In this embodiment, the process of determining the perspective transformation matrix is described by taking an image block pair corresponding to a cluster as an example. For example, the perspective transformation matrix is determined based on multiple sets of mutually matching specific feature point pairs in the image block pair. The specific feature point pairs can be feature points corresponding to salient points (such as corner points, edge intersections, etc.) at corresponding positions in the template image and the image to be tested.
[0131] The perspective transformation matrix can be used to transform the image block of the template image in the image block pair to a viewing angle similar to the image block of the image to be tested.
[0132] Step S1052: Perform perspective transformation on the image blocks of the template image corresponding to the cluster based on the perspective transformation matrix.
[0133] After the perspective transformation, the image block of the template image can maintain consistency in viewing angle with the image block of the image to be tested in the image block alignment.
[0134] Step S1053: performing a difference operation on the image blocks corresponding to the clusters that have undergone perspective transformation to obtain a difference map corresponding to the clusters.
[0135] The pixel values at corresponding positions in the image block of the template image and the image block of the image to be tested in the image block pair corresponding to the cluster after perspective transformation are subtracted to obtain a differential image corresponding to the cluster.
[0136] For example, Figure 6 As shown, after extracting the image block pair including the image block 1 in the template image and the image block 11 in the image to be tested, the image block pair including the image block 2 in the template image and the image block 22 in the image to be tested, and the image block pair including the image block 3 in the template image and the image block 33 in the image to be tested, a difference operation is performed on the image block 1 and the image block 11 to obtain the following: Figure 6 The difference shown Figure 1 ; Perform differential operation on image block 2 and image block 22 to obtain Figure 6 The difference shown Figure 2 ; Perform a differential operation on image block 3 and image block 33 to obtain Figure 6 The difference shown Figure 3 .
[0137] Step S1054: Determine defects existing in the identification information in the image to be tested based at least on the difference images corresponding to each cluster.
[0138] In this implementation, spatial domain filtering and frequency domain filtering may be performed on the difference graph corresponding to each cluster to obtain a filtered difference graph corresponding to each cluster.
[0139] The filtered difference image corresponding to each cluster is thresholded to obtain a binary image (i.e., defect mask) corresponding to each cluster, where the white (or high gray value) area in the binary image represents a defect, and the black (or low gray value) area represents a non-defect.
[0140] Next, the defect mask and the image to be tested can be fused to obtain a fused image, which can intuitively show the defective area in the image to be tested.
[0141] The fusion of the defect mask and the image to be tested may include but is not limited to:
[0142] Superimpose the defect mask and the image to be tested;
[0143] Map the defect areas in the defect mask to specific colors or color ranges, and then overlay these color areas on the original image.
[0144] In this embodiment, the image blocks of the template image are transformed using a perspective transformation matrix so that they are consistent with the image blocks of the image to be tested in terms of viewing angle, which can eliminate errors introduced by different viewing angles and provide a more accurate basis for subsequent differential operations. The image block pairs that have undergone perspective transformation are subjected to differential operations to obtain a differential map, so that the differential map can more accurately reflect the differences between the image block pairs.
[0145] Applying spatial and frequency domain filtering to the difference image can effectively suppress noise while enhancing the features of the defect area. Spatial domain filtering can smooth the image and reduce random noise; frequency domain filtering can remove periodic noise or emphasize specific frequency components. This combination of multi-domain filtering makes defect detection more robust and reliable.
[0146] The defect mask of the image to be tested can be generated by filtering the difference image. The defect mask clearly marks the location and range of the defect in the form of a binary image.
[0147] In addition, the defect mask is fused with the image to be tested. The generated fused image not only retains all the information of the image to be tested, but also displays the defect area in a striking way (such as highlighting). This intuitive display method can improve the efficiency and accuracy of defect detection and provide clear guidance for subsequent repair work.
[0148] As another optional embodiment of the present application, refer to Figure 7 , is a flow chart of a defect detection method provided by the seventh embodiment of the present application. This embodiment is mainly an implementation method parallel to the above step S105. Figure 7 As shown, it may include but is not limited to:
[0149] Step S1055, determining perspective transformation matrices corresponding to different clusters based on the image block pairs corresponding to different clusters;
[0150] Step S1056, performing perspective transformation on the image blocks of the template image in the image blocks corresponding to the cluster based on the perspective transformation matrix;
[0151] Step S1057: performing a difference operation on the image blocks corresponding to the clusters that have undergone perspective transformation to obtain a difference map corresponding to the clusters.
[0152] The detailed process of steps S1055-S1057 can be found in the relevant introduction of the above steps S1051-S1053, which will not be repeated here.
[0153] Step S1058: based on the identification information region, remove the image block pairs corresponding to each cluster in the test image and the template image, and obtain initial region image pairs except for the image block pairs corresponding to each cluster in the identification information region and the region corresponding to the template image.
[0154] In this embodiment, the image block pairs corresponding to each cluster in the image area corresponding to the identification information area in the test image can be removed, and the image block pairs corresponding to each cluster in the image area corresponding to the identification information area in the template image can be removed, so that the obtained initial area image pairs do not lose other additional image information in the test image and the template image except the image block pairs corresponding to each cluster.
[0155] Taking an image block pair corresponding to a cluster as an example, it is explained that the image block pairs corresponding to each cluster in the image to be tested and in the template image are removed to obtain the initial region image pairs other than the image block pairs corresponding to each cluster in the identification information region and the region corresponding to the template image. For example, the image block pairs corresponding to the clusters in the image to be tested and in the template image are removed to obtain the initial region image pairs other than the image block pairs corresponding to the clusters in the identification information region and the region corresponding to the template image, which may include but are not limited to:
[0156] Step S31, creating a first mask image of the same size as the template image for the image block of the template image in the image block pair corresponding to the cluster. In the first mask image, the position of the image block of the template image is set to black (that is, the RGB value is (0,0,0)), and the rest of the positions remain transparent.
[0157] Step S32: create a second mask image of the same size as the image to be tested for the image block of the image to be tested in the image block pair corresponding to the cluster. In the first mask image, the position of the image block of the image to be tested is set to black (that is, the RGB value is (0,0,0)), and the rest of the positions remain transparent.
[0158] Step S33: perform pixel-by-pixel multiplication operation on the first mask image and the template image to obtain an initial region image in the region corresponding to the template image except for the image block pairs corresponding to the clusters.
[0159] Step S34 , performing pixel-by-pixel multiplication operation on the second mask image and the image to be tested, to obtain an initial area image in the corresponding area of the image to be tested except for the image block pairs corresponding to the clusters.
[0160] For example, Figure 8 As shown, after extracting the image block pair including the image block 1 in the template image and the image block 11 in the image to be tested, the image block pair including the image block 2 in the template image and the image block 22 in the image to be tested, and the image block pair including the image block 3 in the template image and the image block 33 in the image to be tested, by constructing a mask image for the image block pairs, the initial area image of the identification information area excluding the image block pairs corresponding to each cluster and the initial area image of the template image corresponding area excluding the image block pairs corresponding to each cluster are obtained as shown in FIG. Figure 8 shown.
[0161] Step S1059: Perform perspective transformation and differential operation on the initial region image pair to obtain a differential image corresponding to the initial region image pair.
[0162] In this embodiment, the perspective transformation and difference operation can be performed on the initial region image pair with reference to the perspective transformation and difference operation methods of steps S1052 and S1053 above, which will not be described in detail here.
[0163] Step S10510: Determine defects existing in identification information in the image to be tested based on the difference images corresponding to each cluster and the difference images corresponding to the initial region image pair.
[0164] In this embodiment, the determination method of step 1054 described above can be referred to to understand the defects existing in the identification information in the image to be tested based on the difference images corresponding to each cluster and the difference images corresponding to the initial area image, which will not be described in detail here.
[0165] In this embodiment, by removing the image block pairs corresponding to each cluster in the image to be tested and the template image based on the identification information area, an initial area image pair excluding the image block pairs corresponding to each cluster in the identification information area and the corresponding area of the template image is obtained, and perspective transformation and differential operation are performed on the initial area image pair to obtain a differential map corresponding to the initial area image pair. Based on the differential map corresponding to each cluster and the differential map corresponding to the initial area image pair, the defects existing in the identification information in the image to be tested are determined, thereby ensuring that the defects in the entire image to be tested can be fully detected, thereby ensuring the effect of defect detection.
[0166] As another optional embodiment of the present application, a defect detection method is provided in the eighth embodiment of the present application. This embodiment is mainly an implementation of the above step S10510. Step S10510 may include but is not limited to:
[0167] Step S41 : splicing the difference images corresponding to each cluster and the difference images corresponding to the initial region image to obtain a target difference image.
[0168] The target difference map can integrate the information of the difference map corresponding to each cluster and the difference map corresponding to the initial region image pair, and is used to display the region between the image to be tested and the template image.
[0169] For example, Fig. 9 As shown, the target difference map, compared with the difference maps corresponding to each cluster and the difference maps corresponding to the initial region image pair, represents a more complete difference and can show the region in the image to be tested that is different from the template image.
[0170] Step S42: Determine defects existing in the identification information in the image to be tested based on the target difference image.
[0171] In this embodiment, the determination method in step 1054 described above can be referred to to understand the defect of determining the identification information in the image to be tested based on the target difference map, which will not be described in detail here.
[0172] In this embodiment, by splicing the difference images corresponding to each cluster and the difference images corresponding to the initial region image, a target difference image is obtained, which can display the difference between the entire image to be tested and the template image at one time without switching between multiple separate difference images. This can improve the efficiency of defect detection and reduce the possibility of omission or misjudgment.
[0173] In this implementation, the target difference image may also be subjected to spatial domain filtering and frequency domain filtering to effectively suppress noise and improve the accuracy of defect detection.
[0174] In this embodiment, post-processing parameters such as spatial domain filtering and frequency domain filtering can be configured in the configuration interface as needed. Of course, in addition to configuring post-processing parameters, the configuration interface also supports configuring local feature operators and matching strengths related to feature extraction and matching, as well as selecting a template image in the configuration interface, importing the image to be tested, and then using the defect detection method provided in this application to detect the image to be tested, and the defect detection results can be displayed in the configuration interface. For example, Fig.10 As shown, the defect detection results can be displayed in the configuration interface.
[0175] During the actual deployment process, if there is a lot of interference noise in the defect detection results of a certain product, affecting the detection quality, the production line personnel can directly adjust the relevant post-processing algorithm parameters through the configuration interface according to the actual situation to improve the accuracy of defect detection.
[0176] The template image selected in the configuration interface can be the image of the entire template or a portion of the image in the template. Fig.11 As shown, the template image can be the entire template or a portion of the image in the template. If it is the entire template, the defect detection method can be used to perform defect detection on the entire area of the image to be tested; if it is a portion of the image in the template, the defect detection method can be used to perform defect detection on the corresponding portion of the image to be tested. Whether defect detection is performed on the entire area of the image to be tested or on a portion of the image to be tested, the defect detection method of the present application can ensure the accuracy of defect detection.
[0177] In this embodiment, the defect detection method is described in combination with the template image and the image to be tested. Fig.12 As shown, local area detection is performed on the template image based on the local feature operator to obtain at least one first feature point, which can characterize the characteristics of the first local area in the template image and the spatial position of the first local area in the template image.
[0178] Similarly, local area detection can be performed on the image to be tested based on the local feature operator to obtain at least one second feature point, which can characterize the characteristics of the second local area in the image to be tested and the spatial position of the second local area in the image to be tested.
[0179] KNN feature point matching: For each second feature point, use the KNN (K-Nearest Neighbors) algorithm to find the K first feature points that are most similar to its features in at least one first feature point. The best matching first feature point and second feature point are determined as a feature point pair with mutually matching features. The spatial position of the best matching first feature point in the template image and the spatial position of the second feature point in the image to be tested in the feature point pair with mutually matching features form a spatial point mapping pair to obtain at least one spatial point mapping pair.
[0180] A portion of the spatial point mapping pairs is screened out from at least one spatial point mapping pair, and a boundary in the image to be tested is determined based on the screened spatial point mapping pairs, wherein the boundary may contain the spatial position of the feature point of the image to be tested in the screened spatial point mapping pairs. The area within the boundary may be determined as the identification information area and extracted.
[0181] After obtaining the identification information area, at least one target space point mapping pair is selected from at least one space point mapping pair based on the identification information area; based on the spatial position, the coordinates of the feature points of the identification information area in the target space point mapping pair are corrected so that the second feature point in the identification information area is spatially consistent with the first feature point of the feature matching in the template image.
[0182] According to the position offset of the feature point pair in the target space point mapping pair, the at least one target space point mapping pair is clustered to obtain at least one cluster.
[0183] The image block pairs in the template image and the image to be tested corresponding to different clusters are extracted respectively.
[0184] Based on the image block pairs corresponding to different clusters, the perspective transformation matrices corresponding to different clusters are determined.
[0185] Based on the perspective transformation matrix, the image blocks of the template image in the image blocks corresponding to the cluster are perspective transformed.
[0186] The image blocks corresponding to the clusters that have undergone perspective transformation are subjected to difference operation to obtain a difference map corresponding to the clusters.
[0187] Based on the identification information region, the image block pairs corresponding to each cluster in the image to be tested and the template image are removed to obtain initial region image pairs except for the image block pairs corresponding to each cluster in the identification information region and the corresponding region of the template image.
[0188] Perform perspective transformation and differential operation on the initial region image pair to obtain a differential image corresponding to the initial region image pair;
[0189] The difference maps corresponding to each cluster and the difference maps corresponding to the initial region image are spliced to obtain the target difference map;
[0190] Defects existing in identification information in the image to be tested are determined based on the target difference map.
[0191] Next, the processing device provided in the present application is introduced. The processing device introduced below and the processing method introduced above can be referenced to each other.
[0192] Reference Fig.13 The processing device includes: an acquisition module 100, a determination module 200, a clustering module 300, an extraction module 400 and a comparison module 500.
[0193] The acquisition module 100 is used to obtain an image to be tested of a target product and a template image, wherein the image to be tested contains a plurality of identification information of the target product.
[0194] The determination module 200 is used to extract and match the features of the image to be tested and the template image to determine at least one target space point mapping pair; the target space point mapping pair is used to represent the feature point pairs in the image to be tested that match the feature point pairs in the template image.
[0195] The clustering module 300 is used to cluster the at least one target space point mapping pair according to the position offset of the feature point pair in the target space point mapping pair to obtain at least one cluster.
[0196] The extraction module 400 is used to respectively extract image block pairs in the template image and the image to be tested corresponding to different clusters, wherein the image block pairs include at least one identification information.
[0197] The comparison module 500 is used to perform a difference comparison based on the image blocks corresponding to different clusters to determine the defects in the identification information in the image to be tested.
[0198] In this implementation, the determination module 200 may be specifically used for:
[0199] Performing feature extraction and matching on the image to be tested and the template image to determine at least one spatial point mapping pair;
[0200] Based on the identification information region extracted from the image to be tested, at least one target space point mapping pair is screened from the at least one space point mapping pair; the target space point mapping pair is used to represent the feature point pair in the identification information region that matches the feature point pair in the template image.
[0201] The process in which the determination module 200 extracts and matches the image to be tested and the template image to determine at least one spatial point mapping pair may specifically include:
[0202] Determine at least one first feature point of the template image and at least one second feature point of the image to be tested; the first feature point represents the feature of a first local area in the template image and the spatial position of the first local area in the template image, and the second feature point represents the feature of a second local area in the image to be tested and the spatial position of the second local area in the image to be tested;
[0203] The at least one first feature point and the at least one second feature point are matched to obtain at least one space point mapping pair.
[0204] The determination module 200 may also be used to:
[0205] Based on the spatial position, coordinate correction is performed on the second feature point of the identification information area in the target space point mapping pair, so that the second feature point of the identification information area is spatially consistent with the first feature point of feature matching in the template image.
[0206] The clustering module 300 may be specifically used for:
[0207] According to the position offset of the feature point pair in the target space point mapping pair and the setting parameters corresponding to the target product, the at least one target space point mapping pair is clustered to obtain at least one cluster; the setting parameters represent the number of printing batches of key information of the target product.
[0208] The comparison module 500 may be specifically used for:
[0209] Based on the image block pairs corresponding to different clusters, determining the perspective transformation matrices corresponding to different clusters;
[0210] Performing perspective transformation on the image blocks of the template image in the image block pairs corresponding to the cluster based on the perspective transformation matrix;
[0211] Performing a difference operation on the image blocks corresponding to the cluster after perspective transformation to obtain a difference map corresponding to the cluster;
[0212] Defects existing in the identification information of the image to be tested are determined based at least on the difference images corresponding to the clusters.
[0213] The comparison module 500 can also be used for:
[0214] Based on the identification information region, the image block pairs corresponding to each of the clusters in the image to be tested and the template image are removed to obtain initial region image pairs in the identification information region and the region corresponding to the template image except for the image block pairs corresponding to each of the clusters;
[0215] Performing perspective transformation and differential operation on the initial region image pair to obtain a differential image corresponding to the initial region image pair;
[0216] Defects existing in the identification information in the image to be tested are determined based on the difference images corresponding to each of the clusters and the difference images corresponding to the initial region image pair.
[0217] The process of the comparison module 500 determining defects existing in the identification information in the image to be tested based on the difference images corresponding to each of the clusters and the difference images corresponding to the initial region image pair may specifically include:
[0218] splicing the difference images corresponding to each of the clusters and the difference images corresponding to the initial region image pair to obtain a target difference image;
[0219] Defects existing in identification information in the image to be tested are determined based on the target difference map.
[0220] In another embodiment of the present application, an electronic device is provided.
[0221] Electronic equipment includes:
[0222] The memory is used to store computer programs;
[0223] The processor is used to execute the computer program so that the electronic device can implement the defect detection method introduced in any one of the first to seventh embodiments described above.
[0224] A computer-readable storage medium is also provided in an embodiment of the present application. The storage medium carries one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can implement a defect detection method as described in any one of the first to seventh embodiments described above.
[0225] It should also be noted that the device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, in the drawings of the device embodiments provided by the present application, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines.
[0226] Through the description of the above implementation mode, the technicians in the field can clearly understand that the present application can be implemented by means of software plus necessary general hardware, and of course, it can also be implemented by special hardware including special integrated circuits, special CPUs, special memories, special components, etc. In general, all functions completed by computer programs can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be various, such as analog circuits, digital circuits or special circuits. However, for the present application, software program implementation is a better implementation mode in more cases. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a readable storage medium, such as a computer floppy disk, a U disk, a mobile hard disk, a ROM, a RAM, a disk or an optical disk, etc., including a number of instructions to enable a computer device (which can be a personal computer, a training device, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0227] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product.
[0228] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website site, a computer, a training device, or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, training device, or data center. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a training device, a data center, etc. that includes one or more available media integrations. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)), etc.
Claims
1. A defect detection method, comprising: Obtaining an image to be tested and a template image of a target product, wherein the image to be tested includes multiple identification information of the target product; Performing feature extraction and matching on the image to be tested and the template image to determine at least one target space point mapping pair; the target space point mapping pair is used to represent a feature point pair in the image to be tested that matches a feature point pair in the template image; Clustering the at least one target space point mapping pair according to the position offset of the feature point pair in the target space point mapping pair to obtain at least one cluster; Respectively extracting image block pairs from the template image and the image to be tested corresponding to different clusters, wherein the image block pairs include at least one identification information; Based on the difference comparison of the image blocks corresponding to different clusters, the defects existing in the identification information of the image to be tested are determined.
2. The method according to claim 1, wherein the step of extracting and matching features of the image to be tested and the template image to determine at least one target space point mapping pair comprises: Performing feature extraction and matching on the image to be tested and the template image to determine at least one spatial point mapping pair; Based on the identification information area extracted from the image to be tested, screening at least one target space point mapping pair from the at least one space point mapping pair; The target space point mapping pair is used to represent the feature point pair in the identification information area that matches the feature point pair in the template image.
3. The method according to claim 2, wherein the step of extracting and matching features of the image to be tested and the template image to determine at least one spatial point mapping pair comprises: Determining at least one first feature point of the template image and at least one second feature point of the image to be measured; The first feature point represents a feature of a first local area in the template image and a spatial position of the first local area in the template image, and the second feature point represents a feature of a second local area in the image to be tested and a spatial position of the second local area in the image to be tested; The at least one first feature point and the at least one second feature point are matched to obtain at least one space point mapping pair.
4. The method according to claim 3, further comprising: Based on the spatial position, coordinate correction is performed on the second feature point of the identification information area in the target space point mapping pair, so that the second feature point of the identification information area is spatially consistent with the first feature point of feature matching in the template image.
5. The processing method according to claim 1, wherein clustering the at least one target space point mapping pair according to the position offset of the feature point pair in the target space point mapping pair to obtain at least one cluster comprises: According to the position offset of the feature point pair in the target space point mapping pair and the setting parameters corresponding to the target product, the at least one target space point mapping pair is clustered to obtain at least one cluster; the setting parameters represent the number of printing batches of key information of the target product.
6. The processing method according to claim 2, wherein the performing difference comparison based on the image blocks corresponding to different clusters to determine the defects in the identification information in the image to be tested comprises: Based on the image block pairs corresponding to different clusters, determining the perspective transformation matrices corresponding to different clusters; Performing perspective transformation on the image blocks of the template image in the image block pairs corresponding to the cluster based on the perspective transformation matrix; Performing a difference operation on the image blocks corresponding to the cluster after perspective transformation to obtain a difference map corresponding to the cluster; Defects existing in the identification information of the image to be tested are determined based at least on the difference images corresponding to the clusters.
7. The processing method according to claim 6, further comprising: Based on the identification information region, the image block pairs corresponding to each of the clusters in the image to be tested and the template image are removed to obtain initial region image pairs in the identification information region and the region corresponding to the template image except for the image block pairs corresponding to each of the clusters; Performing perspective transformation and differential operation on the initial region image pair to obtain a differential image corresponding to the initial region image pair; Defects existing in the identification information in the image to be tested are determined based on the difference images corresponding to each of the clusters and the difference images corresponding to the initial region image pair.
8. The processing method according to claim 7, wherein the step of determining defects existing in the identification information in the image to be tested based on the difference images corresponding to each of the clusters and the difference images corresponding to the initial region image pair comprises: splicing the difference images corresponding to each of the clusters and the difference images corresponding to the initial region image pair to obtain a target difference image; Defects existing in identification information in the image to be tested are determined based on the target difference map.
9. A processing device comprising: An acquisition module, used to obtain an image to be tested and a template image of a target product, wherein the image to be tested contains multiple identification information of the target product; A determination module, used for performing feature extraction and matching on the image to be tested and the template image to determine at least one target space point mapping pair; The target space point mapping pair is used to represent the feature point pairs in the image to be tested and in the template image that match each other; A clustering module, configured to cluster the at least one target space point mapping pair according to the position offset of the feature point pair in the target space point mapping pair to obtain at least one cluster; An extraction module, used to extract image block pairs from the template image and the image to be tested corresponding to different clusters, respectively, wherein the image block pairs include at least one identification information; The comparison module is used to perform a difference comparison based on the image blocks corresponding to different clusters to determine the defects existing in the identification information in the image to be tested.
10. An electronic device, comprising: The memory is used to store computer programs; The processor is used to execute the computer program so that the electronic device can implement the defect detection method as described in any one of claims 1 to 8.
Citation Information
Cited By
Part missing detection method, device and system for printed circuit board
CN121391816A