Plane polygon point cloud integrated processing and edge size calculation method based on PCL library

Through the integrated processing method of planar polygon point cloud based on PCL library, using normal vector correction and RANSAC algorithm and other technologies, the problem of point cloud processing complexity and data compatibility is solved, and automated point cloud edge size calculation is realized, and processing is improved. Efficiency and accuracy.

CN119068037APending Publication Date: 2024-12-03CHONGQING UNIVERSITY OF SCIENCE AND TECHNOLOGY
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202411107193.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-13
Publication Date
2024-12-03

AI Technical Summary

Technical Problem

The prior art lacks automated means and a unified processing framework in point cloud processing and size calculation, resulting in complex processing processes, high time costs and prone to problems such as data format incompatibility and data loss.

Method used

The integrated processing method of planar polygon point cloud based on PCL library is adopted, and edge dimensions are calculated through normal vector coordinate correction, segmentation and culling, boundary estimation, RANSAC algorithm fits straight lines and convex hull algorithms, and integrates reading, preprocessing, segmentation, and method Vector calculation and automatic dimensional calculation steps simplify processing flow and improve accuracy.

Benefits of technology

The automated processing of point cloud data is realized, manual operation steps are reduced, work efficiency and accuracy of edge size calculations are improved, manual intervention and human errors are reduced, and processing automation level is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119068037A_ABST
    Figure CN119068037A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of point cloud data processing, in particular to a planar polygon point cloud integrated processing and edge size calculation method based on a PCL library, which integrates the steps of point cloud data reading, preprocessing, segmentation, normal vector calculation, boundary extraction, automatic size calculation and the like in a unified processing framework. The point cloud processing flow is simplified, a user can complete a complex point cloud processing task only by running one program, manual operation steps are reduced, and the working efficiency is improved; besides, the automatic edge point extraction and size calculation technology can quickly and accurately calculate the size of each point cloud edge, the accuracy and automation level of point cloud edge size calculation are greatly improved, and manual intervention and human errors are reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of point cloud data processing, and in particular to a method for integrated processing of planar polygonal point clouds and edge size calculation based on a PCL library. Background Art

[0002] Point cloud, as the output result of 3D scanning technology, consists of a large number of discrete points, each with a certain 3D coordinate (x, y, z). These points together describe the surface features of the object and represent the detailed 3D information of the scanned object. Point cloud data can be further used for modeling, analysis, measurement, and visualization. 3D scanning technology has been widely used in the size calculation and simulated pre-assembly of buildings or prefabricated components, and the more regular polygonal point clouds usually appear on the facades or planes of these building point cloud models. If you want to make a detailed measurement, you need to crop the facade or plane point cloud separately and save the file separately.

[0003] For these relatively regular polygonal point clouds, it is usually necessary to perform a series of preprocessing on the original point cloud data (such as filtering, segmentation, normal vector calculation, edge point extraction, etc.) before subsequent point cloud analysis can be performed. These technologies usually require multiple independent tools and steps to complete, and manual operations are cumbersome and the process is scattered. When a large amount of point cloud data needs to be processed, the accuracy of manual processing is often not guaranteed, which undoubtedly increases the complexity and time cost of the operation, and cannot take into account both processing speed and accuracy. The existing software uses the method of arbitrary point selection or box selection in extremely dense point clouds for measurement. If the selected area is slightly different, the measurement result will be large or small, resulting in low accuracy of the calculation result.

[0004] In summary, in terms of the overall efficiency of point cloud processing and size calculation, the existing technology lacks automated means and a unified processing framework. Different point cloud processing steps are usually completed by different software tools, and these tools have different point cloud format requirements and compatibility, resulting in complicated file flow of point cloud data during the processing process, further increasing time costs, and data format incompatibility and data loss are prone to occur during the processing process. Summary of the invention

[0005] The purpose of the present invention is to provide a method for integrated processing of planar polygonal point clouds and edge size calculation based on the PCL library, aiming to solve the technical problems in the prior art in terms of the overall efficiency of point cloud processing and size calculation, the complicated file flow of point cloud data during the processing process, further increasing the time cost, and the easy occurrence of data format incompatibility and data loss during the processing process.

[0006] To achieve the above-mentioned purpose, the present invention adopts a method for integrated processing of planar polygon point clouds and edge size calculation based on PCL library, comprising: performing coordinate correction on the point cloud based on the normal vector;

[0007] After correcting the point cloud coordinates, it is necessary to segment and eliminate the points that are not on the plane;

[0008] Repeat the coordinate correction process to ensure the accuracy of the correction and retain the normal vector of the current point cloud;

[0009] Use the "BoundaryEstimation" function in the PCL library to estimate the boundary, use the retained normal vector to set the neighborhood search method and the number of neighborhood points, traverse the boundary estimation results, and finally save the point cloud of the boundary to complete the integrated processing of the plane polygon point cloud based on the PCL library;

[0010] Using the edge point cloud obtained by the integrated processing of the plane polygon point cloud based on the PCL library, all points are projected to the XY plane so that all points are in a two-dimensional plane;

[0011] Divide the edges of the projected point cloud into multiple separate point clouds;

[0012] After the segmentation is completed, a vector `lineEndpoints` is defined to save the endpoint coordinates of all lines, and the previously saved multiple segmented point cloud edge files are read in sequence through a loop, and the RANSAC algorithm is used to fit each line;

[0013] Read the saved coordinates of the line endpoints again, use the intersection algorithm to find all intersection points, and use the convex hull algorithm to enclose these intersection points into a closed polygon. The polygon can be considered as a fitting figure of the polygon point cloud border, and the size calculation results of each edge are directly visualized on the corresponding edge, thus completing the calculation of the size of all edges of the polygon point cloud.

[0014] Among them, the specific method of coordinate correction of point cloud based on normal vector is: calculate the normal vector of point cloud through normol function in PCL library, perform cluster analysis based on the normal vector of each point to find the target point cloud plane, calculate the normal vector of the plane again after finding the plane, and then use the vector comparison function in PCL library to calculate the angle to be rotated, and use this rotation angle to drive the overall rotation of point cloud to achieve point cloud correction.

[0015] Among them, after the point cloud coordinates are corrected, the specific method for segmenting and eliminating points that are not on the plane is: calculate the normal vector of the corrected point cloud again, set a threshold for the normal vector corresponding to each point, and then the point cloud with the normal vector in the z+ direction can be screened. The point cloud on the non-plane will be quickly eliminated and the coplanar point cloud will be retained.

[0016] The specific method of segmenting the edge of the projected point cloud into multiple separate point clouds is as follows: first, use the creation and setting execution algorithm object in PCL, set the model type to line (`pcl::SACMODEL_LINE`) and select the RANSAC method, such as random sampling consensus (`pcl::SAC_RANSAC`);

[0017] Then, the point cloud data is used as input, and a distance threshold (`0.003`) is set to determine the tolerance of the inliers. By performing a segmentation operation, the algorithm uses RANSAC to fit a straight line model in the point cloud, extracts the index of the points on the fitted line (i.e., the inliers), and stores the parameters of the fitted line.

[0018] This process ensures that each edge of the polygonal point cloud box is segmented from the point cloud for subsequent processing and saving;

[0019] Finally, the edges of the polygonal point cloud are split into multiple separate point clouds.

[0020] After the segmentation is completed, a vector `lineEndpoints` is defined to save the endpoint coordinates of all lines; the specific method of fitting each line using the RANSAC algorithm is as follows:

[0021] For each straight line, obtain and save its endpoint coordinates, calculate and standardize the straight line vector, and extend both ends of the straight line by 0.2 meters to create intersections between adjacent straight lines;

[0022] Then, the original point cloud and all the fitted straight lines are added to the visualization window, and each straight line is distinguished by different colors;

[0023] Save the coordinates of the extended line endpoints to a text file and display the results in a visualization window.

[0024] The present invention is a method for integrated processing and edge size calculation of planar polygonal point clouds based on the PCL library. The present invention integrates the steps of point cloud data reading, preprocessing, segmentation, normal vector calculation, boundary extraction and automatic size calculation into a unified processing framework, which simplifies the point cloud processing process. Users only need to run one program to complete complex point cloud processing tasks, reduce manual operation steps, and improve work efficiency. In addition, the automated edge point extraction and size calculation technology can quickly and accurately calculate the size of each point cloud edge, greatly improving the accuracy and automation level of point cloud edge size calculation, and reducing manual intervention and human errors. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0026] Figure 1 It is a flow chart of the steps of the PCL library-based planar polygon point cloud integrated processing and edge size calculation method of the present invention.

[0027] Figure 2 It is a schematic diagram of the coordinate changes before and after correction of the planar polygon point cloud integrated processing and edge size calculation method based on the PCL library of the present invention.

[0028] Figure 3 It is a schematic diagram of the automatic segmentation of polygon point cloud edges of the planar polygon point cloud integrated processing and edge size calculation method based on the PCL library of the present invention.

[0029] Figure 4 It is a schematic diagram of sequentially fitting the edges of polygonal point clouds of the integrated processing of planar polygonal point clouds and the edge size calculation method based on the PCL library of the present invention.

[0030] Figure 5 It is a schematic diagram of edge size display of the integrated processing of planar polygon point cloud and edge size calculation method based on PCL library of the present invention.

[0031] Figure 6 It is a schematic diagram of the polygon point cloud morphology change of the planar polygon point cloud integrated processing and edge size calculation method based on the PCL library of the present invention. DETAILED DESCRIPTION

[0032] Embodiments of the present invention are described in detail below. Examples of the embodiments are shown in the accompanying drawings. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present invention, but should not be construed as limiting the present invention.

[0033] See also Figures 1 to 6 , Figure 1 It is a flow chart of the steps of the method for integrated processing of planar polygon point cloud and calculation of edge size based on PCL library of the present invention. Figure 2 It is a schematic diagram of the coordinate changes before and after correction of the planar polygon point cloud integrated processing and edge size calculation method based on the PCL library of the present invention. Figure 3 It is a schematic diagram of the automatic segmentation of polygon point cloud edges of the planar polygon point cloud integrated processing and edge size calculation method based on the PCL library of the present invention. Figure 4It is a schematic diagram of polygon point cloud edge fitting in sequence of the planar polygon point cloud integrated processing and edge size calculation method based on PCL library of the present invention, Figure 5 It is a schematic diagram showing the edge size of the integrated processing of the plane polygon point cloud and the edge size calculation method based on the PCL library of the present invention. Figure 6 It is a schematic diagram of the polygon point cloud morphology change of the planar polygon point cloud integrated processing and edge size calculation method based on the PCL library of the present invention.

[0034] The present invention provides a method for integrated processing of planar polygon point clouds and edge size calculation based on a PCL library, comprising the following steps:

[0035] S101, initialization program;

[0036] For this specific implementation, based on the C++ programming language, preparation for point cloud data processing is performed, including setting parameters and initializing required variables and data structures;

[0037] S102, reading point cloud data file;

[0038] For this specific implementation, the point cloud data file to be processed is read from the PCD format file. The point cloud data is read using the pcl::io::loadPCDFile function of the PCL library through the specified file path. If the file does not exist, skip the current file and continue to process the next file.

[0039] S103, sorting and numbering of point cloud files;

[0040] According to this specific implementation, multiple point cloud files are sorted and numbered to ensure that each file is processed in sequence according to a specified order. The sorting and numbering are achieved by looping through a specified sequence number range (such as 1 to 10).

[0041] S104, first coordinate correction;

[0042] According to this specific implementation method, the first coordinate correction is performed on the point cloud data to make the surface of the point cloud to be measured substantially perpendicular to the Z axis; the specific method is:

[0043] Use the RANSAC algorithm (random sampling consistency) for plane segmentation; set the model type to plane, the method type to RANSAC, the maximum number of iterations to 1000, and the distance threshold to 0.01, where the distance threshold needs to be adjusted according to the actual density of the point cloud;

[0044] Extract the point cloud data in the plane and calculate the normal vector of the plane;

[0045] Generate a rotation matrix to rotate the point cloud data to align it vertically along the Z axis;

[0046] S105, calculating the point cloud normal vector and removing non-planar points;

[0047] For this specific implementation, the normal vector of the point cloud data is calculated by the NormalEstimation class of the PCL library; the specific steps are:

[0048] Create a normal vector estimation object;

[0049] Set the input point cloud data and search method (such as kd-tree);

[0050] Set the neighborhood search radius and calculate the normal vector of each point;

[0051] Filter the qualified point cloud data according to the Z-axis component of the normal vector and remove non-planar points and noise points;

[0052] S106, outlier removal;

[0053] For this specific implementation, a statistical outlier removal algorithm is used to filter the point cloud data to remove noise points; the specific steps are:

[0054] Create a statistical outlier removal object;

[0055] Set the input point cloud data, number of neighborhood points, and standard deviation multiplier threshold;

[0056] Perform filtering operations and output point cloud data after noise removal;

[0057] S107, second coordinate correction;

[0058] According to this specific implementation method, the filtered point cloud data is subjected to a second coordinate correction; the specific steps are:

[0059] Use the RANSAC algorithm again to perform plane segmentation and extract the point cloud data within the plane;

[0060] Calculate the normal vector of the plane and generate a rotation matrix to align the point cloud data to the Z axis again;

[0061] S108, extract edge points and project them to the XY plane;

[0062] For this specific implementation, edge points of the surface point cloud are extracted, and the point cloud data is projected onto the XY plane to facilitate subsequent edge size calculation; the specific steps are:

[0063] Use the BoundaryEstimation class of the PCL library to estimate the normal vector of the edge point; set the input point cloud data and normal vector, set the number of neighborhood search points, and calculate the boundary point;

[0064] Filter out edge points and set the Z coordinates of these points to 0 to achieve projection to the XY plane.

[0065] S109, using RANSAC to segment all edges of the edge point cloud;

[0066] For this specific implementation, the RANSAC algorithm is used to segment all edges of the edge point cloud, and each edge is processed in turn to extract straight line edge points; the specific steps are:

[0067] Create a RANSAC segmentation object, set the model type to straight line, the method type to RANSAC, and the distance threshold to 0.003;

[0068] Segment each side of the edge point cloud in turn to extract straight line edge points;

[0069] Perform straight line fitting on the extracted edge points and calculate the starting point and end point of the straight line;

[0070] S110, calculating and saving edge size;

[0071] According to this specific implementation, the extracted edge straight line is extended to calculate the edge size and find the length of all edges in the closed polygon; the specific steps are:

[0072] Calculate the starting point and end point of the straight line, and extend both ends of the straight line by 0.2 meters;

[0073] Save the coordinates of the endpoints of the extended straight line to a file, and calculate and save the size of the edge;

[0074] Calculate the intersection points of the saved adjacent straight lines, use the convex hull algorithm to enclose all the intersection points into polygons, export and store the polygon size and visualize it;

[0075] S111, loop processing and program end;

[0076] According to this specific implementation, it is determined whether the point cloud file currently being processed is the last file. If not, a loop is executed to automatically start processing the next point cloud file; if yes, the program ends.

[0077] Using the PCL library-based integrated processing and edge size calculation method of the plane polygon point cloud of this embodiment, the present invention integrates the steps of point cloud data reading, preprocessing, segmentation, normal vector calculation, boundary extraction and automatic size calculation into a unified processing framework, which simplifies the point cloud processing process. Users only need to run one program to complete complex point cloud processing tasks, reduce manual operation steps, and improve work efficiency. In addition, the automated edge point extraction and size calculation technology can quickly and accurately calculate the size of each point cloud edge, greatly improving the accuracy and automation level of point cloud edge size calculation, and reducing manual intervention and human errors.

[0078] At the same time, a corresponding visualization window is added to each processing and calculation step, which can intuitively capture the changes in the point cloud to determine whether the algorithm is correct. When calculating the size at the end, the design will display the calculation directly on the corresponding edge, making the measurement result more intuitive;

[0079] Secondly, in order to cope with the calculation of a large number of point cloud sizes, a loop processing program was designed. Before reading the file, each point cloud is traversed and numbered. After processing one point cloud, the calculation of the next point cloud is automatically started, maximizing the automation of the processing.

[0080] What is disclosed above is only a preferred embodiment of the present invention, and it certainly cannot be used to limit the scope of rights of the present invention. Ordinary technicians in this field can understand that all or part of the processes of the above embodiment and equivalent changes made according to the claims of the present invention still fall within the scope of the invention.

Claims

1. A method for integrated processing of planar polygonal point clouds and edge size calculation based on PCL library, characterized in that: include: Correct the coordinates of the point cloud based on the normal vector; After correcting the point cloud coordinates, it is necessary to segment and eliminate the points that are not on the plane; Repeat the coordinate correction process to ensure the accuracy of the correction and retain the normal vector of the current point cloud; Use the "BoundaryEstimation" function in the PCL library to estimate the boundary, use the retained normal vector to set the neighborhood search method and the number of neighborhood points, traverse the boundary estimation results, and finally save the point cloud of the boundary to complete the integrated processing of the plane polygon point cloud based on the PCL library; Using the edge point cloud obtained by the integrated processing of the plane polygon point cloud based on the PCL library, all points are projected to the XY plane so that all points are in a two-dimensional plane; Divide the edges of the projected point cloud into multiple separate point clouds; After the segmentation is completed, a vector `lineEndpoints` is defined to save the endpoint coordinates of all lines, and the previously saved multiple segmented point cloud edge files are read in sequence through a loop, and the RANSAC algorithm is used to fit each line; Read the saved coordinates of the line endpoints again, use the intersection algorithm to find all intersection points, and use the convex hull algorithm to enclose these intersection points into a closed polygon. The polygon can be considered as a fitting figure of the polygon point cloud border, and the size calculation results of each edge are directly visualized on the corresponding edge, thus completing the calculation of the size of all edges of the polygon point cloud.

2. The method for integrated processing of planar polygonal point clouds and calculation of edge dimensions based on the PCL library according to claim 1, characterized in that: The specific method of coordinate correction of point cloud based on normal vector is as follows: calculate the normal vector of point cloud through normol function in PCL library, perform cluster analysis based on the normal vector of each point to find the target point cloud plane, calculate the normal vector of the plane again after finding the plane, and then use the vector comparison function in PCL library to calculate the angle to be rotated, and use this rotation angle to drive the overall rotation of point cloud to achieve point cloud correction.

3. The method for integrated processing of planar polygonal point clouds and calculation of edge dimensions based on the PCL library according to claim 2, characterized in that: After correcting the point cloud coordinates, the specific method for segmenting and eliminating points that are not on the plane is: calculate the normal vector of the corrected point cloud again, set a threshold for the normal vector corresponding to each point, and then filter out the point cloud with the normal vector in the z+ direction. The point cloud on the non-plane will be quickly eliminated, and the coplanar point cloud will be retained.

4. The method for integrated processing of planar polygon point clouds and calculation of edge dimensions based on the PCL library according to claim 3, characterized in that: The specific method of splitting the edges of the projected point cloud into multiple separate point clouds is as follows: first, use the creation and setting execution algorithm object in PCL, set the model type to line (`pcl::SACMODEL_LINE`) and select the RANSAC method, such as random sampling consensus (`pcl::SAC_RANSAC`); Then, the point cloud data is used as input, and a distance threshold (`0.003`) is set to determine the tolerance of the inliers. By performing a segmentation operation, the algorithm uses RANSAC to fit a straight line model in the point cloud, extracts the index of the points on the fitted line (i.e., the inliers), and stores the parameters of the fitted line. This process ensures that each edge of the polygonal point cloud box is segmented from the point cloud for subsequent processing and saving; Finally, the edges of the polygonal point cloud are split into multiple separate point clouds.

5. The method for integrated processing of planar polygon point clouds and calculation of edge dimensions based on the PCL library according to claim 4, characterized in that: After the segmentation is completed, a vector `lineEndpoints` is defined to save the endpoint coordinates of all lines; the specific method of fitting each line using the RANSAC algorithm is as follows by looping through the previously saved multiple segmented point cloud edge files: For each straight line, obtain and save its endpoint coordinates, calculate and standardize the straight line vector, and extend both ends of the straight line by 0.2 meters to create intersections between adjacent straight lines; Then, the original point cloud and all the fitted straight lines are added to the visualization window, and each straight line is distinguished by different colors; Save the coordinates of the extended line endpoints to a text file and display the results in a visualization window.

Citation Information

Patent Citations

  • Pavement point cloud extraction method and device based on laser point cloud

    CN109584294A

  • Support plate chamfer recognition and analysis method based on 3D vision

    CN115471511A

  • Tapered hole size measuring method based on point cloud slicing

    CN116721144A

  • Sheet metal part hole group classification and full-size measurement method based on 3D point cloud processing

    CN117292181A