A method for searching and positioning the axis of symmetry of a complex-shaped workpiece
Through linear laser scanning and image processing technology, it is converted into a two-dimensional depth map, extracting the inner and outer edges and symmetry axis of the bevel of complex special-shaped workpieces, solving the precise positioning of complex welded components in high-precision manufacturing, and achieving high-precision workpiece assembly.
Patent Information
- Application Number
- CN202410023331.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-08
- Publication Date
- 2025-07-22
- Estimated Expiration
- 2044-01-08
AI Technical Summary
In the field of high-precision manufacturing, it is difficult to accurately position the butt and assembly of complex welded components, especially when docking the bevel of welding workpieces with complex shapes. The matching results of the existing image processing methods are not accurate enough and take a long time, making it difficult to meet the quality requirements of high-precision manufacturing.
The surface of the workpiece to be installed is scanned by linear laser, and the three-dimensional point cloud data is converted into a two-dimensional depth map. Combined with median filtering, adaptive threshold method, morphological operation and random sampling consistency method, the contour lines and symmetry axis of the workpiece are extracted, the data dimension is reduced, and the calculation efficiency is improved, and the position and angle of the workpiece are accurately positioned.
It realizes high-precision positioning of complex special-shaped workpieces, reduces the calculation amount and processing difficulty, improves recognition accuracy and assembly accuracy, and has a positioning accuracy of less than 0.2mm, improving the adaptability and intelligence of automatic installation of workpieces.
Smart Images

Figure CN118052871B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of intelligent positioning for manufacturing complex-shaped parts with high precision, and particularly relates to a method for searching and positioning the axis of symmetry of a complex-shaped workpiece. Background Art
[0002] Currently, the butt joint assembly of complex welding components in some high-precision manufacturing fields is mostly manual or semi-automatic. These assembly methods require manual calibration of the butt joint accuracy. When butt-jointing the grooves of complex-shaped welding workpieces, since the grooves are complex curves, the difficulty of butt joint is further increased. Therefore, a positioning method that can accurately locate the workpiece groove in space is needed. By obtaining the three-dimensional depth information of the workpiece through line laser and mapping it into a two-dimensional image for spatial positioning, the dependence on manual labor can be reduced.
[0003] The axis of symmetry of an image is an important feature of the image. In existing image processing methods, finding the axis of symmetry of an image is of great significance for object model matching, scene understanding, as well as recognition and positioning.
[0004] Through retrieval and analysis of existing technical literature, it is found that the "Method for Detecting the Axis of Symmetry of an Image" disclosed in the Chinese patent document with the patent publication number CN 105825528 A; the "Method for Detecting the Axis of Symmetry of an Image Based on Edge Line Matching" disclosed in the Chinese patent document with the patent authorization announcement number CN 106780528 B; the "Method for Detecting and Positioning the Axis of Symmetry of a Symmetric Image" disclosed in the Chinese patent document with the patent publication number CN 105184830 A.
[0005] The above patents mainly detect the axis of symmetry of an image by extracting effective feature points of the image or using all points of the image. This will make the matching result inaccurate or consume a large amount of time, and it is difficult for the efficiency and recognition accuracy to meet the quality requirements of high-precision manufacturing. Summary of the Invention
[0006] In order to overcome the deficiencies in the prior art, the present invention provides a method for searching and positioning the axis of symmetry of a complex-shaped workpiece. By scanning the surface of the workpiece to be installed with a line laser and searching for the axis of symmetry, the offset position and angle of the workpiece can be obtained. The method is simple, the information is comprehensive, and the positioning is accurate.
[0007] In order to achieve the above-mentioned invention purpose, the technical solution adopted to solve its technical problems is as follows:
[0008] A method for searching and positioning the axis of symmetry of a complex-shaped workpiece, comprising the following steps:
[0009] Step S1: The sensor scans the surface of the fitting to be installed to obtain the three-dimensional point cloud data of the fitting area to be assembled;
[0010] Step S2: Preprocess the 3D point cloud and reduce the data dimension;
[0011] Step S3: Extract the inner and outer edge contours of the groove of the assembled part;
[0012] Step S4: Find the axis of symmetry of the inner edge curve of the groove;
[0013] Step S5: Use the curve pole as the feature point of the inner edge curve, map it back to the 3D point cloud data, use the top or bottom feature point as the reference of the spatial position, and compare it with the standard position to obtain the position deviation.
[0014] Further, step S2 includes the following steps:
[0015] Step S2.1: First, use median filtering to filter out isolated noise, while removing noise and maintaining the original edge characteristics;
[0016] Step S2.2: Convert the 3D point cloud into a 2D depth map. Since the amount of 3D point cloud data obtained by scanning is large, in order to more intuitively extract the characteristics of the point cloud data, by establishing the conversion relationship between 3D data and 2D grayscale images, convert the 3D point cloud data into a 2D grayscale image to achieve data dimension reduction;
[0017] Step S2.3: Gray Figure 2 value quantization. Use the adaptive threshold method to process the grayscale image, uniformly assign the pixels below the threshold to 0, and assign those above the threshold to 255 to achieve image binarization and highlight the groove edge characteristics.
[0018] Further, step S3 includes the following steps:
[0019] Step S3.1: Remove the small connected regions in the image. By searching the contours of the connected regions, obtain the contour areas of the connected regions, determine the connected region threshold, and then delete the connected regions smaller than the threshold based on the threshold;
[0020] Step S3.2: Detect the groove edge contour based on the canny algorithm. Use a Gaussian filter to smooth the image and filter out noise; use the Sobel operator to calculate the gradient intensity and direction of each pixel point in the image; apply non-maximum suppression to eliminate the stray effects brought by edge detection; use double-threshold detection to determine the real and potential edges;
[0021] Step S3.3: Use morphological closing operation to connect the edge contours. Use a 5×5 convolution kernel to dilate and then erode the above-mentioned edge contours to connect the gaps and form a complete edge contour line;
[0022] Step S3.4: Fit the contour edge curve based on the Random Sample Consensus (RANSAC) method. Randomly select K points from the edge point set, fit a curve for the K points, calculate the distances from other points in the point set to the fitted curve, and set a certain threshold. If the distance is greater than the threshold, it is called an outlier and is discarded; if it is less than the threshold, it is an inlier, and count the number of inliers. Then, based on the new inliers, perform curve fitting iteratively again. Finally, select the fitted curve with the largest number of inliers. At this time, the curve is the optimal fitted curve, and the inner and outer edge contours of the assembly groove are obtained.
[0023] Further, step S4 includes the following steps:
[0024] Step S4.1: Traverse all pixel points in the figure row by row, and count the coordinates of all points on the inner edge contour line.
[0025] Step S4.2: Data compression, remove the data point set in the middle area of the inner edge contour, and only retain the partial data point set at the head and tail areas of the contour line to improve the search speed when finding the symmetry axis.
[0026] Step S4.3: Calculate and screen the major axis of the inner edge contour line, match and calculate the lengths of the data points at the head and tail areas one by one, and determine the major axis point pair set according to the major axis value of the workpiece contour model.
[0027] Step S4.4: Search and determine the final symmetry axis. Starting from the first possible symmetry axis, gradually judge the coincidence degree between the symmetric points of the left contour data points and the right contour data points. If it falls on the original contour line, the total number is incremented by one; if the number of points falling on the contour line + the number of remaining unjudged points is less than the maximum number of points, directly skip this search until all major axis point pairs are judged. Then, the one with the largest coincidence degree is the symmetry axis of the contour line.
[0028] Due to the adoption of the above technical solutions, compared with the prior art, the present invention has the following advantages and positive effects:
[0029] 1. The method for searching and positioning the symmetry axis of a complex-shaped workpiece in the present invention converts the three-dimensional point cloud into a two-dimensional depth map, reduces the data dimension, and greatly reduces the amount of calculation. At the same time, it is very convenient to apply mature methods such as filtering and denoising, threshold segmentation, morphological operations, and edge detection for image processing, as well as the Random Sample Consensus (RANSAC) method to fit the edge contour line, significantly reducing the difficulty of processing a large amount of point cloud data and improving the identification accuracy.
[0030] 2. The method for searching and positioning the symmetry axis of a complex-shaped workpiece in the present invention compresses the contour data according to the data distribution characteristics, and only retains the data point set at the head and tail, significantly reducing the amount of calculation for searching the symmetry axis.
[0031] 3. In the symmetry axis search algorithm of the present invention, if the number of points falling on the contour line + the number of remaining unjudged points is less than the maximum number of points, this comparison is directly skipped, reducing the amount of data comparison in each search. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the drawings in the following description are only some embodiments of the present invention. For those skilled in the art, without creative efforts, other drawings can also be obtained based on these drawings. In the drawings:
[0033] Figure 1 is a flowchart of a method for searching and positioning the symmetry axis of a complex-shaped workpiece according to the present invention;
[0034] Figure 2 is a schematic diagram of workpiece scanning according to the present invention;
[0035] Figure 3 is a two-dimensional mapping diagram of the three-dimensional depth information of the workpiece according to the present invention;
[0036] Figure 4 is a binary curve diagram of the workpiece according to the present invention;
[0037] Figure 5 is a schematic diagram of the symmetry axis search curve after retaining the head and tail curves of the workpiece according to the present invention;
[0038] Figure 6 is a schematic diagram of the upper, lower, left, and right feature points of the curve according to the present invention;
[0039] Figure 7 is a schematic diagram of calculating the deflection angle of the workpiece around the z-axis by the deviation of the top and bottom feature points in the x and y directions according to the present invention;
[0040] Figure 8 is a schematic diagram of calculating the deflection angle of the workpiece around the x-axis by the deviation of the top and bottom feature points in the y and z directions according to the present invention;
[0041] Figure 9 is a schematic diagram of calculating the deflection angle of the workpiece around the y-axis by the deviation of the left and right feature points in the x and z directions according to the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0042] The following will clearly and completely describe the technical solutions of the present invention with reference to the drawings. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts fall within the scope of protection of the present invention.
[0043] As Figures 1-9As shown in the figure, this embodiment discloses a method for searching and positioning the axis of symmetry of a complex shaped workpiece, including the following steps:
[0044] Step S1: The sensor scans the surface of the fitting to be assembled to obtain the three-dimensional point cloud data of the assembly area.
[0045] As Figure 2 shown, the surface of the workpiece to be assembled is scanned by a laser scanning sensor, and the three-dimensional point cloud information of the workpiece surface is stored. The scanning from the starting position a to the ending position b is completed. The laser sensor scans along a straight line at a speed of 0.05 m / s. For the obtained point cloud data, the interval between each row is determined according to the scanning frequency of the laser displacement sensor 2. In the embodiment, the scanning frequency is set to 100 Hz, so the interval between each row is 0.01 s. After the scanning is completed, 10,000 rows of data will be generated. Each row of scanning data has 3,200 columns, and the distance between each column represents 0.025 mm.
[0046] Step S2: Preprocess the three-dimensional point cloud and reduce the data dimension.
[0047] The obtained three-dimensional point cloud data is transformed. The point cloud data is simplified into a two-dimensional grayscale image for processing. The image processing algorithm process is median filtering to remove noise, two-dimensional image grayscale reduction, and then conversion to a binary image through an adaptive threshold. After processing, a preliminary image is obtained. Specifically, step S2 includes the following sub-steps:
[0048] Step S2.1: First, median filtering is used to filter out isolated noises such as salt-and-pepper noise and impulse noise, while maintaining the original edge characteristics during noise removal; in the embodiment, the window size of the median filtering is selected as 5×5.
[0049] Step S2.2: Convert the three-dimensional point cloud into a two-dimensional depth map. The amount of three-dimensional point cloud data obtained by scanning is large. In order to more intuitively extract the characteristics of the point cloud data, by establishing the conversion relationship between the three-dimensional data and the two-dimensional grayscale image, the three-dimensional point cloud data is converted into a two-dimensional grayscale image to achieve data dimension reduction, as Figure 3 shown.
[0050]
[0051] Assume that the grayscale value at the pixel position (i, j) is represented by I(i, j), and the depth value of the corresponding position point cloud data is z(i, j). Take the maximum depth maxdepth and the minimum depth mindepth in the point cloud data, and scale the Z coordinates of all the point clouds to the range of 0 to 255 in proportion.
[0052] Step S2.3: Grayscale Figure 2Value quantization is performed on the grayscale image using an adaptive thresholding method. Pixels below the threshold are uniformly assigned a value of 0, and pixels above the threshold are assigned a value of 255 to achieve image binarization and highlight the groove edge features.
[0053] The entire grayscale image is calculated to obtain the threshold. Pixels below the threshold are uniformly assigned a value of 0, and pixels above the threshold are assigned a value of 255 to achieve image binarization. In this embodiment, the OTSU algorithm is used for adaptive binarization. First, the number of pixels corresponding to each gray level from 0 to 255 is calculated and saved in an array. The subscript of the array is the gray value, and the saved content is the number of pixels corresponding to the current gray value. Secondly, the average gray level of the background image, the proportion of the number of background image pixels, the average gray level of the foreground image, and the proportion of the number of foreground image pixels are calculated. Finally, each gray level from 0 to 255 is traversed to calculate and find the maximum inter-class variance. The final binary image is obtained, as Figure 4 shown.
[0054] Step S3: Extract the inner and outer edge contours of the groove of the assembly;
[0055] Furthermore, step S3 includes the following steps:
[0056] Step S3.1: Remove small connected regions in the image. By searching the contours of the connected regions, the contour areas of the connected regions are obtained, the connected region threshold is determined, and then the connected regions smaller than the threshold are deleted based on the threshold;
[0057] Step S3.2: Detect the groove edge contour based on the canny algorithm. Use a Gaussian filter to smooth the image and filter out noise; calculate the gradient intensity and direction of each pixel point in the image using the Sobel operator; apply non-maximum suppression to eliminate the spurious effects brought by edge detection; on this basis, use double-threshold detection to determine real and potential edges;
[0058] Step S3.3: Connect the edge contours through morphological closing operation. Use a 5×5 convolution kernel to dilate and then erode the above-mentioned edge contours to connect the gaps and form a complete edge contour line;
[0059] Step S3.4: Fit the contour edge curve based on the Random Sample Consensus (RANSAC) method. Use the least squares method based on the random sample consensus algorithm to fit the edge contour curve, obtain the fitting curve formula, and calculate the pole coordinates of the curve. The fitting formula is as follows;
[0060] y = a4x 4 + a3x 3 + a2x 2 + a1x + a0
[0061] That is, randomly select 10 points from the edge point set, perform curve fitting on these 10 points, calculate the distances from other points in the point set to the fitted curve, and set a certain threshold. If it is greater than the threshold, it is called an outlier and is discarded; if it is less than the threshold, it is an inlier, and the number of inliers is counted. Then, based on the new inliers, perform curve fitting again, iterate multiple times, and select the fitted curve with the largest number of inliers. At this time, the curve is the optimal fitted curve, and the number of iterations is selected as 500 times. Finally, only the polynomial with the highest accuracy, that is, the least number of pixels deviating from the fitted curve, is retained as the fitting result. In the embodiment, when the pixel distance from the fitted curve exceeds 2 pixel values, it is considered that the pixel deviates from the curve
[0062] Step S4: Find the axis of symmetry of the inner edge curve of the groove;
[0063] Further, step S4 includes the following steps:
[0064] Step S4.1: Traverse all pixel points in the figure row by row and count the coordinates of all points on the inner edge contour line;
[0065] Step S4.2: Data compression, remove the data point set in the middle area of the inner edge contour, and only retain the partial data point set in the head and tail areas of the contour line to improve the search speed when finding the axis of symmetry, as Figure 5 shown.
[0066] Step S4.3: Calculate and screen the major axis of the inner edge contour line, match and calculate the lengths of the data points in the head and tail areas one by one, and determine the major axis point pair set according to the major axis value of the workpiece contour model;
[0067] Step S4.4: Search and determine the final axis of symmetry. Starting from the first possible axis of symmetry, gradually judge the coincidence degree between the symmetric points of the left contour data points and the right contour data points. If it falls on the original contour line, the total number is incremented by one,
[0068] The equation of the major axis in the two-dimensional plane straight line is;
[0069] Ax + By + C = 0
[0070] The formula for calculating the symmetric point pair is as follows,;
[0071] x2 = -(2ABy1 + (A 2 + B 2 ) * x1 + 2AC) ÷ (A 2 + B 2 )
[0072] y2 = -(2ABx1 + (A 2 + B 2 ) * y1 + 2AC) ÷ (A 2 + B 2 )
[0073] Statistical coincidence degree: Taking a certain threshold as the standard, if it falls on the contour line, the total number is incremented by one. In this embodiment, the threshold is set to 1;
[0074]
[0075] If the number of points falling on the contour line + the number of remaining unjudged points is less than the maximum number of points, this search is directly skipped until all pairs of major axis points are judged. Then, the one with the maximum coincidence degree is the axis of symmetry of the contour line. After finding the straight-line equation of the axis of symmetry, the position of the curve equation is corrected. The purpose is to assist in finding the pole points. Among them, (row, col) is the position of the point on the curve before correction, (ro_row, ro_col) is the position after correction, and θ is the small angle value between the axis of symmetry and the column direction;
[0076] ro_row = row * cos(θ) - col * sin(θ)
[0077] ro_col = row * sin(θ) + col * cos(θ)
[0078] Step S5: Using the pole coordinates of the curve as feature points, obtain the pixel coordinates of the feature points in the inner edge curve. As Figure 6 shown, it is divided into top, bottom, left, and right feature points, and mapped back to the three-dimensional point cloud data. Taking the feature points as the reference of the spatial position, calculate the position deviation and angle deviation. The deviation of the top and bottom feature points in the x and y directions calculates the deflection angle of the workpiece around the z axis, as Figure 7 shown. The deviation of the top and bottom feature points in the y and z directions calculates the deflection angle of the workpiece around the x axis, as Figure 8 shown. The deviation of the left and right feature points in the x and z directions calculates the deflection angle of the workpiece around the y axis, as Figure 9 shown. The calculation formulas are as follows;
[0079] Δx = up_x - standard_x
[0080] Δy = up_y - standard_y
[0081] Δz = up_z - standard_z
[0082] angle_z = arctan((up_x - down_x) ÷ (up_y - down_y))
[0083] angle_x = arctan((up_z - down_z) ÷ (up_y - down_y))
[0084] angle_y = arctan((left_z - right_z) ÷ (left_x - right_x))
[0085] Wherein, Δx, Δy, and Δz are position deviation values, standard_x, standard_y, and standard_z are reference values, angle_x, angle_y, and angle_z are angle deviation values, up_x, up_y, and up_z are the three-dimensional spatial positions of the upper feature points, down_x, down_y, and down_z are the three-dimensional spatial positions of the lower feature points, left_x, left_y, and left_z are the three-dimensional spatial positions of the left feature points, and right_x, right_y, and right_z are the three-dimensional spatial positions of the right feature points.
[0086] In this way, the position and angle deviations of the workpiece relative to the standard position (the position without position and angle deviations of the workpiece) can be calculated. After obtaining Δx, Δy, Δz, angle_x, angle_y, and angle_z, the robot first corrects the angle of the workpiece and then corrects the position deviation, so that the actual position of the workpiece to be assembled can be located, facilitating the butt joint of the workpiece groove with the workpiece to be assembled and improving the assembly accuracy.
[0087] This embodiment conveniently and reliably realizes the positioning of the spatial position of workpieces with complex shapes. The positioning accuracy is within 0.2 mm, laying a foundation for high-precision workpiece installation on this basis and greatly improving the adaptability and intelligence of automatic workpiece installation in industry. Therefore, this method has great promotion and application value both from the perspectives of economic and social benefits.
[0088] As described above, it is only a preferred specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by those skilled in the art within the technical scope disclosed by the present invention should be covered by the protection scope of the present invention. Therefore, the protection scope of the present invention should be subject to the protection scope of the claims.
Claims
1. A method for searching and positioning the axis of symmetry of a complex shaped workpiece, characterized in that, It includes the following steps: Step S1: The sensor scans the surface of the fitting to be installed to obtain the three-dimensional point cloud data of the area to be assembled; Step S2: Preprocess the three-dimensional point cloud and reduce the data dimension; Step S3: Extract the inner and outer edge contours of the fitting groove; Step S4: Find the axis of symmetry of the inner edge curve of the groove; Step S4 includes the following steps: Step S4.1: Traverse all pixel points in the figure row by row, and count the coordinates of all points on the inner edge contour line; Step S4.2: Data compression, remove the data point set in the middle area of the inner edge contour, and only retain the partial data point set at the head and tail areas of the contour line to improve the search speed when finding the axis of symmetry; Step S4.3: Calculate and screen the major axis of the inner edge contour line, match and calculate the length of the data points at the head and tail areas one by one, and determine the major axis point pair set according to the major axis value of the workpiece contour model; Step S4.4: Search and determine the final axis of symmetry. Starting from the first possible axis of symmetry, gradually judge the coincidence degree between the symmetric points of the left contour data points and the right contour data points. If it falls on the original contour line, the total number is incremented by one. If the number of points falling on the contour line + the remaining unjudged points is less than the maximum number of points, directly skip this search until all major axis point pairs are judged. Then, the one with the maximum coincidence degree is the axis of symmetry of the contour line; Step S5: Use the curve pole point as the feature point of the inner edge curve, map it back to the three-dimensional point cloud data, use the top or bottom feature point as the reference for the spatial position, and compare it with the standard position to obtain the position deviation.
2. The method for searching and positioning the symmetry axis of a complex-shaped workpiece according to claim 1, characterized in that Step S2 includes the following steps: Step S2.1: First, use median filtering to filter and remove isolated noise, while maintaining the original edge characteristics when removing noise; Step S2.2: Convert the three-dimensional point cloud into a two-dimensional depth map. Since the amount of three-dimensional point cloud data obtained by scanning is large, in order to more intuitively extract the feature of the point cloud data, by establishing the conversion relationship between the three-dimensional data and the two-dimensional grayscale map, convert the three-dimensional point cloud data into a two-dimensional grayscale map to achieve data dimension reduction; Step S2.3: Binarize the grayscale map, use the adaptive threshold method to process the grayscale map, uniformly assign the pixels below the threshold to 0, and assign the pixels above the threshold to 255 to achieve image binarization and highlight the groove edge feature.
3. A method for searching and positioning the axis of symmetry of a complex-shaped workpiece according to claim 1, characterized in that Step S3 includes the following steps: Step S3.1: Remove the small connected regions in the image. By searching the contour of the connected region, obtain the contour area of the connected region, determine the connected region threshold, and then delete the connected regions smaller than the threshold based on the threshold; Step S3.2: Detect the groove edge contour based on the canny algorithm. Use the Gaussian filter to smooth the image and filter out noise; use the Sobel operator to calculate the gradient intensity and direction of each pixel point in the figure; apply non-maximum suppression to eliminate the spurious effect brought by edge detection; Adopt double-threshold detection to determine the real and potential edges; Step S3.3: Use morphological closing operation to connect the edge contour line. Use a 5×5 convolution kernel to dilate and then erode the above-mentioned edge contour line to connect the gaps and form a complete edge contour line; Step S3.4: Fit the contour edge curve based on the Random Sample Consensus (RANSAC) method. Randomly select K points from the edge point set, fit a curve to the K points, calculate the distances from other points in the point set to the fitted curve, and set a certain threshold. If the distance is greater than the threshold, the point is called an outlier and is discarded; if it is less than the threshold, it is an inlier, and the number of inliers is counted. Then, based on the new inliers, perform curve fitting iteratively again. Finally, select the fitted curve with the largest number of inliers. At this time, the curve is the optimal fitted curve, and the inner and outer edge contours of the fitting groove of the assembly are obtained.
Citation Information
Patent Citations
Symmetry image symmetric axis detection positioning method
CN105184830A
Detection method for symmetry axis of image
CN105825528A
Image Symmetry Axis Detection Method Based on Edge Line Matching
CN106780528B
Deep sea net cage netting detection method based on image processing algorithm
CN116228757A