An industrial automated three-dimensional inspection system and method
By optimizing the error evaluation function in point cloud matching, using corner point similarity and matching error weight, the local optimal solution problem of the nearest point iteration algorithm in complex environments is solved, and the defect detection accuracy of the three-dimensional inspection system is improved.
Patent Information
- Application Number
- CN202410898958.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-05
- Publication Date
- 2024-10-11
- Estimated Expiration
- 2044-07-05
AI Technical Summary
In complex or noisy environments, the nearest point iteration algorithm may fall into a local optimal solution, resulting in inaccurate three-dimensional point cloud matching results and affecting the accuracy of sheet metal defect detection.
By calculating the similarity of corner points and matching error weight, the error evaluation function in the point cloud matching process is optimized, and the matching error weight is used to optimize the error evaluation function of the closest point iterative matching to improve the accuracy of point cloud matching.
It improves the accuracy of the evaluation of point cloud matching effects, enhances the accuracy and efficiency of identifying sheet metal defects, ensures that accurate point cloud matching results can be obtained in complex environments, and thereby improves the accuracy of defect detection.
Smart Images

Figure CN118628474B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing, and in particular to an industrial automation three-dimensional detection system and method. Background Art
[0002] As a precision manufacturing process for metal sheets, sheet metal processing covers a variety of process steps from cutting, stamping, bending, welding, etc. to produce sheet metal components with uniform thickness, requiring extremely high precision and customization flexibility. At the same time, the demand for lightweight design and the use of high-performance materials is growing. However, any minor manufacturing defects will significantly affect the performance and durability of sheet metal components and reduce their service life.
[0003] The progress of three-dimensional detection technology not only provides more advanced means for improving production efficiency and quality control, but also has been applied in sheet metal defect detection. For example, the existing patent application document with publication number CN116309320A discloses a sheet metal workpiece detection method, device electronic equipment and storage medium. Specifically, a three-dimensional point cloud image of the sheet metal workpiece to be detected is collected by a 3D camera, and at least one type of shape defects of the sheet metal workpiece to be detected is detected based on the three-dimensional point cloud image to obtain detection results corresponding to each type of shape defects in at least one type of shape defects. For example, the patent application document with publication number CN115661509A discloses that the three-dimensional point cloud data of the surgical instrument to be tested is preprocessed, plane fitting, platform removal, radius outlier elimination, and density clustering are performed to obtain a target surgical instrument point cloud, and the target surgical instrument point cloud is globally roughly matched with the surgical instrument point cloud template and finely aligned by the nearest point iteration algorithm to output the matching result.
[0004] However, when using the above-mentioned nearest point iteration algorithm to perform point cloud matching on the point cloud of the sheet metal part to be tested and the template point cloud to achieve defect detection, due to the complex shape of the sheet metal part and the interference of noise, the nearest point iteration algorithm may fall into a local optimal solution in a complex environment or a noisy environment, resulting in inaccurate point cloud matching results, thereby affecting the accuracy of the defect detection results of the sheet metal part to be tested. Summary of the invention
[0005] In order to solve the problem that the closest point iteration algorithm may fall into a local optimal solution in a complex environment or a noisy environment, resulting in inaccurate point cloud matching results and affecting the accuracy of defect detection results, the present invention proposes an industrial automation 3D detection system and method. The specific scheme is as follows:
[0006] In one aspect, the present invention provides an industrial automation three-dimensional detection method, comprising:
[0007] A first corner point and a first point are randomly selected in a first point cloud corresponding to the sheet metal part to be inspected, and a second corner point and a second point are randomly selected in a second point cloud corresponding to the template; the first point and the second point are corner points or non-corner points;
[0008] Calculate the similarity between the first corner point and the second corner point according to the neighborhood density difference between the first corner point and the second corner point, and the average distance difference between the first corner point and the second corner point and other corner points in their respective point clouds, wherein the similarity is negatively correlated with the neighborhood density difference and the average distance difference;
[0009] According to the difference between the angle formed by the first point, the origin of the first point cloud, and the first corner point and the angle formed by the second point, the origin of the second point cloud, and the second corner point, and the difference between the distance from the first point to the first corner point and the distance from the second point to the second corner point, combined with the similarity, a matching error weight between the first point and the second point is calculated, wherein the matching error weight is negatively correlated with the similarity and positively correlated with the difference in the angle and the difference in the distance;
[0010] The first point cloud and the second point cloud are iteratively matched at the closest point, and the error evaluation function of the iterative matching at the closest point is optimized using the matching error weight, and the best matching result is obtained when the error evaluation function is minimized, and whether the sheet metal part to be inspected has defects is judged based on the best matching result. The beneficial effect is that the error evaluation function used to evaluate the matching effect in the traditional point cloud matching process is optimized, so that the evaluation accuracy of the point cloud matching effect is improved, and then an accurate point cloud matching result is obtained. Since the point cloud matching result is directly related to the sheet metal defect detection, the recognition accuracy and efficiency of the sheet metal defect to be inspected are enhanced.
[0011] Preferably, the similarity between the first corner point and the second corner point satisfies the following relationship:
[0012] , where For the The first corner point and the The similarity of the second corner point, For the The first corner point and the The difference in neighborhood density of the second corner point, For the The first corner point and the The average distance difference between the second corner points and other corner points in their respective point clouds, and the neighborhood density difference and the average distance difference are both values obtained by first finding the absolute value and then normalizing. The beneficial effect is that the corner point similarity calculated by comprehensively considering the neighborhood density difference and the average distance difference of the corner points can more comprehensively reflect the similarity of the corner points in spatial layout and structure.
[0013] Preferably, the matching error weights of the first point and the second point satisfy the following relationship: , where For the The first point and the The matching error weight of the second point, and are the total number of corner points of the first point cloud and the total number of corner points of the second point cloud, respectively. and are the corner point numbers of the first point cloud and the second point cloud respectively. For the The first corner point and the The similarity of the second corner point, and are the serial numbers of the first point and the second point respectively, For the The first point, the origin of the first point cloud, the The angle formed by the first corner points and the The second point, the origin of the second point cloud, the The difference in the angles formed by the second corner points, For the The first point to the The distance between the first corner point and the The second point to The difference in distance between the second corner points is calculated by first finding the absolute value and then normalizing the difference in the angle and the distance. The beneficial effect is that by comprehensively considering the corner point similarity, angle difference and distance difference between the points, as well as the relative position of the points in the point cloud, the matching error weight is obtained, which can more accurately quantify the matching quality between the points of the two point clouds.
[0014] Preferably, the error evaluation function of the closest point iterative matching is optimized using the matching error weight, and the optimized error evaluation function is:
[0015] , where is the value of the error estimate, and Respectively The rotation matrix and translation matrix used for coordinate transformation in the iterative matching process are: and Respectively The coordinates of the first point and the The coordinates of the second point, and and the total number of the first points in the first point cloud and the total number of the second points in the second point cloud, respectively. For the The first point and the The beneficial effect is that the accuracy of the evaluation of the point cloud matching result is improved by optimizing the error evaluation function through the matching error weight.
[0016] Preferably, the neighborhood density is obtained by taking the corner point as the center, taking N in the X, Y, and Z axis directions to form the neighborhood of the corner point; taking the ratio of the total number of points contained in the neighborhood to the total number of points in the point cloud corresponding to the corner point as the neighborhood density of the corner point, wherein N is a preset value. The beneficial effect is that the neighborhood density of the corner point can reflect its local spatial characteristics.
[0017] Preferably, the average distance difference is the difference between the mean of the Euclidean distances from the first corner point to other corner points in the first point cloud and the mean of the Euclidean distances from the second corner point to other corner points in the second point cloud. The beneficial effect is that by calculating the distances between corner points, the spatial position characteristics of the corner points in the point cloud are reflected.
[0018] Preferably, the method for obtaining the initial values of the rotation matrix and the translation matrix is: based on the respective corner points and centroids of the first point cloud and the second point cloud, the first point cloud and the second point cloud are roughly matched to obtain the matching point combination of the first point cloud and the second point cloud, and based on the coordinates of the matching point combination, the initial rotation matrix and the translation matrix are calculated using singular value decomposition. The beneficial effect is that before the nearest point iterative matching, the centroids and corner points of the sheet metal point cloud to be detected and the template point cloud are respectively used to achieve rapid rough matching, which reduces the search space for subsequent precise matching and accelerates the matching process.
[0019] Preferably, judging whether the sheet metal to be inspected has defects according to the best matching result includes: counting the total number of points contained in the first point cloud and the second point cloud, and the number of points that do not overlap in the first point cloud and the second point cloud; taking the ratio of the number of points that do not overlap to the total number as the degree of defect of the sheet metal to be inspected; if the degree of defect is greater than a preset defect degree threshold, the sheet metal to be inspected has defects, otherwise, the sheet metal to be inspected does not have defects. The beneficial effect is that by calculating the ratio of the number of non-overlapping points to the total number of points, the defects are quantified into an intuitive percentage value, which simplifies the defect assessment process, does not require complex model construction, and facilitates rapid on-site detection and preliminary judgment.
[0020] On the other hand, the present invention also provides an industrial automation three-dimensional detection system, wherein the self-inspection control system includes a processor and a memory, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the steps in the above-mentioned detection method can be implemented.
[0021] The present invention has the following effects:
[0022] The present invention innovatively optimizes the error evaluation function used to evaluate the matching effect in the traditional point cloud matching process, improves the evaluation accuracy of the point cloud matching effect, and then obtains accurate point cloud matching results. Since the point cloud matching results are directly related to the sheet metal defect detection, the recognition accuracy and efficiency of the defects of the sheet metal parts to be detected are enhanced. Specifically, by quantifying the point density in the corner point neighborhood and the spatial layout similarity between the point clouds, a novel corner point similarity metric is constructed. This metric can better capture the spatial structure information in the point cloud. On this basis, the spatial distribution characteristics between any two points, especially the vector angle between the point and the corner point, are further introduced to calculate the matching error weight. This calculation method cleverly links the spatial geometric information with the matching accuracy, so that the matching error weight can accurately reflect the spatial consistency of the matching point pairs. The error evaluation of the matching results not only considers the distance between the points, but also goes deep into the matching quality of the spatial distribution. Even in complex environments, accurate point cloud matching results can be obtained. Based on the accurate point cloud matching results, the accuracy of the defect detection results of the sheet metal parts to be detected is improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] By reading the following detailed description with reference to the accompanying drawings, the above and other objects, features and advantages of the exemplary embodiments of the present invention will become readily understood. In the accompanying drawings, several embodiments of the present invention are shown in an exemplary and non-limiting manner, and the same or corresponding reference numerals represent the same or corresponding parts, wherein:
[0024] Figure 1 It is a schematic flow chart of the method of the present invention. DETAILED DESCRIPTION
[0025] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0026] The specific embodiments of the present invention are described in detail below with reference to the accompanying drawings.
[0027] Reference Figure 1 , an industrial automation three-dimensional detection method, comprising steps S1 to S5:
[0028] S1: Collect the 3D point cloud data of the sheet metal parts and templates to be inspected.
[0029] In order to improve the detection accuracy and efficiency of surface defects of complex sheet metal parts and ensure high-quality detection results, this step uses high-precision 3D scanning technology to fully capture the contours of the sheet metal parts to be inspected. This stage involves collecting point cloud data from multiple perspectives to ensure that all details of the sheet metal parts are fully covered. These rich point cloud data are then preprocessed, including removing cluttered points, noise points, and outliers to ensure the accuracy and reliability of the point cloud. The point cloud of the sheet metal parts to be inspected is obtained. At the same time, the pre-designed sheet metal CAD model is imported and converted into a point cloud format to generate a CAD template point cloud for reference for subsequent point cloud matching to achieve defect detection.
[0030] S2: Roughly match the point cloud of the sheet metal part to be inspected with the point cloud of the template.
[0031] In laser point clouds, corner points and centroids are stable and characteristic positions. Corner points usually refer to the edges of the surface of an object, which have higher curvature and larger changes in point cloud density, while plane points are flat areas on the surface of an object, which have lower curvature and smaller changes in point cloud density. Centroid, also known as center of mass or gravity, refers to the average position where the mass of all points on an object is concentrated in geometry. In three-dimensional space, for a continuously distributed object or point cloud, the centroid is the arithmetic mean of the position vectors of all points. The centroid can represent the overall position center of the entire point cloud, especially when the point cloud distribution features are quantified by symmetrical quantities. The centroid provides a simple center point. In translation and rotation transformations, the centroid position of the point cloud is not changed, which helps to simplify the matching problem. In addition, the centroid is relatively stable and will not be affected by noise and the addition or deletion of single points. It can be seen that the corner points and centroids in the point cloud can effectively resist deformation and noise interference.
[0032] In view of the above reasons, this step takes the corner points and centroid coordinates of the sheet metal point cloud to be detected and the template point cloud as the basis, and performs rough matching between the sheet metal point cloud to be detected and the template point cloud, including the following steps:
[0033] S21: Corner Detection and Feature Extraction: Harris (Harris represents the authors' names Chris Harris and Step Harris) corner detection algorithm is a classic method in the field of computer vision, which is used to identify corner points in images or point cloud data. These points have strong local changes and are often used in tasks such as feature matching and image alignment. The Harris corner detection algorithm is used to extract the corner points and corner point coordinates in the point cloud of the sheet metal part to be detected and the template point cloud. These corner points have high stability and recognition due to the significance of their geometric structure.
[0034] S22: Extract feature descriptors of corner points: The FPFH (feature descriptor) algorithm is a descriptor operator in point cloud processing, which aims to capture local geometric information and describe the relationship between points and their neighborhoods. The FPFH algorithm is used here to obtain the feature descriptor of each corner point of the point cloud of the sheet metal to be detected, as well as the feature descriptor of each corner point of the template point cloud. The feature descriptor can reflect the local geometric structure of the point cloud, which is convenient for subsequent matching.
[0035] S23: For each corner point of the sheet metal part point cloud to be detected, find the corner point that is most similar to its feature descriptor in the template point cloud, and use the two corner points with the most similar feature descriptors as a corner point matching combination. The specific search method can use KD-Tree (tree data structure) to accelerate the search, match the corner points with the most similar feature descriptors in the sheet metal part point cloud to be detected and the template point cloud as the basis of potential correspondence, and finally obtain multiple corner point combinations.
[0036] S24: Calculate the average value of the coordinates of all points in the point cloud of the sheet metal part to be detected to obtain the centroid coordinates of the point cloud of the sheet metal part to be detected, and calculate the average value of the coordinates of all points in the template point cloud to obtain the centroid coordinates of the template.
[0037] S25: Using the SAC-IA (simple matching) algorithm, based on the corner points and centroids of the sheet metal point cloud to be detected and the template point cloud, the point cloud of the sheet metal to be detected and the template point cloud are roughly matched to obtain the matching point combination of the sheet metal point cloud to be detected and the template point cloud. Based on the coordinates of these matching point combinations, subsequent processing is performed. The coordinates of the points directly map the spatial relationship. Next, the initial rotation matrix and translation matrix are calculated using singular value decomposition. Singular value decomposition is a common method that can separate the rotation matrix and translation matrix. The rotation matrix represents the rotation relationship between the point clouds, which is specifically reflected in the rotation angle and direction change of the matching points. The translation matrix represents the overall translation vector. Both matrices are used for coordinate transformation, which are responsible for adjusting the angle of each point in the first point cloud through the initial rotation matrix, and then the initial translation matrix guides the point to perform spatial displacement and accurately map it to the position in the second point cloud, thereby achieving preliminary alignment.
[0038] Through the operation of this step, a rough match between the point cloud of the sheet metal part to be inspected and the template point cloud is achieved, and the initial rigid body transformation parameters between the point cloud of the sheet metal part to be inspected and the template point cloud are obtained. This strategy not only significantly reduces the computational burden of subsequent fine alignment, but also improves the robustness and accuracy of the entire alignment process, providing a reliable preliminary guarantee for the defect detection of complex sheet metal parts.
[0039] S3: Calculate the similarity between the corner points of the point cloud of the sheet metal part to be detected and the corner points of the template point cloud.
[0040] During the 3D scanning process, the corner points on the surface of sheet metal parts are less subject to external interference than other areas, and show higher stability and reliability. Therefore, they become the preferred features in the registration. The registration strategy focuses on the correspondence between the corner points in the point cloud of the sheet metal part to be detected and the template point cloud. When the positions of the corner points in the point cloud of the sheet metal part to be detected are highly matched with the corresponding positions of the corner points in the template point cloud, and there is a significant similarity between the corner points of the two, the registration of the point cloud of the sheet metal part to be detected and the template point cloud can be regarded as having a high degree of credibility. This means that the more consistent the corner points of the two point clouds are, the higher the matching accuracy is.
[0041] Therefore, this step takes the point cloud of the sheet metal part to be inspected as the first point cloud and the template point cloud as the second point cloud, and arbitrarily selects a corner point in the first point cloud as the first corner point, and arbitrarily selects another point in the first point cloud as the first point, and arbitrarily selects a corner point in the template point cloud as the second corner point, and arbitrarily selects another point in the second point cloud as the second point, and the first point and the second point are corner points or non-corner points, that is, a corner point is selected in each of the two point clouds for similarity analysis of the corner points, and arbitrarily selects a point in each of the two point clouds to provide samples for subsequent analysis.
[0042] S31: Obtain the neighborhood density difference between the first corner point and the second corner point;
[0043] Taking each corner point as the center, select N points in the X, Y, and Z axis directions to form the neighborhood of the corner point. N is a preset value. In this step, the empirical value N is set to 5. For example, taking the first corner point as the center The three-dimensional space of is the neighborhood of the first corner point.
[0044] The ratio of the total number of points contained in the neighborhood of each corner point to the total number of points in the point cloud corresponding to the corner point is taken as the neighborhood density of the corner point. For example, the first point cloud has a total of 10 points (including corner points and non-corner points), and there are 3 points in the neighborhood of the first corner point, so the neighborhood density of the first corner point is 0.3; the second point cloud has a total of 10 points (including corner points and non-corner points), and there are 4 points in the neighborhood of the second corner point, so the neighborhood density of the second corner point is 0.4. The neighborhood density difference, as the name suggests, is the difference in neighborhood density between the first corner point and the second corner point, which is 0.1.
[0045] S32: Obtain an average distance difference between the first corner point and the second corner point and other corner points in their respective point clouds, where the average distance difference is the difference between the average Euclidean distance from the first corner point to other corner points in the first point cloud and the average Euclidean distance from the second corner point to other corner points in the second point cloud.
[0046] For example: there are 4 corner points in the first point cloud, and there are 4 corner points in the second point cloud. The Euclidean distances between the first corner point and other corner points in the first point cloud are 3, 4, and 5 respectively. Then the average Euclidean distance between the first corner point and other corner points in the first point cloud is 4. The Euclidean distances between the second corner point and other corner points in the second point cloud are 5, 6, and 7 respectively. Then the average Euclidean distance between the second corner point and other corner points in the second point cloud is 6. The average distance difference is 2.
[0047] S33: Calculate the similarity between the first corner point and the second corner point, wherein the similarity is negatively correlated with the neighborhood density difference and the average distance difference.
[0048] First, each corner point in the first point cloud and each corner point in the second point cloud are combined as a corner point to obtain multiple combinations. The neighborhood density difference and average distance difference between the first corner point and the second corner point in each combination are calculated. Then, the neighborhood density difference and average distance difference of all combinations are normalized, and then the similarity between the two is obtained by the following calculation.
[0049] The calculation formula is:
[0050]
[0051] In the formula, For the The first corner point and the The similarity of the second corner point, For the The first corner point and the The difference in neighborhood density of the second corner point, For the The first corner point and the The average distance difference between the second corner points and other corner points in their respective point clouds, and The absolute value is calculated first and then normalized. The first corner point and the The neighborhood density difference of the second corner point is normalized by the absolute value of the difference, and the value obtained is , calculate the The first corner point and the The difference between the average distance of the second corner point and other corner points in each point cloud is calculated and normalized, and the obtained value is used as , you can use the common The function performs linear normalization operation.
[0052] In this formula, Indicates the first point cloud The corner point and the The relative density similarity of the two corner points. The greater the difference in neighborhood density between the two corner points, the smaller the relative density similarity of the two corner points. Conversely, the greater the relative density similarity of the two corner points, the greater the relative density similarity. When the relative density similarity is greater, the corner points are more similar.
[0053] In this formula, Indicates the first point cloud The corner point and the The similarity of the spatial positions of the corner points in their respective point clouds. The smaller the average distance difference, the greater the spatial similarity of the two corner points, and the more similar the two corner points are. This formula accurately evaluates the similarity of the corner points by comprehensively considering the similarity of the neighborhood density of the corner points and the spatial similarity of the corner points with other corner points.
[0054] In this formula:
[0055]
[0056] in, The first point in the cloud The total number of points in the neighborhood of a corner point, The second point cloud The total number of points in the neighborhood of a corner point, is the total number of points in the first point cloud, is the total number of points in the second point cloud;
[0057] In this formula:
[0058]
[0059] In the formula, For the The first corner point and the The Euclidean distance between the first corner points, For the The second corner point and The Euclidean distance between the second corner points, is the total number of corner points of the first point cloud, is the total number of corner points of the second point cloud, and are the serial numbers of the first corner points, and , and are the serial numbers of the second corner points, and .
[0060] S4: Get the error weight of point cloud matching.
[0061] The matching error weight to be obtained in this step is used to evaluate whether the matching effect of the two points conforms to their actual spatial distribution characteristics. Specifically, it is a quantitative indicator obtained based on the average similarity between the two points and other corner points in their respective point clouds. When the average similarity is high, the more similar the two points are. If the two points are matched, the better the matching effect will be, and the lower the error matching weight should be. Therefore, the matching quality of the two points is reflected by the matching error weight. The lower the matching error weight, the better the matching quality of the two points. Conversely, the two points are very different. If they are to be matched, the worse the matching effect will be and the lower the matching quality will be.
[0062] Specifically, the matching error weights of the first point and the second point selected in the aforementioned steps are explained, and the angle formed by the first point, the origin of the first point cloud, and the first corner point is taken as the first angle, and the angle formed by the second point, the origin of the second point cloud, and the second corner point is taken as the second angle; the distance from the first point to the first corner point is taken as the first distance, and the distance from the second point to the second corner point is taken as the second distance. The first distance and the second distance, the first angle and the second angle, these data reflect the distribution characteristics of the points in the first point cloud and the second point cloud in space. The greater the difference between the first angle and the second angle, and the greater the difference between the first distance and the second distance, the more dissimilar the positional characteristics of the first point and the second point in their respective point cloud spaces, and the better the matching between the two. If the two points are matched, the smaller the matching error is, and the better the matching effect is.
[0063] For example, select the i-th first point (the i-th point in the first point cloud), the coordinates are , select The second point (the points), with coordinates , No. The first corner point (the first point in the first point cloud corner points), with coordinates of , No. The second corner point (the second point cloud corner points), with coordinates of , based on the above coordinates, obtain the The first point and the The Euclidean distance of the first corner , No. The first point, the origin of the first point cloud, the The vector angle formed by the first corner points, that is, the vector angle from the origin of the first point cloud to the The direction of the first point and the origin of the first point cloud to the The vector angle formed by the direction of the first corner point , No. The second point, the origin of the second point cloud, the The vector angle formed by the second corner points, that is, the vector angle from the origin of the second point cloud to the The direction of the second point and the origin of the second point cloud to the The vector angle formed by the direction of the second corner point , No. The second and The Euclidean distance of the second corner point .
[0064] According to the above acquired data, the first The first point and the The matching error weight of the second point :
[0065]
[0066] In the formula, For the The first point and the The matching error weight of the second point, For the The first corner point and the The similarity of the second corner point, For the The first point, the origin of the first point cloud, the The angle formed by the first corner points and the The second point, the origin of the second point cloud, the The difference in the angles formed by the second corner points is equal and The difference, For the The first point to the The distance between the first corner point and the The second point to The difference in the distances of the second corner points is and The difference, and The absolute value is calculated first and then normalized. is the total number of corner points of the first point cloud, is the total number of corner points of the second point cloud.
[0067] The average similarity mentioned in this step is quantified in the formula by the following parts:
[0068]
[0069] Indicates The first point and the The average similarity of the second point with other corner points in their respective point clouds, Reflects the The first point and the The vector angle similarity of the second point, Reflects the The first point and the The distance similarity of the second point, Indicates The first point and the The weighted similarity of the second point.
[0070] S5: Optimizing the error evaluation function using the matching error weight to obtain the best matching result, and then determining whether the sheet metal part to be inspected has defects.
[0071] Iterative matching of the closest point is a technology widely used in point cloud registration, especially in the fields of 3D reconstruction, robot navigation, computer vision and medical imaging. Its basic idea is to achieve precise alignment by gradually approximating through an iterative process and minimizing the distance between two sets of point clouds. The goal is to find the best rigid body transformation between the two point clouds so that they are aligned as much as possible. In this embodiment, the iterative matching of the closest point first finds the nearest point for each point of the first point cloud in the second point cloud. This is a basic step based on point cloud matching. It makes reasonable use of the geometric distribution information of the point cloud data. Then, an error evaluation function is constructed to quantify the matching quality to ensure that the iterative process is goal-oriented, based on the distance between points or more complex geometric differences. Then, the rigid body transformation parameters (rotation matrix and translation matrix) are adjusted according to the error evaluation results. After adjusting the rigid body transformation parameters, the nearest points are re-searched, the error evaluation results are re-obtained, and the rigid body transformation parameters are continued to be adjusted according to the error evaluation results. This operation is repeated continuously for iterative matching. Finally, the matching result corresponding to the minimum value of the error evaluation function is the best matching result.
[0072] In view of the above content, it can be seen that the matching effect of the point cloud is closely related to the rotation matrix and the translation matrix. The optimal rotation matrix and the translation matrix can produce the best point cloud matching effect, and the quality of the rotation matrix and the translation matrix is specifically reflected by the value of the error evaluation function. The larger the value, the worse the effect. For example, in the first iteration, the value of the error evaluation function is 100, and in the second iteration, the value of the error evaluation function is 90, which means that the effect of point cloud matching using the rotation matrix and the translation matrix corresponding to the second iteration is good.
[0073] Therefore, this step uses the matching error weight to optimize the error evaluation function so that the error evaluation result is consistent with the real spatial distribution characteristics of the point cloud, and then feedback is performed to adjust the translation matrix and rotation matrix based on the accurate error evaluation to obtain a better matching effect. The initial translation matrix and rotation matrix in this step are determined by the rough alignment results in step S25.
[0074] In the process of iterative matching of the nearest point, The corresponding rigid body transformation parameters in the iteration are: , translation matrix , according to The coordinates of the first point , No. The coordinates of the second point , the total number of points in the first point cloud , the total number of points in the second point cloud , No. The first point and the The error matching weight of the second point , and obtain the optimized error evaluation function for:
[0075]
[0076] In the formula, is the optimized error evaluation function, For the The rotation matrix in iteration , For the The translation matrix in the iteration, For the The coordinates of the first point, For the The coordinates of the second point, is the total number of points in the first point cloud, is the total number of points in the second point cloud.
[0077] In this formula: Indicates The first point is based on and The transformed coordinates are Indicates The first point is based on and The transformed coordinates are The distance to the second point, Indicates The first point is based on and The transformed coordinates are The weighted distance to the second point, The numerical value indicates that each point of the first point cloud is based on and The sum of the weighted distances between the transformed coordinates and each point in the second point cloud.
[0078] When the sum of weighted distances is lower, it means The first point is based on and The transformed coordinates are The closer the second point is, the The transformed coordinates of the first point are The higher the matching degree of the second point, the The first point is based on and The better the transformation effect is, the smaller the sum of the weighted distances between all points in the first point cloud and the second point cloud is, indicating that the points in the first point cloud are based on and The higher the alignment between the transformed coordinates and the second point cloud, the better the and The better the point cloud matching effect.
[0079] Furthermore, to obtain the best point cloud matching effect, that is, to obtain the point cloud matching result when the error evaluation function is minimized, the rotation matrix and translation matrix with the smallest error evaluation function have the best point cloud matching result and the highest accuracy. Therefore, the error evaluation function can be minimized by the gradient descent method and the least squares method, that is, the minimum value of the error evaluation function is solved by the least squares method or the gradient descent method. The minimum value reflects the minimum matching error between the point cloud of the sheet metal to be detected and the template point cloud. The rotation matrix and translation matrix corresponding to the minimum error evaluation function value can be further solved by singular value decomposition. When the error evaluation function value is minimum, it means that the matching error between the point cloud of the sheet metal to be detected and the template point cloud is the smallest, and the matching accuracy is the highest. The rotation matrix and translation matrix at this time are used as the optimal rigid body transformation parameters. The point cloud matching effect based on the optimal rigid body transformation parameters has the highest accuracy and the best matching effect, and the best point cloud matching result is obtained.
[0080] Further, it is determined whether the sheet metal part to be inspected has defects according to the best matching result. Previously, the point cloud of the sheet metal part to be inspected and the point cloud of the template are accurately matched according to the optimal transformation parameters of the point cloud of the sheet metal part to be inspected and the point cloud of the template. Then, the method for determining whether the sheet metal part to be inspected has defects is as follows:
[0081] The total number of points contained in the first point cloud and the second point cloud, and the number of non-overlapping points in the first point cloud and the second point cloud are counted, and the ratio of the number of non-overlapping points to the total number is used as the defect degree of the sheet metal part to be inspected. If the defect degree is greater than a preset defect degree threshold, the sheet metal part to be inspected has defects; otherwise, the sheet metal part to be inspected does not have defects.
[0082] Specifically, the total number of overlapping points between the registered sheet metal point cloud and the template point cloud is , then the sheet metal defect degree can be expressed as:
[0083]
[0084] In the formula, is the defect degree of the sheet metal to be tested, is the total number of points in the point cloud of the sheet metal part to be detected; is the total number of points in the template point cloud, is the total number of overlapping points generated after the point cloud of the sheet metal part to be detected matches the point cloud of the template. Represents the total number of points after the two point clouds are matched, It indicates the total number of non-overlapping points after the two point clouds are matched. After matching, the higher the ratio of the number of non-overlapping points to the total number of all points, the higher the defect degree of the sheet metal part. The overlapping points are considered as completely matched points. The more overlapping points the two point clouds have, the better the matching effect.
[0085] Furthermore, the defect level of the sheet metal to be inspected is compared with the preset defect level threshold, and the threshold is set empirically. ,when When the sheet metal to be inspected is considered to have defects and needs to be reprocessed, it needs to be transported to the defective sheet metal warehouse. Otherwise, the sheet metal to be inspected does not have defects.
[0086] At this point, through the above steps, the sheet metal parts to be inspected are subjected to three-dimensional point cloud inspection to obtain more accurate sheet metal defect detection results, thus realizing industrial automated three-dimensional inspection of sheet metal parts.
[0087] An industrial automation three-dimensional detection system includes a processor and a memory. The memory stores a computer program. When the computer program is executed by the processor, the steps in the above detection method can be implemented.
[0088] In the description of this specification, "plurality" or "several" means at least two, such as two, three or more, etc., unless otherwise clearly and specifically defined.
[0089] Although this specification has shown and described a number of embodiments of the present invention, it will be apparent to those skilled in the art that such embodiments are provided by way of example only. Those skilled in the art will conceive of many modifications, changes and alternatives without departing from the ideas and spirit of the present invention. It should be understood that in the practice of the present invention, various alternatives to the embodiments of the present invention described herein may be employed.
Claims
1. An industrial automation three-dimensional detection method, characterized in that: include: Randomly select a first corner point and a first point in the first point cloud corresponding to the sheet metal part to be inspected, and randomly select a second corner point and a second point in the second point cloud corresponding to the template; The first point and the second point are corner points or non-corner points; Calculate the similarity between the first corner point and the second corner point according to the neighborhood density difference between the first corner point and the second corner point, and the average distance difference between the first corner point and the second corner point and other corner points in their respective point clouds, wherein the similarity is negatively correlated with the neighborhood density difference and the average distance difference; According to the difference between the angle formed by the first point, the origin of the first point cloud, and the first corner point and the angle formed by the second point, the origin of the second point cloud, and the second corner point, and the difference between the distance from the first point to the first corner point and the distance from the second point to the second corner point, combined with the similarity, a matching error weight between the first point and the second point is calculated, wherein the matching error weight is negatively correlated with the similarity and positively correlated with the difference in the angle and the difference in the distance; Performing iterative closest point matching on the first point cloud and the second point cloud, optimizing the error evaluation function of the iterative closest point matching using the matching error weight, obtaining the best matching result when the error evaluation function is minimum, and judging whether the sheet metal part to be inspected has defects based on the best matching result.
2. The industrial automation three-dimensional detection method according to claim 1, characterized in that: The similarity between the first corner point and the second corner point satisfies the following relationship: ; In the formula, For the The first corner point and the The similarity of the second corner point, For the The first corner point and the The difference in neighborhood density of the second corner point, For the The first corner point and the The average distance difference between the second corner points and other corner points in their respective point clouds, the neighborhood density difference and the average distance difference are both values obtained by first calculating the absolute value and then normalizing.
3. The industrial automation three-dimensional detection method according to claim 1, characterized in that: The matching error weights of the first point and the second point satisfy the following relationship: , For the The first point and the The matching error weight of the second point, and are the total number of corner points of the first point cloud and the total number of corner points of the second point cloud, respectively. and are the corner point numbers of the first point cloud and the second point cloud respectively. For the The first corner point and the The similarity of the second corner point, and are the serial numbers of the first point and the second point respectively, For the The first point, the origin of the first point cloud, the The angle formed by the first corner points and the The second point, the origin of the second point cloud, the The difference in the angles formed by the second corner points, For the The first point to the The distance between the first corner point and the The second point to The difference in distance between the second corner points, the difference in angle and the difference in distance are both values obtained by first calculating the absolute value and then normalizing.
4. The industrial automation three-dimensional detection method according to claim 1, characterized in that: The error evaluation function of the closest point iterative matching is optimized using the matching error weight, and the optimized error evaluation function is: ; In the formula, is the value of the error estimate, and Respectively The rotation matrix and translation matrix used for coordinate transformation in the iterative matching process are: and Respectively The coordinates of the first point and the The coordinates of the second point, and and the total number of the first points in the first point cloud and the total number of the second points in the second point cloud, respectively. For the The first point and the The matching error weight of the second point.
5. The industrial automation three-dimensional detection method according to claim 2, characterized in that: The method for obtaining the neighborhood density is: With the corner point as the center, N points are taken in the X, Y, and Z axis directions to form the neighborhood of the corner point; the ratio of the total number of points contained in the neighborhood to the total number of points in the point cloud corresponding to the corner point is taken as the neighborhood density of the corner point, where N is a preset value.
6. The industrial automation three-dimensional detection method according to claim 2, characterized in that: The average distance difference is the difference between the average Euclidean distance from the first corner point to other corner points in the first point cloud and the average Euclidean distance from the second corner point to other corner points in the second point cloud.
7. The industrial automation three-dimensional detection method according to claim 4, characterized in that: The method for obtaining the initial values of the rotation matrix and the translation matrix is: Based on the respective corner points and centroids of the first point cloud and the second point cloud, the first point cloud and the second point cloud are roughly matched to obtain a matching point combination of the first point cloud and the second point cloud, and based on the coordinates of the matching point combination, an initial rotation matrix and a translation matrix are calculated using singular value decomposition.
8. The industrial automation three-dimensional detection method according to claim 4, characterized in that: Judging whether the sheet metal part to be inspected has defects according to the best matching result includes: Counting the total number of points included in the first point cloud and the second point cloud, and the number of points that do not overlap between the first point cloud and the second point cloud; The ratio of the number of the points that do not overlap to the total number is used as the defect degree of the sheet metal part to be inspected; If the defect degree is greater than a preset defect degree threshold, the sheet metal part to be detected has defects; otherwise, the sheet metal part to be detected does not have defects.
9. An industrial automation three-dimensional detection system, characterized in that: The detection system includes a processor and a memory, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the steps in the detection method according to any one of claims 1 to 8 can be implemented.
Citation Information
Patent Citations
Surgical instrument identification and classification method based on three-dimensional point cloud ICP registration algorithm
CN115661509A
Sheet metal workpiece detection method and device, electronic equipment and storage medium
CN116309320A
Automatic registration method for three-dimensional point cloud data
CN106780459A
Metal burr identification method based on corner detection
CN115984271A
Circuit breaker key three-dimensional part defect detection method
CN116523828A
