Product defect detection method, device and equipment and storage medium

By comparing product images and CAD element data, and using image matching feature points to establish a transformation matrix, the problem of poor universality of defect detection in the existing technology is solved, and universal defect detection for different products is realized.

CN118864435APending Publication Date: 2024-10-29BEIJING BOSHI INTELLIGENT TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411088635.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-08
Publication Date
2024-10-29

AI Technical Summary

Technical Problem

Existing product defect detection methods require different algorithms to be designed for different products, and their universality is poor, making it difficult to achieve widely applicable defect detection.

Method used

By obtaining the product image and CAD primitive data, extract the outline and convert the image coordinates into CAD coordinates, compare them to determine the defect area, use image matching feature points to establish a transformation matrix, and combine smoothing and filtering processing to improve the universality of detection. .

Benefits of technology

There is no need to design different algorithms for different products, and it can universally detect product defect areas, improving the universality and accuracy of detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118864435A_ABST
    Figure CN118864435A_ABST
Patent Text Reader

Abstract

The invention relates to a product defect detection method and device, equipment and a storage medium. The method comprises the steps that a product image and CAD primitive data of a to-be-detected product are acquired; extracting a contour of the to-be-detected product from the product image, and converting image coordinates of the contour into CAD coordinates to obtain a target contour aligned with the CAD primitive data; and comparing the target contour with the CAD primitive data, and determining a defect area of the to-be-detected product. According to the product defect detection method and device, the product defect area can be determined by comparing the image contour of the product with the CAD primitive data for all the products, and different algorithms do not need to be designed for different products, so that the universality of the product defect detection method is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of data processing technology, and in particular to a product defect detection method, device, equipment and storage medium. Background Art

[0002] At present, when detecting contour defects such as incompleteness and burrs of products, it is usually necessary to extract the image feature information of the product, combine it with the specific product information, design a corresponding defect detection method, and detect the product defects. However, this method requires different defect detection algorithms to be designed for different products, and its universality is relatively poor. Therefore, how to improve the universality of product defect detection is a technical problem that needs to be solved urgently by technicians in this field. Summary of the invention

[0003] In view of this, the present disclosure proposes a product defect detection method, apparatus, device and storage medium, which can improve the universality of the product defect detection method.

[0004] According to one aspect of the present disclosure, there is provided a product defect detection method, comprising:

[0005] Obtain product images and CAD metadata of the product to be inspected;

[0006] Extracting the contour of the product to be inspected from the product image, and converting the image coordinates of the contour into CAD coordinates to obtain a target contour aligned with the CAD object data;

[0007] The target contour is compared with the CAD metadata to determine the defect area of ​​the product to be inspected.

[0008] In a possible implementation, when converting the image coordinates of the contour into CAD coordinates, the process includes:

[0009] Determine the primitive feature points from the CAD primitive data; wherein the primitive feature points are points with unique local properties located on the contour of the CAD image of the product to be inspected;

[0010] Extracting image feature points corresponding to the primitive feature points from the contour, and forming matching feature points with the primitive feature points;

[0011] Based on the matching feature points, a conversion matrix between the image coordinate system and the CAD coordinate system is established;

[0012] Based on the transformation matrix, the image coordinates of the contour are converted into CAD coordinates.

[0013] In a possible implementation method, after obtaining the target contour in the CAD coordinate system, the following steps are further included:

[0014] Performing at least one preprocessing operation of smoothing and filtering on the target contour;

[0015] The preprocessed target contour is compared with the CAD element data to determine the defect area of ​​the product to be inspected.

[0016] In a possible implementation, when comparing the target contour with the CAD element data to determine the defect area of ​​the product to be inspected, the method includes:

[0017] Splitting the complex CAD element data into basic element data;

[0018] Acquire each contour point constituting the target contour, and calculate the minimum distance between each contour point and the corresponding basic graphic element data;

[0019] Screen out contour points whose minimum distance is greater than a set distance threshold as defect contour points;

[0020] Based on the defect contour points, the defect area of ​​the product to be inspected is determined.

[0021] In a possible implementation, when comparing the target contour with the CAD element data to determine the defect area of ​​the product to be inspected, the method includes:

[0022] The CAD primitive data are grouped by using contour sorting to obtain at least two grouped CAD primitives;

[0023] For each of the grouped CAD primitives, extracting a corresponding target contour segment from the target contour as a grouped target contour corresponding to each of the grouped CAD primitives;

[0024] Binding each of the grouped CAD primitives with a corresponding grouped target contour to obtain a group set corresponding to each of the grouped CAD primitives;

[0025] Based on each of the grouping sets, the defective area of ​​the product to be inspected is determined by grouping the grouped CAD primitives in each of the calculation sets.

[0026] In a possible implementation, when determining the defect area of ​​the product to be inspected based on the defect contour points, the method includes:

[0027] Projecting the defect contour point to the corresponding basic graphic element data to obtain the projection point corresponding to the defect contour point;

[0028] The area enclosed by the defect contour points and the projection points is determined as the defect area of ​​the product to be inspected.

[0029] In a possible implementation manner, after the defective area of ​​the product to be inspected is determined, the method further includes:

[0030] Convert the CAD coordinates of the defect contour point and the projection point into image coordinates;

[0031] Calculating evaluation data of the defect area based on the image coordinates of the defect contour point and the projection point, wherein the evaluation data includes at least one of the area, depth and width of the defect area;

[0032] Based on the evaluation data of the defective area, it is determined whether the defective area is a final defective area of ​​the product to be inspected.

[0033] According to a second aspect of the present disclosure, there is also provided a device for detecting product contour defects, comprising:

[0034] A data acquisition module, used to acquire product images and CAD metadata of the product to be inspected;

[0035] An image matching module is used to extract the contour of the product to be detected from the product image, and convert the image coordinates of the contour into CAD coordinates to obtain a target contour aligned with the CAD object data;

[0036] The defect recognition module is used to compare the target contour with the CAD metadata to determine the defect area of ​​the product to be inspected.

[0037] According to a third aspect of the present disclosure, there is also provided a processing device for detecting product contour defects, comprising:

[0038] processor;

[0039] a memory for storing processor-executable instructions;

[0040] Wherein, the processor is configured to implement any method described in the first aspect of the present disclosure when executing the executable instructions.

[0041] According to a fourth aspect of the present disclosure, a non-volatile computer-readable storage medium is further provided, on which computer program instructions are stored, and when the computer program instructions are executed by a processor, any method described in the first aspect of the present disclosure is implemented.

[0042] The present disclosure provides a product defect detection method, device, equipment and storage medium, the method comprising: obtaining a product image and CAD metadata of a product to be detected; extracting the contour of the product to be detected from the product image, and converting the image coordinates of the contour into CAD coordinates to obtain a target contour aligned with the CAD metadata; comparing the target contour with the CAD metadata to determine the defect area of ​​the product to be detected. In the present disclosure, for all products, the product defect area can be determined by comparing the image contour of the product with the CAD metadata, without the need to design different algorithms for different products, thereby improving the universality of the product defect detection method.

[0043] Further features and aspects of the present disclosure will become apparent from the following detailed description of exemplary embodiments with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate exemplary embodiments, features, and aspects of the disclosure and, together with the description, serve to explain the principles of the disclosure.

[0045] Figure 1 A flow chart showing a method for detecting product defects according to an embodiment of the present disclosure is shown;

[0046] Figure 2 A flow chart of contour smoothing processing according to an embodiment of the present disclosure is shown;

[0047] Figure 3 A schematic diagram of contour smoothing processing according to an embodiment of the present disclosure is shown;

[0048] Figure 4 A flow chart of contour filtering processing according to an embodiment of the present disclosure is shown;

[0049] Figure 5 A schematic diagram of contour filtering iteration according to an embodiment of the present disclosure is shown;

[0050] Figure 6 A schematic diagram showing a contour defect according to an embodiment of the present disclosure is shown;

[0051] Figure 7 A schematic diagram of contour defect screening according to an embodiment of the present disclosure is shown;

[0052] Figure 8 A CAD grouping schematic diagram of an embodiment of the present disclosure is shown;

[0053] Fig. 9 A multi-image contour defect detection flow chart of an embodiment of the present disclosure is shown;

[0054] Fig.10 A diagram showing a device for detecting product contour defects according to an embodiment of the present disclosure is shown;

[0055] Fig.11 A diagram showing a device for detecting product contour defects according to an embodiment of the present disclosure. DETAILED DESCRIPTION

[0056] Various exemplary embodiments, features and aspects of the present disclosure will be described in detail below with reference to the accompanying drawings. The same reference numerals in the accompanying drawings represent elements with the same or similar functions. Although various aspects of the embodiments are shown in the accompanying drawings, the drawings are not necessarily drawn to scale unless otherwise specified.

[0057] The word “exemplary” is used exclusively herein to mean “serving as an example, example, or illustration.” Any embodiment described herein as “exemplary” is not necessarily to be construed as preferred or advantageous over other embodiments.

[0058] In addition, in order to better illustrate the present disclosure, numerous specific details are given in the following specific embodiments. It should be understood by those skilled in the art that the present disclosure can also be implemented without certain specific details. In some examples, methods, means, components and circuits well known to those skilled in the art are not described in detail in order to highlight the subject matter of the present disclosure.

[0059] Figure 1 FIG. 1 is a flow chart showing a method for detecting product defects according to an embodiment of the present disclosure. Figure 1 As shown, the method includes steps S1100-S1300.

[0060] S1100, obtaining a product image and CAD metadata of a product to be inspected, wherein the product to be inspected is a product that currently needs to be inspected for defects.

[0061] When inspecting a product to be inspected, it is necessary to collect an image of the product to be inspected. The image collected is the product image of the product to be inspected. In order to facilitate the comparison with the CAD image data of the product, it is necessary to take a vertical shot directly above the selected surface of the product to obtain a product image that matches the selected view of the product's CAD image.

[0062] When designing a product to be inspected, it is necessary to draw a CAD image of the product to be inspected. The basic elements used when drawing the CAD image of the product to be inspected are the CAD element data of the product to be inspected. The CAD element data includes at least one of a line segment, a circle, an arc, an ellipse, and an elliptical arc, which are not specifically limited here.

[0063] S1200, extracting the contour of the product to be inspected from the product image, and converting the image coordinates of the contour into CAD coordinates to obtain a target contour aligned with the CAD object data.

[0064] When extracting the contour of the product to be detected from the product image, it can be implemented by using a Blob detection algorithm or a Canny contour extraction algorithm, which is not specifically limited here.

[0065] After the contour of the product to be inspected is extracted, an operation of converting the image coordinates of the contour into CAD coordinates may be performed, which may specifically include steps S1210 - S1240 .

[0066] S1210, determining primitive feature points from the CAD primitive data of the product to be inspected; wherein the primitive feature points are points with unique local properties located on the contour of the CAD image of the product to be inspected, for example, points such as tangent points, intersection points, and endpoints on the contour of the CAD image of the product to be inspected can be determined as primitive feature points.

[0067] It should be noted that, in order to ensure the accuracy of subsequent coordinate conversion, the number of primitive feature points may be set to a first number, wherein the first number may range from 2 to 3, and preferably, the first number may be set to 3.

[0068] S1220, extracting image feature points corresponding to the primitive feature points from the contour, and forming matching feature points with the primitive feature points. Specifically, image feature points corresponding to the primitive feature points can be extracted from the product image contour using at least one detection method among circle detection, line detection, and corner point detection, and forming matching feature points with the primitive feature points. Specifically, how to extract image feature points based on detection methods such as circle detection, line detection, and corner point detection is common knowledge in the art and will not be described in detail here.

[0069] It should be noted here that, in the case where N primitive feature points are determined in step S1220, each primitive feature point will be traversed, and for the current primitive feature point A1 traversed, the current image feature point A1' corresponding to it will be extracted from the product image contour, and the current primitive feature point A1 and the current image feature point A1' will be combined to form the current matching feature point A corresponding to the current primitive feature point A1, that is, the current matching feature point A includes the current primitive feature point A1 and the current image feature point A1'. After the traversal is completed, the matching feature points corresponding to each primitive feature point can be obtained.

[0070] S1230: Establish a conversion matrix between the image coordinate system and the CAD coordinate system based on the matching feature points. Specifically, how to establish a conversion matrix between the image coordinate system and the CAD coordinate system based on multiple matching feature points is common knowledge in the art and will not be described in detail here.

[0071] S1240, based on the transformation matrix, convert the image coordinates of the contour into CAD coordinates. Specifically, a transformation relationship between the image coordinate system and the CAD coordinate system is constructed based on the transformation matrix, and based on the constructed transformation relationship, the image coordinates of the contour are converted into CAD coordinates. The transformation relationship between the image coordinate system and the CAD coordinate system constructed based on the transformation matrix is ​​as follows:

[0072]

[0073] Among them, (X img , Y img ) is the image coordinate of the contour, (X cad , Y cad ) is the CAD coordinate of the transformed contour, h is a pre-constructed transformation matrix, and elements h0 to h8 in the transformation matrix are determined according to the multiple matching feature points constructed above.

[0074] It should be noted here that when determining the transformation matrix in the above formula, at least three groups of matching feature points are required. Specifically, for each group of matching feature points, the CAD coordinates of the primitive feature points and the image coordinates of the image feature points are obtained, and the corresponding transformation relationship is constructed based on the CAD coordinates of the primitive feature points, the image coordinates of the image feature points and the transformation matrix to be solved, and finally the transformation relationship corresponding to each group of matching feature points is obtained. Based on all the obtained transformation relationships, the transformation matrix is ​​solved. Among them, elements h0 to h8 in the transformation matrix to be solved are all unknowns to be solved.

[0075] After obtaining the above conversion relationship, the image coordinates of each contour point can be converted into corresponding CAD coordinates based on the obtained conversion relationship to obtain a target contour aligned with the CAD metadata, thereby facilitating subsequent operations of comparing the target contour with the CAD metadata.

[0076] In one possible implementation, in order to improve the accuracy of subsequent comparison operations, after obtaining the target contour in the CAD coordinate system, the target contour in the CAD coordinate system is first preprocessed by at least one of smoothing and filtering operations, and then the preprocessed target contour is compared with the CAD metadata to determine the defective area of ​​the product to be inspected.

[0077] It should be noted here that after obtaining the target contour in the CAD coordinate system, the preprocessing operation of only smoothing the target contour can be performed; or the preprocessing operation of only filtering the target contour can be performed; or the target contour can be smoothed first, and then the smoothed target contour can be filtered to obtain the preprocessed target contour, which is not specifically limited here.

[0078] Smoothing refers to adjusting the position of each contour point on the target contour so as to make the target contour smoother without changing the general shape of the target contour. In a possible implementation, when smoothing the target contour, the following can be done: Figure 2 As shown, the following steps are included:

[0079] First, traverse the contour points that make up the target contour.

[0080] Second, for the current contour point traversed, select the number of smoothing points before and after the current contour point to perform straight line fitting to obtain the current fitting line, then project the current contour point onto the current fitting line to obtain a new contour point, and use the new contour point to replace the old current contour point to complete the smoothing of the current contour point. The number of smoothing points can be set according to the specific scenario.

[0081] For example, the number of smoothing points can be set to 3, that is, Figure 3 As shown in the left view, select 3 contour points before the current contour point, select 3 contour points after the current contour point, and perform straight line fitting on the 3 contour points before the current contour point and the 3 contour points after the current contour point, so as to obtain the current fitting line corresponding to the current contour point. Then, project the current contour point onto the current fitting line to obtain a new contour point, and replace the old current contour point with the new contour point, so as to obtain the following: Figure 3 The smoothing result of the current contour point is shown in the right view.

[0082] Third, after the traversal is completed, the smoothing process of each contour point on the target contour can be completed.

[0083] Filtering refers to downsampling the contour points on the target contour to reduce the number of contour points that need to be compared, thereby reducing the amount of calculation in the subsequent comparison steps. In a possible implementation, the target contour can be filtered based on the Ramer algorithm. The specific steps are as follows: Figure 4 As shown, steps S1211-S1261 may be included.

[0084] S1211, select the starting point and the end point of the target contour, and generate a straight line according to the starting point and the end point. It should be noted that for a closed-loop target contour, after the starting point is selected, the selected end point is the previous point of the starting point.

[0085] S1221, calculating the maximum distance maxDis from the contour point to the straight line between the starting point and the end point.

[0086] S1231, compare the obtained maximum distance maxDis with the set distance threshold disTHre. If the maximum distance maxDis is greater than the distance threshold disTHre, the point where the maximum distance maxDis is located and the starting point and the ending point form two new straight lines, as well as two pairs of new starting points and ending points, respectively, wherein the two endpoints of each new straight line constitute a pair of new starting points and ending points. Then, for each pair of new starting points and ending points, the calculations of steps S1221-S1231 are repeated respectively. Among them, the distance threshold disTHre can be determined according to the minimum defect size required for actual defect detection.

[0087] S1241: If the maximum distance maxDis is less than the distance threshold disTHre, the points between the starting point and the ending point are deleted, and only the starting point and the ending point are retained.

[0088] S1251, determine whether there are new straight lines, starting points and end points generated, if yes, wait for the recursion to complete until there are no new straight lines, starting points and end points generated. Figure 5 A schematic diagram of target contour filtering iteration is shown.

[0089] S1261, connecting the retained points in sequence to form a new contour, and the new contour is the target contour after filtering.

[0090] After completing the preprocessing of the target contour, the preprocessed target contour can be compared with the CAD metadata to determine the defective area of ​​the product to be inspected.

[0091] S1300, comparing the target contour with the CAD metadata to determine the defect area of ​​the product to be inspected.

[0092] In a possible implementation, when comparing the target contour with the CAD metadata to determine the defective area of ​​the product to be inspected, steps S1310-S1340 may be included.

[0093] S1310, splitting the CAD complex primitive data into basic primitive data. It should be noted that the primitive data constituting the product to be inspected may include complex primitives such as polygons and spline curves in addition to basic primitives such as line segments, circles, circular arcs, ellipses, and elliptical arcs. Since the algorithm for calculating the minimum distance from contour points to complex primitives is relatively complex, it is necessary to split the complex primitives in the CAD primitive data into basic primitives. After the basic primitives are split, the calculation of the minimum distance from contour points to complex primitives is transformed into the calculation of the minimum distance from contour points to basic primitives such as line segments, circles, circular arcs, ellipses, and elliptical arcs, thereby reducing the difficulty of calculating the minimum distance.

[0094] When splitting a complex primitive, it can be split into multiple line segments. For example, each edge of a polygon can be split out as a basic primitive, and a spline curve can be split according to a preset step length to obtain multiple line segments constituting the spline curve. The preset step length can be determined according to the distance threshold disTHre mentioned above. Specifically, the preset step length can be set to 1 / 10 of the distance threshold disTHre.

[0095] S1320, obtaining each contour point constituting the target contour, and calculating the minimum distance between each contour point and the corresponding basic primitive data. Specifically, based on the target contour aligned with the CAD primitive data obtained in step S1240, the CAD primitives are split into basic primitives, and the minimum distance between each contour point of the target contour and the corresponding basic primitive after splitting is calculated, that is, the minimum distance between each contour point of the target contour and basic primitives such as line segments, circles, circular arcs, ellipses, and elliptical arcs is calculated.

[0096] S1330, screening out contour points whose minimum distance is greater than a set distance threshold as defect contour points.

[0097] S1340, based on the defect contour points, determine the defect area of ​​the product to be inspected. Specifically, the defect contour points are projected onto the corresponding basic image data to obtain the projection points corresponding to the defect contour points. Then, the area enclosed by the defect contour points and the projection points is determined as the defect area of ​​the product to be inspected. In a specific example, the defect area of ​​the product to be inspected can be determined as follows: Figure 6 shown.

[0098] In order to improve the accuracy of defect detection, after the defect area of ​​the product to be detected is determined based on step S1340, the selected defect area can be further screened by at least one evaluation data such as the area, depth, width, etc. of the defect area. The further screening may include the following steps:

[0099] First, the CAD coordinates of the defect contour points and projection points that enclose the product defect area are converted into image coordinates. Specifically, the inverse matrix h of the conversion matrix in step S1240 is solved. -1 , then based on the solved inverse matrix h -1 Construct a transformation relationship for converting CAD coordinates into image coordinates. The transformation relationship can be as follows:

[0100] P img =h -1 P cad

[0101] Among them, P cad is the CAD coordinates of each defect contour point and projection point in the CAD coordinate system, P imgare the image coordinates of each defect contour point and projection point in the image coordinate system after conversion.

[0102] Secondly, based on the image coordinates of each defect contour point and projection point, the evaluation data of the defect area is calculated. It should be noted here that the area of ​​the defect area in the evaluation data is the area of ​​the closed area surrounded by each defect contour point and the projection point. The depth of the defect area in the evaluation area data is the maximum distance from each defect contour point to the corresponding projection point. The width of the defect area in the evaluation data is the length of the contour connected by each defect contour point.

[0103] The calculation formula of the defect area is as follows:

[0104]

[0105] The calculation formula of the depth of the defect area Depth is as follows:

[0106]

[0107] The calculation formula for the width of the defect area is as follows:

[0108]

[0109] Among them, P(P1P2....P n ) is the contour defect point, P′(P1′P2′....P n ′) is the point projected from the contour point to the CAD primitive, D is the distance between the points, and S is the defect distance.

[0110] In such Figure 7 In a specific embodiment shown in the figure, the identified defect contour points are P1 to P6, and the corresponding projection points of the defect contour points P1 to P6 are P1' to P6' respectively. Then the determined defect area is the area surrounded by the defect contour points P1 to P6 and the corresponding projection points P1' to P6', a total of 12 points. Among them, the area of ​​the defect area is the area of ​​the area surrounded by the defect contour points P1 to P6 and the corresponding projection points P1' to P6', a total of 12 points. The depth of the defect area is Depth The width of the defect area is the sum of the lengths of two adjacent points from P1 to P6.

[0111] Finally, the defective areas are further screened based on the calculated evaluation data. Specifically, for each defective area initially determined, the evaluation data of each defective area is compared with the corresponding evaluation threshold, and when the evaluation data is greater than the evaluation threshold, the defective area is screened out as the final defective area.

[0112] For example, when the evaluation data includes the area of ​​the defect region, for each determined defect region, the area of ​​each defect region is compared with the corresponding area threshold, and the defect region with an area greater than the area threshold is screened out as the final defect region.

[0113] For another example, when the evaluation data includes the depth of the defect area, for each determined defect area, the depth of each defect area is compared with the corresponding depth threshold, and the defect area with a depth greater than the depth threshold is screened out as the final defect area.

[0114] For another example, when the evaluation data includes the width of the defect area, for each determined defect area, the width of each defect area is compared with the corresponding width threshold, and the defect area with a width greater than the width threshold is screened out as the final defect area.

[0115] For another example, when the evaluation data includes the area, depth and width of the defect area, for each determined defect area, the area, depth and width of the defect area are compared with the corresponding area threshold, depth threshold and width, and the defect areas whose area, depth and width are greater than the set threshold are screened out as the final defect areas.

[0116] Among them, the area threshold, depth threshold and width threshold can be determined according to actual detection requirements and are not specifically limited here.

[0117] In order to improve calculation accuracy and efficiency, when comparing the target contour with the CAD metadata to determine the defective area of ​​the product to be inspected, it can also be achieved through the following steps S1350-S1380.

[0118] S1350, dividing the CAD primitive data into a part to be processed in a group and a part not to be processed in a group according to whether the primitive contours are continuous.

[0119] For the grouping processing part, the CAD primitive data are grouped by using contour sorting to obtain at least two grouped CAD primitives. The sorting is performed based on at least one indicator such as contour length, enclosed area, centroid, etc. For example, when sorting and grouping according to contour length, the CAD primitives are divided into group 1, group 2, and group 3 according to the contour length sorting, wherein group 1>group 2>group 3 is obtained according to the contour length sorting. Figure 8 A grouping schematic diagram is shown, in which CAD primitives are grouped according to the contour lengths of group 1, group 2 and group 3 to obtain grouped CAD primitives, and the same is true for other indicators.

[0120] S1360, for each grouped CAD primitive, extract the corresponding target contour segment from the target contour as the grouped target contour corresponding to each grouped CAD primitive. Specifically, the target contour is also grouped according to the grouping method of the CAD primitive to obtain the grouped target contour. The grouped target contour is matched one-to-one with the CAD primitive, wherein the grouping is also matched according to the index sorting. For example, the CAD primitives are divided into A1, A2 and A3 according to the index, and the corresponding target contours are grouped into B1, B2 and B3 according to the index. Then, the target contour corresponding to the CAD primitive A1 grouped according to the index sorting is grouped into B1, and a one-to-one corresponding CAD primitive grouping and target contour grouping are obtained.

[0121] S1370, for the primitive grouping processing part, each grouped CAD primitive is bound to the corresponding grouped target contour to obtain a group set corresponding to each grouped CAD primitive.

[0122] For the primitives that have not been grouped, all contour points and all primitives are grouped into a set to obtain a set corresponding to the ungrouped CAD primitives.

[0123] S1380, for the set corresponding to the ungrouped CAD primitives, calculate the minimum distance from the contour to the primitive in the same set to determine the defect area.

[0124] For each grouping set, the defective area of ​​the product to be inspected is determined by grouping. Specifically, when determining the defective area, first calculate the minimum distance from the contour to the primitive in the same set, then compare the calculated minimum distance result with the set threshold value disThre, filter out points greater than the distance threshold value diaThre, and project these points and the corresponding primitives to obtain contour points and projection points, and finally connect the contour points and projection points to form a closed area, then this area is the defective area. The detailed process is the same as the above-mentioned process of determining the defective area based on splitting the basic primitives, so no further details will be given here. Among them, calculating the minimum distance is to calculate the distance from each contour point on the target contour to each point on the corresponding primitive.

[0125] It should also be noted that in actual applications, sometimes because the product is relatively large, we need to ensure a certain degree of accuracy, and the pixel equivalent needs to be maintained at a certain level. In this way, one camera cannot capture the entire product at once, and multiple shots are required to use multiple images to fully capture the product.

[0126] When using multiple images for product defect detection, it is necessary to align the multiple images with the same CAD drawing. If overlap occurs, it is necessary to perform deduplication processing after converting the image contour points to CAD coordinates, and then smooth the processed contours. The processing method is the same as the previous single image processing process, so I will not go into details here. Fig. 9A multi-image contour defect detection flow chart is shown.

[0127] Therefore, the present disclosure provides a product defect detection method, which obtains image data and CAD primitives of the product to be inspected, and compares the preprocessed image contours with the CAD primitives to determine the defect area of ​​the product to be inspected. This method can determine the product defect area for all products by comparing the image contours of the products with the CAD primitives. There is no need to design different algorithms for different products, thereby improving the universality of the product defect detection method.

[0128] Further, according to another aspect of the present disclosure, a product contour defect detection device 100 is provided. Fig.10 , including: a data acquisition module 110, an image matching module 120, and a defect recognition module 130. The data acquisition module 110 is used to acquire the product image and CAD metadata of the product to be detected; the image matching module 120 is used to extract the contour of the product to be detected from the product image, and convert the image coordinates of the contour into CAD coordinates to obtain the target contour aligned with the CAD metadata; the defect recognition module 130 is used to compare the target contour with the CAD metadata to determine the defect area of ​​the product to be detected.

[0129] Furthermore, according to another aspect of the present disclosure, a product contour defect detection device 200 is also provided. Fig.11 The device 200 for detecting and processing product contour defects in the embodiment of the present disclosure includes a processor 210 and a memory 220 for storing executable instructions of the processor 210. The processor 210 is configured to implement any of the aforementioned methods for detecting and processing product contour defects when executing the executable instructions.

[0130] Here, it should be noted that the number of processors 210 may be one or more. At the same time, in the product contour defect detection processing device 200 of the embodiment of the present disclosure, an input device 230 and an output device 240 may also be included. Among them, the processor 210, the memory 220, the input device 230 and the output device 240 may be connected through a bus or in other ways, which are not specifically limited here.

[0131] The memory 220 is a computer-readable storage medium that can be used to store software programs, computer executable programs, and various modules, such as the program or module corresponding to the product contour defect detection processing method of the embodiment of the present disclosure. The processor 210 executes various functional applications and data processing for the product contour defect detection processing device 200 by running the software program or module stored in the memory 220.

[0132] The input device 230 may be used to receive input numbers or signals. The signals may be key signals related to user settings and function control of the device / terminal / server. The output device 240 may include display devices such as display screens.

[0133] According to another aspect of the present disclosure, a non-volatile computer-readable storage medium is provided, on which computer program instructions are stored. When the computer program instructions are executed by the processor 210, any of the above methods for detecting and processing product contour defects is implemented.

[0134] The embodiments of the present disclosure have been described above, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and changes will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The selection of terms used herein is intended to best explain the principles of the embodiments, practical applications, or technical improvements in the market, or to enable other persons of ordinary skill in the art to understand the embodiments disclosed herein.

Claims

1. A product defect detection method, characterized in that: include: Obtain product images and CAD metadata of the product to be inspected; Extracting the contour of the product to be inspected from the product image, and converting the image coordinates of the contour into CAD coordinates to obtain a target contour aligned with the CAD object data; The target contour is compared with the CAD metadata to determine the defect area of ​​the product to be inspected.

2. The method according to claim 1, characterized in that When converting the image coordinates of the contour into CAD coordinates, it includes: Determine the primitive feature points from the CAD primitive data; wherein the primitive feature points are points with unique local properties located on the contour of the CAD image of the product to be inspected; Extracting image feature points corresponding to the primitive feature points from the contour, and forming matching feature points with the primitive feature points; Based on the matching feature points, a conversion matrix between the image coordinate system and the CAD coordinate system is established; Based on the transformation matrix, the image coordinates of the contour are converted into CAD coordinates.

3. The method according to claim 1, characterized in that After obtaining the target contour in the CAD coordinate system, it also includes: Performing at least one preprocessing operation of smoothing and filtering on the target contour; The preprocessed target contour is compared with the CAD element data to determine the defect area of ​​the product to be inspected.

4. The method according to claim 1, characterized in that When comparing the target contour with the CAD element data to determine the defect area of ​​the product to be inspected, it includes: Splitting the complex CAD element data into basic element data; Acquire each contour point constituting the target contour, and calculate the minimum distance between each contour point and the corresponding basic graphic element data; Screen out contour points whose minimum distance is greater than a set distance threshold as defect contour points; Based on the defect contour points, the defect area of ​​the product to be inspected is determined.

5. The method according to claim 1, characterized in that When comparing the target contour with the CAD element data to determine the defect area of ​​the product to be inspected, it includes: The CAD primitive data are grouped by using contour sorting to obtain at least two grouped CAD primitives; For each of the grouped CAD primitives, extracting a corresponding target contour segment from the target contour as a grouped target contour corresponding to each of the grouped CAD primitives; Binding each of the grouped CAD primitives with a corresponding grouped target contour to obtain a group set corresponding to each of the grouped CAD primitives; Based on each of the grouping sets, defective areas of the product to be inspected are determined by grouping.

6. The method according to claim 4, characterized in that When determining the defect area of ​​the product to be inspected based on the defect contour points, it includes: Projecting the defect contour point to the corresponding basic graphic element data to obtain the projection point corresponding to the defect contour point; The area enclosed by the defect contour points and the projection points is determined as the defect area of ​​the product to be inspected.

7. The method according to claim 6, characterized in that: After determining the defective area of ​​the product to be inspected, the method further includes: Convert the CAD coordinates of the defect contour point and the projection point into image coordinates; Calculating evaluation data of the defect area based on the image coordinates of the defect contour point and the projection point, wherein the evaluation data includes at least one of the area, depth and width of the defect area; Based on the evaluation data of the defective area, it is determined whether the defective area is a final defective area of ​​the product to be inspected.

8. A product contour defect detection device, characterized in that: include: A data acquisition module, used to acquire product images and CAD metadata of the product to be inspected; An image matching module is used to extract the contour of the product to be detected from the product image, and convert the image coordinates of the contour into CAD coordinates to obtain a target contour aligned with the CAD object data; The defect recognition module is used to compare the target contour with the CAD element data to determine the defect area of ​​the product to be inspected.

9. A device for detecting product contour defects, characterized in that: include: processor; a memory for storing processor-executable instructions; Wherein, the processor is configured to implement the method described in any one of claims 1 to 7 when executing the executable instructions.

10. A non-volatile computer-readable storage medium having computer program instructions stored thereon, characterized in that: When the computer program instructions are executed by a processor, the method according to any one of claims 1 to 7 is implemented.

Citation Information

Cited By

  • Method and system for obtaining actual material distribution diagram of tire and computer program product

    CN119312428A