Method for extracting rectangular recess features in three-dimensional point cloud
By converting the three-dimensional point cloud into a two-dimensional grayscale map and using image processing technology, the complex and time-consuming operation of rectangular depression feature extraction in the three-dimensional point cloud is solved, and efficient and accurate rectangular depression feature extraction is achieved, suitable for ultrasonic wave Press-welded workpieces and other fields.
Patent Information
- Application Number
- CN202410977374.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-19
- Publication Date
- 2024-11-15
AI Technical Summary
The existing three-dimensional point cloud has the problem of complex operation, long-term operation, and insufficient recognition ability of rotation angles and shapes of different scales.
By converting three-dimensional point clouds into two-dimensional grayscale maps, rotation correction and cropping are performed, combined with image processing technologies such as Gaussian blur, morphological operation and filtering and noise reduction, the rectangular depression features are automatically extracted, simplified rotation and cropping operations, and removed noise. and outliers.
It improves the efficiency and accuracy of rectangular depression feature extraction, simplifies the operation process, is widely applicable, and can automatically extract the areas of interest without artificially setting parameters.
Smart Images

Figure CN118967593A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a method for extracting rectangular concave features, in particular to a method for extracting rectangular concave features in a three-dimensional point cloud, and belongs to the technical field of point cloud processing. Background Art
[0002] Point cloud is a commonly used representation of 3D data, which consists of a large number of discrete points, each of which contains information such as position and color. Point cloud can be acquired by various sensors, such as laser scanners, structured light cameras, stereo cameras, etc. Point cloud has a wide range of applications in many fields, such as 3D reconstruction, object recognition, scene understanding, etc.
[0003] The processing and analysis of point cloud data is crucial for understanding three-dimensional spatial information. In the process of point cloud processing, it is often necessary to extract certain features from large-scale point cloud data for subsequent analysis and processing. In the study of ultrasonic welding workpieces, the ability to accurately extract the features of rectangular concave areas can not only improve the efficiency of workpiece quality assessment, but also provide important technical support for the development of automated detection systems.
[0004] At present, there are some methods for extracting rectangular concave features in point clouds, such as through filtering, region growing, clustering segmentation, etc. However, these methods have some defects and shortcomings, such as:
[0005] Through filtering is a simple method that defines a voxel box of a cube or a cuboid, retains only the point cloud data within the box, and filters out the data outside the box. This method can quickly reduce the amount of point cloud data, but it requires manual setting of the position and size of the voxel box, and cannot effectively extract the area of interest with a rotation angle.
[0006] Region growing is a method based on neighborhood relationships. It starts from one or more seed points and gradually classifies adjacent points into the same region according to certain criteria until the stopping condition is met. This method can extract regions with certain connectivity and similarity, but it requires pre-calculation of features such as the normal vector and curvature of the point cloud, and is prone to over-segmentation or under-segmentation problems for point clouds with noise and outliers.
[0007] Cluster segmentation is a distance or density-based method that divides the point cloud into several clusters so that the distance or density between points in the same cluster is less than a given threshold, while the distance or density between different clusters is greater than a given threshold. This method can extract regions with a certain degree of compactness and separation, but it requires artificially setting the distance or density threshold, and cannot effectively distinguish regions of interest with different scales and shapes.
[0008] Therefore, for the rectangular concave feature extraction technology of three-dimensional point clouds, it is still necessary to propose a rectangular concave feature extraction method of point clouds that is simple to operate and short in time. Summary of the invention
[0009] The technical problem to be solved by the present invention is to provide a method for extracting rectangular concave features in a three-dimensional point cloud, which is simple to operate and takes little time.
[0010] In order to solve the above technical problems, the technical solution adopted by the present invention is:
[0011] A method for extracting rectangular concave features in a three-dimensional point cloud comprises the following steps:
[0012] S1, obtaining a three-dimensional point cloud of a workpiece having a rectangular concave area feature through a collection device;
[0013] S2, corresponding different height values of the three-dimensional point cloud to corresponding grayscale values, thereby converting the three-dimensional point cloud into a two-dimensional grayscale image;
[0014] S3, performing rotation correction on the two-dimensional grayscale image so that the long side and the short side of the target rectangular concave area are distributed in the horizontal and vertical directions respectively;
[0015] S4, according to the rotation center and the rotation angle and the vertex coordinates of the minimum circumscribed rectangle, after scaling and converting the two-dimensional vertex coordinates of the two-dimensional grayscale image into coordinates in the three-dimensional point cloud coordinate system, rotating and cropping the original three-dimensional point cloud, and extracting the initial rectangular concave features from the original three-dimensional point cloud;
[0016] S5. Filter and reduce noise on the initial three-dimensional point cloud of the rectangular concave feature to remove the interference of outliers, obtain a smooth rectangular concave feature, and complete the extraction of the rectangular concave feature in the three-dimensional point cloud.
[0017] Furthermore, in step S1, the acquisition device is a laser scanner, a structured light camera or a stereo camera.
[0018] Furthermore, in the step S1, the workpiece having the rectangular recessed area feature is an ultrasonic pressure welding workpiece.
[0019] Furthermore, the step S2 is specifically:
[0020] 2.1. Traverse each point in the three-dimensional point cloud and obtain the height value of each point, that is, the coordinate value of the z-axis in the three-dimensional coordinates of each point;
[0021] 2.2. Normalize the height value of each point to the interval [0,1], that is, subtract the minimum height value of all points in the 3D point cloud from the height value of each point, and then divide it by the difference between the maximum height value and the minimum height value of all points in the 3D point cloud;
[0022] 2.3. Multiply the normalized height value by 255 to get the corresponding grayscale value, which is an integer in the interval [0,255].
[0023] 2.4. According to the x-axis and y-axis coordinate values of each point, its corresponding grayscale value is assigned to the corresponding pixel of the two-dimensional grayscale image, thereby obtaining a two-dimensional grayscale image.
[0024] Furthermore, the step S3 is specifically:
[0025] 3.1. Perform Gaussian blurring noise reduction on the two-dimensional grayscale image. Use a Gaussian filter to smooth the two-dimensional grayscale image and remove noise and unclear features in the two-dimensional grayscale image.
[0026] 3.2. Binarize the two-dimensional grayscale image after Gaussian blur denoising, and segment the two-dimensional grayscale image using the adaptive threshold method to obtain a binary image, in which white pixels represent the rectangular concave area of interest and black pixels represent the background;
[0027] 3.3. Perform morphological operations on the binary image. The structural element of the morphological operation is a 5×5 square. Use dilation and erosion operations to close the binary image to fill the holes in the rectangular concave features and eliminate the small holes in the background.
[0028] 3.4. Perform contour detection on the binary image after morphological operation. Use the Canny operator to perform edge detection on the binary image. Then use the findContours function to find all contours in the binary image. According to the size of the contour, select the contour with the largest area. The contour with the largest area is the outer contour of the target rectangular concave area.
[0029] 3.5. Obtain the rotation center and rotation angle of the minimum circumscribed rectangle of the outer contour of the target rectangular concave area, and use the minAreaRect function to calculate the four vertex coordinates, rotation center and rotation angle of the minimum circumscribed rectangle of the outer contour;
[0030] 3.6. Calculate the rotation matrix and use the getRotationMatrix2D function to generate the rotation matrix based on the rotation center and rotation angle of the minimum circumscribed rectangle of the outer contour. The rotation matrix is:
[0031]
[0032] Among them, θ is the rotation angle of the minimum circumscribed rectangle of the external contour;
[0033] 3.7. Perform rotation correction on the two-dimensional grayscale image according to the rotation matrix. Use the warpAffine function to perform affine transformation on the two-dimensional grayscale image according to the rotation matrix to obtain a two-dimensional grayscale image after rotation correction. The long and short sides of the target rectangular concave area in the two-dimensional grayscale image after rotation correction are distributed in the horizontal and vertical directions, respectively.
[0034] Furthermore, the kernel size of the Gaussian filter in step 3.1 is 5×5.
[0035] Furthermore, in step 3.4, the low threshold of the Canny operator is 50, and the high threshold is 150.
[0036] Furthermore, the step S4 is specifically as follows:
[0037] 4.1. According to the rotation center and rotation angle of the minimum circumscribed rectangle of the outer contour of the target rectangular concave area, the rotation matrix of the three-dimensional point cloud is calculated, and the original three-dimensional point cloud is firstly subjected to rotation correction;
[0038] 4.2. According to the size ratio of the 2D grayscale image and the 3D point cloud, calculate the scaling factor from the 2D coordinates of the 2D grayscale image to the 3D coordinates of the 3D point cloud. The scaling factor is used to convert the pixel unit of the 2D coordinates into the actual unit of the 3D coordinates. The scaling factor satisfies:
[0039]
[0040] Among them, L x and L y are the width and height of the two-dimensional grayscale image, W x and W y They are the ranges of the x-axis and y-axis of the three-dimensional point cloud respectively;
[0041] 4.3. According to the vertex coordinates of the minimum circumscribed rectangle of the outer contour of the target rectangular concave area, the two-dimensional coordinates of the two-dimensional grayscale image are scaled using the scaling factor to calculate the clipping range of the three-dimensional point cloud, that is, the corresponding rectangular concave area of the minimum circumscribed rectangle in the three-dimensional point cloud coordinate system. The corresponding rectangular concave area is determined by the coordinates of four vertices, namely, the upper left vertex, the upper right vertex, the lower left vertex, and the lower right vertex;
[0042] 4.4. Crop the rotationally corrected 3D point cloud and retain only the 3D point cloud data within the minimum circumscribed rectangle to obtain the initial point cloud of the rectangular concave feature.
[0043] Furthermore, the step S5 is specifically as follows:
[0044] 5.1. Perform statistical filtering on the point cloud of the initial rectangular concave feature. Use the StatisticalOutlierRemoval filter to calculate the average distance and standard deviation of the neighborhood of each point in the point cloud of the initial rectangular concave feature. If the distance of a point is greater than the average distance plus a multiple of the standard deviation, the point is considered to be an outlier and is filtered out.
[0045] 5.2. Downsample the smoothed point cloud of the rectangular concave feature, and use the VoxelGrid filter to voxelize the point cloud of the rectangular concave feature to reduce the data volume of the point cloud of the rectangular concave feature, and obtain the final point cloud of the rectangular concave feature.
[0046] Furthermore, in step 5.1, the number of neighborhood points of the StatisticalOutlierRemoval filter is 50, and the multiple of the standard deviation is 1; and the voxel size of the VoxelGrid filter in step 5.2 is 0.05.
[0047] Compared with the prior art, the present invention has the following advantages and effects: the present invention converts a three-dimensional point cloud into a two-dimensional grayscale image, and uses an image processing method to perform rotation correction and rectangular concave feature cropping, thereby simplifying the rotation and cropping operations on the point cloud and improving the efficiency and accuracy of rectangular concave feature extraction; the present invention removes the interference of noise and outliers in the point cloud by filtering, denoising and smoothing the point cloud, thereby improving the quality and smoothness of the point cloud; the present invention does not require manual setting of parameters, only needs to input the original point cloud, and can automatically extract the rectangular concave area of interest, which is easy to operate and has wide applicability. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] Figure 1 It is a flow chart of a method for extracting rectangular concave features in a three-dimensional point cloud according to the present invention.
[0049] Figure 2 Schematic diagram of an original three-dimensional point cloud according to an embodiment of the present invention.
[0050] Figure 3 Schematic diagram of a two-dimensional grayscale image of an original three-dimensional point cloud according to an embodiment of the present invention.
[0051] Figure 4 Schematic diagram of a two-dimensional grayscale image subjected to Gaussian blur noise reduction according to an embodiment of the present invention.
[0052] Figure 5 Schematic diagram of a binary image after binarization according to an embodiment of the present invention.
[0053] Figure 6 Schematic diagram of a binary image after morphological operation according to an embodiment of the present invention.
[0054] Figure 7 is a schematic diagram of a two-dimensional grayscale image after contour detection according to an embodiment of the present invention.
[0055] Figure 8 is a schematic diagram of a two-dimensional grayscale image after rotation correction according to an embodiment of the present invention.
[0056] Fig. 9 is a schematic diagram of a rotated and cropped three-dimensional point cloud according to an embodiment of the present invention.
[0057] Fig.10 is a schematic diagram of a three-dimensional point cloud after filtering and denoising according to an embodiment of the present invention. DETAILED DESCRIPTION
[0058] In order to elaborate on the technical scheme adopted by the present invention to achieve the predetermined technical purpose, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only partial embodiments of the present invention, rather than all embodiments, and the technical means or technical features in the embodiments of the present invention can be replaced without paying creative work. The present invention will be described in detail below with reference to the drawings and in conjunction with the embodiments.
[0059] like Figure 1 As shown, a method for extracting rectangular concave features in a three-dimensional point cloud of the present invention comprises the following steps:
[0060] S1, such as Figure 2 As shown, a three-dimensional point cloud of a workpiece having a rectangular recessed area feature is acquired by a collection device.
[0061] The acquisition device is a laser scanner, a structured light camera or a stereo camera.
[0062] The workpiece with the rectangular concave area feature is an ultrasonic pressure welding workpiece.
[0063] S2. Correspond different height values of the three-dimensional point cloud to corresponding grayscale values, thereby converting the three-dimensional point cloud into a two-dimensional grayscale image. Figure 3 As shown, the rectangular bonding area presents a higher gray value on the two-dimensional grayscale image, while other areas present a lower gray value.
[0064] 2.1. Traverse each point in the three-dimensional point cloud and obtain the height value of each point, that is, the coordinate value of the z-axis in the three-dimensional coordinates of each point.
[0065] 2.2. Normalize the height value of each point to the interval [0,1], that is, subtract the minimum height value of all points in the 3D point cloud from the height value of each point, and then divide it by the difference between the maximum height value and the minimum height value of all points in the 3D point cloud.
[0066] 2.3. Multiply the normalized height value by 255 to get the corresponding grayscale value, which is an integer in the interval [0,255].
[0067] 2.4. According to the x-axis and y-axis coordinate values of each point, its corresponding grayscale value is assigned to the corresponding pixel of the two-dimensional grayscale image, thereby obtaining a two-dimensional grayscale image.
[0068] S3. Rotate and correct the two-dimensional grayscale image so that the long side and the short side of the target rectangular concave area are distributed in the horizontal and vertical directions respectively.
[0069] 3.1, such as Figure 4 As shown, Gaussian blurring is used to reduce noise on the two-dimensional grayscale image, and a Gaussian filter is used to smooth the two-dimensional grayscale image. The kernel size of the Gaussian filter is 5×5, and the noise and unclear features in the two-dimensional grayscale image are removed.
[0070] 3.2, such as Figure 5 As shown, the two-dimensional grayscale image after Gaussian blur denoising is binarized, and the two-dimensional grayscale image is segmented using an adaptive threshold method to obtain a binary image, in which white pixels represent rectangular concave areas of interest and black pixels represent backgrounds.
[0071] 3.3, such as Figure 6 As shown, a morphological operation is performed on the binary image. The structural element of the morphological operation is a 5×5 square. The binary image is closed using dilation and erosion operations to fill the holes in the rectangular concave features and eliminate the small holes in the background.
[0072] 3.4, such as Figure 7 As shown in the figure, contour detection is performed on the binary image after morphological operation, and the Canny operator is used to perform edge detection on the binary image. The low threshold of the Canny operator is 50 and the high threshold is 150. Then the findContours function is used to find all the contours in the binary image. According to the area size of the contour, the contour with the largest area is screened out. The contour with the largest area is the outer contour of the target rectangular concave area.
[0073] 3.5. Obtain the rotation center and rotation angle of the minimum circumscribed rectangle of the outer contour of the target rectangular concave area, and use the minAreaRect function to calculate the four vertex coordinates, rotation center and rotation angle of the minimum circumscribed rectangle of the outer contour.
[0074] 3.6. Calculate the rotation matrix and use the getRotationMatrix2D function to generate the rotation matrix based on the rotation center and rotation angle of the minimum circumscribed rectangle of the outer contour. The rotation matrix is:
[0075]
[0076] Among them, θ is the rotation angle of the minimum circumscribed rectangle of the outer contour.
[0077] 3.7, such as Figure 8 As shown, the two-dimensional grayscale image is rotationally corrected according to the rotation matrix, and the warpAffine function is used to perform affine transformation on the two-dimensional grayscale image according to the rotation matrix to obtain a two-dimensional grayscale image after rotation correction. The long side and short side of the target rectangular concave area in the two-dimensional grayscale image after rotation correction are distributed in the horizontal and vertical directions, respectively.
[0078] S4. According to the rotation center, rotation angle and vertex coordinates of the minimum circumscribed rectangle, the two-dimensional vertex coordinates of the two-dimensional grayscale image are scaled and converted into coordinates in the three-dimensional point cloud coordinate system, and then the original three-dimensional point cloud is rotated and cropped to extract the initial rectangular concave features from the original three-dimensional point cloud.
[0079] 4.1. According to the rotation center and rotation angle of the minimum circumscribed rectangle of the outer contour of the target rectangular concave area, the rotation matrix of the three-dimensional point cloud is calculated, and the original three-dimensional point cloud is firstly subjected to rotation correction.
[0080] 4.2. According to the size ratio of the 2D grayscale image and the 3D point cloud, calculate the scaling factor from the 2D coordinates of the 2D grayscale image to the 3D coordinates of the 3D point cloud. The scaling factor is used to convert the pixel unit of the 2D coordinates into the actual unit of the 3D coordinates. The scaling factor satisfies:
[0081]
[0082] Among them, L x and L y are the width and height of the two-dimensional grayscale image, W x and W y They are the ranges of the x-axis and y-axis of the 3D point cloud respectively.
[0083] 4.3. According to the vertex coordinates of the minimum circumscribed rectangle of the outer contour of the target rectangular concave area, the two-dimensional coordinates of the two-dimensional grayscale image are scaled using the scaling factor to calculate the clipping range of the three-dimensional point cloud, that is, the corresponding rectangular concave area of the minimum circumscribed rectangle in the three-dimensional point cloud coordinate system. The corresponding rectangular concave area is determined by the coordinates of four vertices, namely, the upper left vertex, the upper right vertex, the lower left vertex, and the lower right vertex.
[0084] 4.4. Crop the rotation-corrected 3D point cloud and only keep the 3D point cloud data within the minimum bounding rectangle to obtain the initial point cloud of the rectangular concave feature. Fig. 9It can be seen that the point cloud of the rectangular welding area has been successfully extracted, and the point clouds in other areas have been filtered out. However, there are still many outliers in the point cloud at this time, which affects the quality of the point cloud.
[0085] S5. Filter and reduce noise on the initial three-dimensional point cloud of the rectangular concave feature to remove the interference of outliers, obtain a smooth rectangular concave feature, and complete the extraction of the rectangular concave feature in the three-dimensional point cloud.
[0086] 5.1. Perform statistical filtering on the point cloud of the initial rectangular concave feature. Use the StatisticalOutlierRemoval filter to calculate the average distance and standard deviation of the neighborhood of each point in the point cloud of the initial rectangular concave feature. If the distance of a point is greater than the average distance plus a multiple of the standard deviation, the point is considered to be an outlier and is filtered out. The number of neighborhood points of the StatisticalOutlierRemoval filter is 50, and the multiple of the standard deviation is 1.
[0087] 5.2. Downsample the smoothed point cloud of the rectangular concave feature, and use the VoxelGrid filter to voxelize the point cloud of the rectangular concave feature to reduce the data volume of the point cloud of the rectangular concave feature, and obtain the final point cloud of the rectangular concave feature. The voxel size of the VoxelGrid filter is 0.05. Fig.10 It can be seen that the target rectangular concave features have been successfully obtained, with fewer noise points, clear point cloud boundaries and smaller point cloud data volume, which is more conducive to subsequent point cloud processing.
[0088] The present invention converts a three-dimensional point cloud into a two-dimensional grayscale image, and uses an image processing method to perform rotation correction and rectangular concave feature cropping, thereby simplifying the rotation and cropping operations on the point cloud and improving the efficiency and accuracy of rectangular concave feature extraction; the present invention removes noise and outlier interference in the point cloud by filtering, denoising and smoothing the point cloud, thereby improving the quality and smoothness of the point cloud; the present invention does not require manual setting of parameters, only needs to input the original point cloud, and can automatically extract the rectangular concave area of interest, and is easy to operate and has wide applicability.
[0089] The above is only a preferred embodiment of the present invention and does not limit the present invention in any form. Although the present invention has been disclosed as a preferred embodiment as above, it is not used to limit the present invention. Any technician familiar with this profession can make some changes or modify the technical contents disclosed above into equivalent embodiments without departing from the scope of the technical solution of the present invention. However, any simple modification, equivalent replacement and improvement made to the above embodiments without departing from the content of the technical solution of the present invention, based on the technical essence of the present invention, within the spirit and principles of the present invention, still fall within the protection scope of the technical solution of the present invention.
Claims
1. A method for extracting rectangular concave features in a three-dimensional point cloud, characterized in that The following steps are involved: S1, obtaining a three-dimensional point cloud of a workpiece having a rectangular concave area feature through a collection device; S2, corresponding different height values of the three-dimensional point cloud to corresponding grayscale values, thereby converting the three-dimensional point cloud into a two-dimensional grayscale image; S3, performing rotation correction on the two-dimensional grayscale image so that the long side and the short side of the target rectangular concave area are distributed in the horizontal and vertical directions respectively; S4, according to the rotation center and the rotation angle and the vertex coordinates of the minimum circumscribed rectangle, after scaling and converting the two-dimensional vertex coordinates of the two-dimensional grayscale image into coordinates in the three-dimensional point cloud coordinate system, rotating and cropping the original three-dimensional point cloud, and extracting the initial rectangular concave features from the original three-dimensional point cloud; S5. Filter and reduce noise on the initial three-dimensional point cloud of the rectangular concave feature to remove the interference of outliers, obtain a smooth rectangular concave feature, and complete the extraction of the rectangular concave feature in the three-dimensional point cloud.
2. The method for extracting rectangular concave features in a three-dimensional point cloud according to claim 1, characterized in that: In step S1, the acquisition device is a laser scanner, a structured light camera or a stereo camera.
3. The method for extracting rectangular concave features in a three-dimensional point cloud according to claim 1, characterized in that: In the step S1, the workpiece having the rectangular recessed area feature is an ultrasonic pressure welding workpiece.
4. The method for extracting rectangular concave features in a three-dimensional point cloud according to claim 1, characterized in that: The step S2 specifically comprises: 2.
1. Traverse each point in the three-dimensional point cloud and obtain the height value of each point, that is, the coordinate value of the z-axis in the three-dimensional coordinates of each point; 2.
2. Normalize the height value of each point to the interval [0,1], that is, subtract the minimum height value of all points in the 3D point cloud from the height value of each point, and then divide it by the difference between the maximum height value and the minimum height value of all points in the 3D point cloud; 2.
3. Multiply the normalized height value by 255 to get the corresponding grayscale value, which is an integer in the interval [0,255]. 2.
4. According to the x-axis and y-axis coordinate values of each point, its corresponding grayscale value is assigned to the corresponding pixel of the two-dimensional grayscale image, thereby obtaining a two-dimensional grayscale image.
5. The method for extracting rectangular concave features in a three-dimensional point cloud according to claim 1, characterized in that: The step S3 is specifically as follows: 3.
1. Perform Gaussian blurring noise reduction on the two-dimensional grayscale image. Use a Gaussian filter to smooth the two-dimensional grayscale image and remove noise and unclear features in the two-dimensional grayscale image. 3.
2. Binarize the two-dimensional grayscale image after Gaussian blur denoising, and segment the two-dimensional grayscale image using the adaptive threshold method to obtain a binary image, in which white pixels represent the rectangular concave area of interest and black pixels represent the background; 3.
3. Perform morphological operations on the binary image. The structural element of the morphological operation is a 5×5 square. Use dilation and erosion operations to close the binary image to fill the holes in the rectangular concave features and eliminate the small holes in the background. 3.
4. Perform contour detection on the binary image after morphological operation. Use the Canny operator to perform edge detection on the binary image. Then use the findContours function to find all contours in the binary image. According to the size of the contour, select the contour with the largest area. The contour with the largest area is the outer contour of the target rectangular concave area. 3.
5. Obtain the rotation center and rotation angle of the minimum circumscribed rectangle of the outer contour of the target rectangular concave area, and use the minAreaRect function to calculate the four vertex coordinates, rotation center and rotation angle of the minimum circumscribed rectangle of the outer contour; 3.
6. Calculate the rotation matrix and use the getRotationMatrix2D function to generate the rotation matrix based on the rotation center and rotation angle of the minimum circumscribed rectangle of the outer contour. The rotation matrix is: Among them, θ is the rotation angle of the minimum circumscribed rectangle of the external contour; 3.
7. Perform rotation correction on the two-dimensional grayscale image according to the rotation matrix. Use the warpAffine function to perform affine transformation on the two-dimensional grayscale image according to the rotation matrix to obtain a two-dimensional grayscale image after rotation correction. The long and short sides of the target rectangular concave area in the two-dimensional grayscale image after rotation correction are distributed in the horizontal and vertical directions, respectively.
6. The method for extracting rectangular concave features in a three-dimensional point cloud according to claim 5, characterized in that: The kernel size of the Gaussian filter in step 3.1 is 5×5.
7. The method for extracting rectangular concave features in a three-dimensional point cloud according to claim 5, characterized in that: In step 3.4, the low threshold of the Canny operator is 50, and the high threshold is 150.
8. The method for extracting rectangular concave features in a three-dimensional point cloud according to claim 1, characterized in that: The step S4 is specifically as follows: 4.
1. According to the rotation center and rotation angle of the minimum circumscribed rectangle of the outer contour of the target rectangular concave area, the rotation matrix of the three-dimensional point cloud is calculated, and the original three-dimensional point cloud is firstly subjected to rotation correction; 4.
2. According to the size ratio of the 2D grayscale image and the 3D point cloud, calculate the scaling factor from the 2D coordinates of the 2D grayscale image to the 3D coordinates of the 3D point cloud. The scaling factor is used to convert the pixel unit of the 2D coordinates into the actual unit of the 3D coordinates. The scaling factor satisfies: Among them, L x and L y are the width and height of the two-dimensional grayscale image, W x and W y They are the ranges of the x-axis and y-axis of the three-dimensional point cloud respectively; 4.
3. According to the vertex coordinates of the minimum circumscribed rectangle of the outer contour of the target rectangular concave area, the two-dimensional coordinates of the two-dimensional grayscale image are scaled using the scaling factor to calculate the clipping range of the three-dimensional point cloud, that is, the corresponding rectangular concave area of the minimum circumscribed rectangle in the three-dimensional point cloud coordinate system. The corresponding rectangular concave area is determined by the coordinates of four vertices, namely, the upper left vertex, the upper right vertex, the lower left vertex, and the lower right vertex; 4.
4. Crop the rotationally corrected 3D point cloud and retain only the 3D point cloud data within the minimum circumscribed rectangle to obtain the initial point cloud of the rectangular concave feature.
9. The method for extracting rectangular concave features in a three-dimensional point cloud according to claim 1, characterized in that: The step S5 is specifically as follows: 5.
1. Perform statistical filtering on the point cloud of the initial rectangular concave feature. Use the StatisticalOutlierRemoval filter to calculate the average distance and standard deviation of the neighborhood of each point in the point cloud of the initial rectangular concave feature. If the distance of a point is greater than the average distance plus a multiple of the standard deviation, the point is considered to be an outlier and is filtered out. 5.
2. Downsample the smoothed point cloud of the rectangular concave feature, and use the VoxelGrid filter to voxelize the point cloud of the rectangular concave feature to reduce the data volume of the point cloud of the rectangular concave feature, and obtain the final point cloud of the rectangular concave feature.
10. The method for extracting rectangular concave features in a three-dimensional point cloud according to claim 9, characterized in that: The number of neighborhood points of the StatisticalOutlierRemoval filter in step 5.1 is 50, and the multiple of the standard deviation is 1; the voxel size of the VoxelGrid filter in step 5.2 is 0.05.
Citation Information
Patent Citations
Coplanarity detection method based on three-dimensional point cloud and two-dimensional image fusion
CN113240674A
Medicine box segmentation method
CN114092499A
Metal workpiece damage area three-dimensional contour detection method and application thereof
CN116883324A
Automatic point cloud orientation method and device based on computer vision and storage medium
CN117495969A
Method and apparatus for measuring remaining volume in closed space on basis of laser radar
WO2021197345A1
