A three-dimensional measurement method and system for rectangular contour of sheet metal parts based on feature fitting

By extracting and fitting the rectangular contours of sheet metal parts through a feature-fitting method, the problem of low accuracy of rectangular contour recognition and fitting in the existing technology is solved, and high-precision three-dimensional rectangular contour reconstruction and data analysis are achieved, improving Improve the detection accuracy and safety performance of sheet metal parts.

CN114742853BActive Publication Date: 2024-09-20HUAZHONG UNIV OF SCI & TECH
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202210272984.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-18
Publication Date
2024-09-20
Estimated Expiration
2042-03-18

AI Technical Summary

Technical Problem

Existing three-dimensional measurement methods are difficult to ensure the accuracy and data processing stability of the rectangular contours of sheet metal parts. Especially in the presence of noise and local reflections, it is difficult to effectively identify and fit the rectangular contours.

Method used

A method based on feature fitting is used to perform canny edge detection on the sheet metal image, extract the parallelogram contour, perform fitting and matching, realize three-dimensional reconstruction, and remove the noise point cloud through minimizing the distance constraint from the point to the plane, and iterate Rotate the plane until it meets the requirements, perform rectangle fitting, and obtain the rectangle parameters.

Benefits of technology

It improves the three-dimensional reconstruction accuracy of rectangular contours and the stability of data processing, realizes automatic extraction and accurate fitting of rectangular contours, and ensures the detection accuracy and safety performance of sheet metal parts.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114742853B
    Figure CN114742853B
Patent Text Reader

Abstract

The present invention discloses a three-dimensional measurement method and system for the rectangular contour of a sheet metal part based on feature fitting, which belongs to the field of three-dimensional measurement. The present invention realizes preliminary contour extraction based on the sheet metal part image, detects the rectangular contour, and performs approximate quadrilateral fitting; performs sub-pixel contour extraction, realizes corresponding point matching, and reconstructs a three-dimensional point cloud; constructs a three-dimensional rectangular projection fitting model based on iterative rotation, and calculates the three-dimensional rectangle parameters. Compared with the traditional method of fitting a rectangle after three-dimensional point cloud reconstruction based on structured light, it can reduce the problem of reconstruction errors caused by illumination changes, image noise, etc. on the edge of the contour, improve the reconstruction accuracy of the contour point cloud, realize automatic recognition of the contour and accurate parameter acquisition, and ensure the accuracy of three-dimensional measurement of the sheet metal part contour.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of three-dimensional measurement, and more specifically, relates to a three-dimensional measurement method and system for rectangular contours of sheet metal parts based on feature fitting. Background Art

[0002] Sheet metal parts are widely used in aerospace, automobile manufacturing and other fields, with annual sales of hundreds of billions of yuan and a wide range of market applications. Sheet metal parts contain a large number of processing contours such as straight lines, round holes, and rectangles to achieve functions such as positioning and connection. The processing accuracy determines the actual performance and safety of sheet metal parts, and three-dimensional measurement is required to ensure it.

[0003] Existing sheet metal 3D measurement methods mainly include contact and non-contact methods. Among them, contact 3D measurement equipment includes vernier calipers, templates, three-dimensional coordinate measuring machines, etc., which have high accuracy but low efficiency and are difficult to meet the production efficiency. Non-contact 3D measurement equipment includes non-metric digital cameras, laser radars, structured light 3D measurement, etc., which have fast measurement speeds, but when measuring the processing contour, it is difficult to ensure the measurement accuracy of the contour due to factors such as local reflections in the surrounding area of ​​the contour and image noise.

[0004] Using binocular vision to directly extract contours and then perform 3D reconstruction can improve accuracy to a certain extent, but there are still some problems that need to be solved. First, there are a large number of different types of processing contours in sheet metal parts, and how to identify and extract the corresponding contours for processing and reconstruction is a difficult problem; second, how to fit the contour after the corresponding point cloud is reconstructed, and how to obtain the corresponding parameters and compare them with the standard values ​​to detect processing errors.

[0005] The main types of contours in sheet metal parts include circular holes, straight lines, rectangles, etc. The mathematical models of circular holes and straight lines are simple, and they can be used for contour recognition and fitting. However, there is currently no good solution for the recognition and three-dimensional fitting of rectangular contours.

[0006] Therefore, a high-precision rectangular contour 3D reconstruction and data analysis method is urgently needed to ensure the rectangular contour detection accuracy of sheet metal parts and help improve the safety performance of sheet metal parts. Summary of the invention

[0007] In response to the above defects or improvement needs of the prior art, the present invention provides a three-dimensional measurement method and system for the rectangular contour of a sheet metal part based on feature fitting, thereby solving the technical problem that existing three-dimensional measurement methods such as structured light are difficult to ensure the accuracy of rectangular contour point cloud reconstruction and data processing stability.

[0008] To achieve the above object, according to a first aspect of the present invention, a three-dimensional measurement method for a rectangular contour of a sheet metal part based on feature fitting is provided, comprising:

[0009] S1. Perform canny edge detection on the sheet metal images preprocessed by the left and right cameras to obtain preliminary edges, perform contour extraction and recognition, and obtain the parallelogram contour;

[0010] S2. fitting the four sides of the parallelogram contour to obtain a fitted quadrilateral contour;

[0011] S3. performing overall matching of the quadrilateral contour, and then performing corresponding point matching of the matching contour to achieve three-dimensional reconstruction;

[0012] S4. Perform three-dimensional rectangle fitting on the reconstructed contour point cloud to obtain the center point, length, width and size of the rectangle; if it is a rounded rectangle, perform additional rounded corner fitting; otherwise, do not perform fitting.

[0013] Preferably, the contour extraction and recognition are specifically:

[0014] S11. traverse the preliminary edges and extract the contours of the edges;

[0015] S12. Calculate the grayscale value ratio inside and outside the current edge contour to determine whether it meets the set threshold requirement. If so, proceed to step S13; otherwise, return to step S11;

[0016] S13. Fit the closest polygon to the current edge contour. If the number of sides of the obtained polygon is 4, it is considered that the contour may be a parallelogram, and the process goes to step S14; otherwise, the process returns to step S11;

[0017] S14. Perform parallelogram judgment on the fitted quadrilateral, calculate the parallelism of two pairs of opposite sides and the ratio of the contour length to the parallelogram length. If the parallelism and the length ratio are within a preset range, the current edge contour is judged to be a parallelogram; otherwise, the contour is abandoned.

[0018] Preferably, the fitting of the four sides of the parallelogram contour is specifically performed as follows:

[0019] Based on the four vertices closest to the polygon, the center points of the four sides are obtained, and straight line fitting is performed based on the pixel points in the parallelogram contour that are located on the corresponding four sides of the polygon and within the specified distance threshold from the center point, and the intersection is calculated to generate a quadrilateral; then, based on the distance between the quadrilateral and the contour pixel, it is determined whether there are rounded corners. If so, an ellipse is fitted based on the positions of the contour pixels of the four rounded corners, and then the rounded quadrilateral contour is reconstructed together with the quadrilateral; if not, no fitting is performed.

[0020] Preferably, the three-dimensional rectangle fitting is performed on the reconstructed contour point cloud, specifically:

[0021] S41. Perform plane fitting based on the constraint of minimizing the distance from the point to the plane, and set a threshold according to the distance from the point to the plane to remove discrete noise point clouds;

[0022] S42. Repeat step S41 until the distance from all point clouds to the fitting plane is less than the set threshold;

[0023] S43. Project the contour point cloud onto the fitting plane, perform the best quadrilateral fitting, and determine whether the fitted quadrilateral satisfies the definition of a rectangle. If it does not meet the specified threshold, rotate the fitting plane around the long side of the quadrilateral until it meets the specified threshold, and proceed to step S44;

[0024] S44. Perform equidistant interpolation on the fitted quadrilateral to obtain a quadrilateral point cloud with equal spacing;

[0025] S45. Based on the equally spaced quadrilaterals, a rectangle is fitted, specifically, the center point of the quadrilateral point cloud is calculated, and then the major axis direction and the minor axis direction are calculated based on the least square method, and the four intersection points of the major axis and the minor axis with the quadrilateral are solved, and a rectangle is generated based on the four intersection points, and the center point is recalculated to obtain the rectangle parameters;

[0026] S46. If it is not a rounded rectangle, directly return the rectangle parameters; if it is a rounded rectangle, traverse all points, find out the points on each corner radius, perform circle fitting, obtain the corner radius, and return the rounded rectangle parameters.

[0027] Preferably, the preprocessing is distortion correction and epipolar correction.

[0028] According to a second aspect of the present invention, a three-dimensional measurement system for rectangular contours of sheet metal parts based on feature fitting is provided, comprising:

[0029] A quadrilateral contour fitting module is used to perform canny edge detection on the sheet metal images preprocessed by the left and right cameras to obtain preliminary edges, perform contour extraction and recognition to obtain a parallelogram contour, and fit the four sides of the parallelogram contour to obtain a fitted quadrilateral contour;

[0030] A matching module performs overall matching on the quadrilateral contour, and then performs corresponding point matching on the matching contour to achieve three-dimensional reconstruction;

[0031] The 3D rectangle fitting module performs 3D rectangle fitting on the reconstructed contour point cloud to obtain the rectangle center point, length, width and size; if it is a rounded rectangle, additional rounded corner fitting is performed; otherwise, no fitting is performed.

[0032] Preferably, the contour extraction and recognition specifically includes:

[0033] Traverse the initial edges and extract the contour of the edges; calculate the ratio of the grayscale values ​​inside and outside the current edge contour to determine whether it meets the set threshold requirement. If it does, fit the closest polygon to the current edge contour. If the number of polygon sides obtained is 4, it is considered that this contour may be a parallelogram. Perform parallelogram judgment on the fitted quadrilateral, calculate the parallelism of two pairs of opposite sides and the ratio of the contour length to the parallelogram length. If the parallelism and length ratio are within the preset range, the current edge contour is judged to be a parallelogram; otherwise, the contour is abandoned.

[0034] Preferably, the fitting of the four sides of the parallelogram contour is specifically performed as follows:

[0035] Based on the four vertices closest to the polygon, the center points of the four sides are obtained, and straight line fitting is performed based on the pixel points in the parallelogram contour that are located on the corresponding four sides of the polygon and within the specified distance threshold from the center point, and the intersection is calculated to generate a quadrilateral; then, based on the distance between the quadrilateral and the contour pixel, it is determined whether there are rounded corners. If so, an ellipse is fitted based on the positions of the contour pixels of the four rounded corners, and then the rounded quadrilateral contour is reconstructed together with the quadrilateral; if not, no fitting is performed.

[0036] Preferably, the three-dimensional rectangle fitting is performed on the reconstructed contour point cloud, specifically:

[0037] Based on the constraint of minimizing the distance from the point to the plane, plane fitting is performed. A threshold is set according to the distance from the point to the plane to remove discrete noise point clouds until the distance from all point clouds to the fitting plane is less than the set threshold. The contour point cloud is projected onto the fitting plane, and the best quadrilateral fitting is performed to determine whether the fitted quadrilateral meets the definition of a rectangle. If it does not meet the specified threshold, the fitting plane is rotated around the long side of the quadrilateral until it meets the specified threshold. The fitted quadrilateral is interpolated at equal distances to obtain equally spaced quadrilateral point clouds. Based on the equally spaced quadrilaterals, a rectangle is fitted, specifically, the center point of the quadrilateral point cloud is calculated, and then the major axis direction and the minor axis direction are calculated based on the least squares method, and the four intersection points of the major axis and the minor axis with the quadrilateral are solved. A rectangle is generated based on the four intersection points, and the center point is recalculated to obtain the rectangle parameters. If it is not a rounded rectangle, the rectangle parameters are directly returned; if it is a rounded rectangle, all points are traversed to find the points on each fillet radius, and a circle is fitted to obtain the fillet radius and return the rounded rectangle parameters.

[0038] Preferably, the preprocessing is distortion correction and epipolar correction.

[0039] In general, the above technical solutions conceived by the present invention can achieve the following beneficial effects compared with the prior art:

[0040] 1. Considering that camera imaging is affected by camera noise and local reflection, it is difficult to ensure the accuracy of calculating the rectangular size after directly reconstructing the point cloud using traditional three-dimensional measurement methods such as structured light. The present invention is based on binocular stereo vision, directly performs rectangle recognition on the two-dimensional image, and reconstructs the contour point cloud, which can ensure the reconstruction accuracy and directly perform data processing and size analysis.

[0041] 2. When the present invention performs two-dimensional rectangular contour recognition, it adopts constraints based on internal and external contour comparison, size, quadrilateral parallelism, etc. to perform contour recognition, which can realize automatic extraction of rectangular contours and ensure automatic three-dimensional reconstruction.

[0042] 3. When the present invention extracts a two-dimensional rectangular contour, in order to ensure the accuracy of the rectangular contour extraction, a method of regenerating a quadrilateral by performing straight line fitting based on the central area of ​​the four sides of the contour is adopted, which can ensure the reconstruction accuracy of the point cloud.

[0043] 4. When the present invention performs three-dimensional rectangular contour fitting, it first removes noise based on iterative plane fitting, and then projects the rectangular point cloud onto the plane to perform quadrilateral fitting on this basis, determines the degree of complexity of the rectangular parameters of the quadrilateral, iteratively rotates the plane until the requirements are met, and obtains the precise plane of the three-dimensional rectangle.

[0044] 5. When the present invention performs three-dimensional rectangular contour fitting, it does not directly solve the minimum rectangle for the three-dimensional rectangular point cloud, but first interpolates the original fitted quadrilateral, calculates the center point of the quadrilateral point cloud, and then calculates the major axis direction and the minor axis direction, solves the four intersection points of the major axis and the minor axis with the quadrilateral, generates a rectangle based on the four intersection points, recalculates the center point, and obtains the rectangle parameters, which can ensure the accuracy of the rectangle fitting and obtain high-precision parameters. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] Figure 1 A flow chart of three-dimensional rectangular contour point cloud fitting provided by the present invention;

[0046] Figure 2 The binocular stereoscopic vision imaging principle provided by the present invention;

[0047] Figure 3 A schematic diagram of a rectangular contour recognition process in a two-dimensional image of a sheet metal part provided by the present invention;

[0048] Figure 4 The triangulation principle provided by the present invention;

[0049] Figure 5 The rectangular outline recognition diagram in the two-dimensional image of the sheet metal provided by the present invention; (a) is the rectangular outline recognition of the left camera, (b) is the rectangular outline recognition of the right camera, (c) is the enlarged rectangular outline of the left camera, and (d) is the enlarged rectangular outline of the right camera;

[0050] Figure 6 The three-dimensional rectangular contour point cloud fitting diagram provided by the present invention; (a) is the Geomagic rectangular fitting, and (b) is the rectangular contour fitting of this application. DETAILED DESCRIPTION

[0051] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention. In addition, the technical features involved in the various embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.

[0052] An embodiment of the present invention provides a three-dimensional measurement method for a rectangular contour of a sheet metal part based on feature fitting, comprising:

[0053] S1. Perform canny edge detection on the sheet metal images preprocessed by the left and right cameras to obtain preliminary edges, perform contour extraction and recognition, and obtain the parallelogram contour;

[0054] S2. fitting the four sides of the parallelogram contour to obtain a fitted quadrilateral contour;

[0055] S3. Perform overall matching on the quadrilateral contour, and then perform corresponding point matching on the matching contour to achieve three-dimensional reconstruction, such as Figure 1 As shown;

[0056] S4. Perform three-dimensional rectangle fitting on the reconstructed contour point cloud to obtain the center point, length, width and size of the rectangle; if it is a rounded rectangle, perform additional rounded corner fitting; otherwise, do not perform fitting.

[0057] Example

[0058] (1) Figure 2 As shown, turn on the light source to ensure that the surface of the sheet metal is properly illuminated, and then use the binocular camera to take pictures synchronously to obtain the image of the sheet metal workpiece.

[0059] (2) Perform distortion correction and epipolar correction on the image, then perform canny edge detection to obtain preliminary edges, perform contour extraction and recognition, and obtain a rectangular contour.

[0060] Specifically, Figure 3As shown, first, based on the ratio of gray values ​​inside and outside the contour, determine whether it meets the requirements of the rectangular hole contour. If it does, proceed to the next step; that is, find the closest polygon to the contour. If the number of sides of the obtained polygon is 4, it is considered that the contour may be a parallelogram; continue to the next step to perform parallelogram judgment, judge the parallelism of two pairs of opposite sides and the ratio of the contour length to the parallelogram length. If the parallelism and length ratio are both around 1, it is judged to be a parallelogram.

[0061] The main process of finding the closest polygon is as follows: a) find the two points in the contour that are farthest from each other and connect them into a line segment; b) find the point in the contour that is farthest from this line segment and connect these three points into a polygon (a triangle for the first time); c) continue the traversal of b) and keep finding the point farthest from the polygon until the distance from the farthest point to the polygon is less than the threshold we set, and then we can get the closest polygon to the contour.

[0062] The parallelism is calculated as follows: According to the four vertices of the quadrilateral, the unit direction vectors of the four sides are calculated. If the unit direction vectors of the two opposite sides are (x1, y1) and (x2, y2), the parallelism of the two lines is

[0063] Parallelism=|x1*x2+y1*y2|

[0064] When Parallelism is near 1, it means that the two lines are parallel. If two pairs of parallel lines are obtained and their length ratio meets the set threshold, the quadrilateral is judged to be a parallelogram.

[0065] (3) Perform straight line fitting on the four sides of the rectangular outline in the image to obtain a fitted quadrilateral. If there are rounded corners, perform rounded corner fitting;

[0066] Specifically, after the rectangular outline is recognized, the center points of the four sides are obtained based on the four vertices of the polygon that are calculated previously to be closest to the polygon. Then, straight line fitting is performed based on the pixel points in the acquired outline that are located on the four sides corresponding to the polygon and within the specified distance threshold from the center point, and the intersection is calculated to generate a quadrilateral. Then, based on the distance between the quadrilateral and the outline pixels, it is determined whether there are rounded corners. If so, an ellipse is fitted based on the positions of the outline pixels of the four rounded corners, and the rounded quadrilateral outline is reconstructed together with the quadrilateral.

[0067] (4) Based on the polar line constraint and size distance constraint, the corresponding rectangular contour matching is realized, and then the corresponding points of the matching contours are matched, and three-dimensional reconstruction is achieved through the triangulation principle.

[0068] Specifically, the corresponding contours are first found on the left and right camera images, and then the pixels on the contours are matched.

[0069] The contour matching is calculated as follows: based on the contours of the rectangles found on the left and right camera images in the previous step, the center Y-axis distance of all contours on the left and right camera images is calculated. If the distance is within the threshold range we specify and the size of the contours is basically similar, then it can be determined to be a corresponding contour.

[0070] The corresponding point matching method is as follows: first, redraw each pair of matched contours on two blank images, and then, based on the principle of left-right consistency, traverse each row of the left and right contour images from top to bottom to determine whether there are corresponding contour pixels. If the number of pixels on the left or right is 0, continue to traverse the next row. If it is not 0, find the value with the smaller number of pixels on the left and right, and loop with it as the maximum value. When looping, use the right camera as the standard and match from left to right in sequence, that is, the first point of the right camera matches the first point of the left camera, and so on until the end of the loop.

[0071] The principle of triangulation is as follows: Figure 4 shown.

[0072] (5) Perform 3D rectangle fitting on the reconstructed contour point cloud to obtain parameters such as the rectangle center point, length, width, and size. If it is a rounded rectangle, perform additional rounded corner fitting.

[0073] Specifically, 1) plane fitting is performed based on the constraint of minimizing the distance from the point to the plane, and a threshold is set according to the distance from the point to the plane to remove discrete noise point clouds; 2) steps in 1 are repeated iteratively until the distance from all point clouds to the fitting plane is less than the set threshold; 3) the contour point cloud is projected onto the fitting plane, and the best quadrilateral fitting is performed to determine whether the fitted quadrilateral meets the definition of a rectangle (angle, parallelism, etc.). If it does not meet the specified threshold, the fitting plane is rotated around the long side of the quadrilateral until the specified threshold is met, and the next step is performed; 4) equidistant interpolation is performed on the fitted quadrilateral to obtain equally spaced quadrilateral point clouds; 5) rectangle fitting is performed based on equally spaced quadrilaterals, specifically, the center point of the quadrilateral point cloud is calculated, and then the major axis direction and the minor axis direction are calculated based on the least squares method, the four intersection points of the major axis and the minor axis with the quadrilateral are solved, a rectangle is generated based on the four intersection points, the center point is recalculated, and the rectangle parameters are obtained. 6) If it is a rounded rectangle, traverse all points, find the points on each corner radius, perform circle fitting, and obtain the corner radius.

[0074] The best quadrilateral fitting method is to traverse all the projection points of the point cloud on the plane and sort them, find four extreme points (the points with the largest and smallest x and y coordinates respectively), and sort them in clockwise order.

[0075] P1(x min, y1), P2(x2, ymax ), P3(x max , y3), P4(x4, y min )

[0076] However, in a 3D point cloud, the poles are not actually corners, but are near the corners. By reducing the area range for division, we can get most of the points on the straight line. We fit these points to the straight line, calculate the distance from the point to the fitted straight line, and get the standard deviation of the distance. Then set a threshold parameter to determine whether it is a straight line, otherwise give up. If it is a straight line, store it in the straight line vector. If four straight lines are finally obtained, it is determined to be a quadrilateral and the next step can be taken.

[0077] The specific steps of the rectangle fitting method are as follows:

[0078] 1) Calculate the center point of the point cloud, that is, get the average value of all point coordinates

[0079] 2) Calculate the equation of the main axis line. Since the main axis must pass through the center point, the equation of the main axis is set as

[0080]

[0081] Where (x, y) represents the projected point cloud coordinates, the above formula can be transformed into

[0082]

[0083] According to the least squares method, the sum of the squares of the distances from all points to the principal axis is

[0084]

[0085] To minimize P, we can get

[0086]

[0087] For the convenience of calculation,

[0088] tan(θ principal ) = k principal

[0089] Where θ principal It can be understood as the angle between the main axis direction and the positive direction of the X-axis.

[0090] By transformation, we can get

[0091]

[0092] From this we can derive θ principal Angle, in order to prevent the main axis from being parallel to the X axis and to make the value range ), so the atan2() function is used instead of the atan() function.

[0093] 3) Calculate the direction of the minor axis of the rectangle based on the direction of the main axis. Since the direction of the minor axis also passes through the center, the equation of the minor axis is

[0094]

[0095] 4) Traverse the four sides of the quadrilateral. If it is a long side, find the intersection with the short axis line. If it is a short side, find the intersection with the long axis line. Finally, four intersection points are obtained. The width of the rectangle is calculated by the two intersection points of the short axis and the quadrilateral, and the length of the rectangle is calculated by the two intersection points of the long axis and the quadrilateral. Finally, the rectangle is obtained. But note that the center point has changed at this time. It is no longer the center point calculated at the beginning, but the center point obtained by the four intersection points. It is defined as

[0096]

[0097] If there is a fillet, traverse all points and find the points on each fillet radius. The judgment method is as follows:

[0098]

[0099] where dis line is the shortest distance from the point to all the rectangle edges, dis jiao The shortest distance from the point to the vertex of the rectangle is then calculated by using the least squares method to minimize the sum of the squares of the distances from all points to the center of each corner, following the fitting of the circle. This gives the length of the radius.

[0100] To further illustrate the advantages of the three-dimensional measurement method for rectangular contour of sheet metal parts based on feature fitting provided by the present invention, the three-dimensional measurement method for rectangular contour of sheet metal parts based on feature fitting provided by the present invention is used to measure the workpiece to be measured. Figure 5 (a) and (b) are the rectangular contour recognition images of the workpiece to be measured obtained by the left and right cameras. Figure 5 (c) and (d) are enlarged views of (a) and (b). It can be seen that this method can accurately identify and extract the rectangular contour. Figure 6 (a) in the figure is the fitting method of the classic Geomagic software for 3D rectangular point cloud. Figure 6 (b) is the rectangular fitting result of the workpiece to be measured by the three-dimensional measurement method of the rectangular contour of a sheet metal part based on feature fitting provided by the present invention. Compared with the traditional rectangular fitting method, the rectangular point cloud fitting result of the three-dimensional measurement method of the rectangular contour of a sheet metal part based on feature fitting provided by the present invention is more accurate.

[0101] It will be easily understood by those skilled in the art that the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.

Claims

1. A three-dimensional measurement method for rectangular contour of sheet metal parts based on feature fitting, characterized in that: include: S1. Perform canny edge detection on the sheet metal images preprocessed by the left and right cameras to obtain preliminary edges, perform contour extraction and recognition, and obtain the parallelogram contour; S2. fitting the four sides of the parallelogram contour to obtain a fitted quadrilateral contour; S3. performing overall matching of the quadrilateral contour, and then performing corresponding point matching of the matching contour to achieve three-dimensional reconstruction; S4. Perform three-dimensional rectangle fitting on the reconstructed contour point cloud to obtain the center point, length, width and size of the rectangle; if it is a rounded rectangle, perform additional rounded corner fitting; otherwise, do not perform fitting; specifically: S41. Perform plane fitting based on the constraint of minimizing the distance from the point to the plane, and set a threshold according to the distance from the point to the plane to remove discrete noise point clouds; S42. Repeat step S41 until the distance from all point clouds to the fitting plane is less than the set threshold; S43. Project the contour point cloud onto the fitting plane, perform the best quadrilateral fitting, and determine whether the fitted quadrilateral satisfies the definition of a rectangle. If it does not meet the specified threshold, rotate the fitting plane around the long side of the quadrilateral until it meets the specified threshold, and proceed to step S44; S44. Perform equidistant interpolation on the fitted quadrilateral to obtain a quadrilateral point cloud with equal spacing; S45. Based on the equally spaced quadrilaterals, a rectangle is fitted, specifically, the center point of the quadrilateral point cloud is calculated, and then the major axis direction and the minor axis direction are calculated based on the least square method, and the four intersection points of the major axis and the minor axis with the quadrilateral are solved, and a rectangle is generated based on the four intersection points, and the center point is recalculated to obtain the rectangle parameters; S46. If it is not a rounded rectangle, directly return the rectangle parameters; if it is a rounded rectangle, traverse all points, find out the points on each corner radius, perform circle fitting, obtain the corner radius, and return the rounded rectangle parameters.

2. A three-dimensional measurement method for rectangular contour of sheet metal parts based on feature fitting as claimed in claim 1, characterized in that: The contour extraction and recognition are specifically as follows: S11. traverse the preliminary edges and extract the contours of the edges; S12. Calculate the grayscale value ratio inside and outside the current edge contour to determine whether it meets the set threshold requirement. If so, proceed to step S13; Otherwise, return to step S11; S13. Fit the closest polygon to the current edge contour. If the number of sides of the obtained polygon is 4, it is considered that the contour may be a parallelogram, and the process goes to step S14; Otherwise, return to step S11; S14. Perform parallelogram judgment on the fitted quadrilateral, calculate the parallelism of two pairs of opposite sides and the ratio of the contour length to the parallelogram length. If the parallelism and the length ratio are within a preset range, the current edge contour is judged to be a parallelogram; otherwise, the contour is abandoned.

3. A three-dimensional measurement method for rectangular contour of sheet metal parts based on feature fitting as claimed in claim 2, characterized in that: The fitting of the four sides of the parallelogram contour is specifically as follows: Based on the four vertices closest to the polygon, the center points of the four sides are obtained, and straight line fitting is performed based on the pixel points in the parallelogram contour that are located on the corresponding four sides of the polygon and within the specified distance threshold from the center point, and the intersection is calculated to generate a quadrilateral; then, based on the distance between the quadrilateral and the contour pixel, it is determined whether there are rounded corners. If so, an ellipse is fitted based on the positions of the contour pixels of the four rounded corners, and then the rounded quadrilateral contour is reconstructed together with the quadrilateral; if not, no fitting is performed.

4. A three-dimensional measurement method for rectangular contour of sheet metal parts based on feature fitting as claimed in claim 1, characterized in that: The preprocessing includes distortion correction and epipolar correction.

5. A three-dimensional measurement system for rectangular contours of sheet metal parts based on feature fitting, characterized in that: include: A quadrilateral contour fitting module is used to perform canny edge detection on the sheet metal images preprocessed by the left and right cameras to obtain preliminary edges, perform contour extraction and recognition to obtain a parallelogram contour, and fit the four sides of the parallelogram contour to obtain a fitted quadrilateral contour; A matching module performs overall matching on the quadrilateral contour, and then performs corresponding point matching on the matching contour to achieve three-dimensional reconstruction; The 3D rectangle fitting module performs 3D rectangle fitting on the reconstructed contour point cloud to obtain the center point, length, width and size of the rectangle. If it is a rounded rectangle, additional rounded corner fitting is performed; otherwise, no fitting is performed. Specifically: Based on the constraint of minimizing the distance from the point to the plane, plane fitting is performed. A threshold is set according to the distance from the point to the plane to remove discrete noise point clouds until the distance from all point clouds to the fitting plane is less than the set threshold. The contour point cloud is projected onto the fitting plane, and the best quadrilateral fitting is performed to determine whether the fitted quadrilateral meets the definition of a rectangle. If it does not meet the specified threshold, the fitting plane is rotated around the long side of the quadrilateral until it meets the specified threshold. The fitted quadrilateral is interpolated at equal distances to obtain equally spaced quadrilateral point clouds. Based on the equally spaced quadrilaterals, a rectangle is fitted, specifically, the center point of the quadrilateral point cloud is calculated, and then the major axis direction and the minor axis direction are calculated based on the least squares method, and the four intersection points of the major axis and the minor axis with the quadrilateral are solved. A rectangle is generated based on the four intersection points, and the center point is recalculated to obtain the rectangle parameters. If it is not a rounded rectangle, the rectangle parameters are directly returned; if it is a rounded rectangle, all points are traversed to find the points on each fillet radius, and a circle is fitted to obtain the fillet radius and return the rounded rectangle parameters.

6. A sheet metal rectangular contour three-dimensional measurement system based on feature fitting as claimed in claim 5, characterized in that: The contour extraction and recognition specifically include: Traverse the initial edges and extract the contour of the edges; calculate the ratio of the grayscale values ​​inside and outside the current edge contour to determine whether it meets the set threshold requirement. If it does, fit the closest polygon to the current edge contour. If the number of polygon sides obtained is 4, it is considered that this contour may be a parallelogram. Perform parallelogram judgment on the fitted quadrilateral, calculate the parallelism of two pairs of opposite sides and the ratio of the contour length to the parallelogram length. If the parallelism and length ratio are within the preset range, the current edge contour is judged to be a parallelogram; otherwise, the contour is abandoned.

7. A sheet metal rectangular contour three-dimensional measurement system based on feature fitting as claimed in claim 6, characterized in that: The fitting of the four sides of the parallelogram contour is specifically as follows: Based on the four vertices closest to the polygon, the center points of the four sides are obtained, and straight line fitting is performed based on the pixel points in the parallelogram contour that are located on the corresponding four sides of the polygon and within the specified distance threshold from the center point, and the intersection is calculated to generate a quadrilateral; then, based on the distance between the quadrilateral and the contour pixel, it is determined whether there are rounded corners. If so, an ellipse is fitted based on the positions of the contour pixels of the four rounded corners, and then the rounded quadrilateral contour is reconstructed together with the quadrilateral; if not, no fitting is performed.

8. The three-dimensional measurement system for rectangular contour of sheet metal parts based on feature fitting as claimed in claim 5, characterized in that: The preprocessing includes distortion correction and epipolar correction.

Citation Information

Cited By

  • Rectangular fitting and measuring method of three-dimensional point cloud

    CN119444839A