A. Point cloud Display ModuleAccording to the PCL China official forum Dr. Ueda's four article http://www.pclcn.org/bbs/forum.php?mod=viewthread&tid=223&page=1&extra= #pid750 , the basic point cloud Display module is built in the MFC environment. This is the basis for all subsequent operations. 1. The issues to be addressed are: (1By Dr. Yutian in his post,Pcl-1.6.0-allinone-msvc2010-win32Provided in theVTK5.8Missing critical filesvtkMFCWindow.hAndVktMFC.lib, it cannot be implemented based onMFCOfPCLForm. So you need to download it yourselfVTK5.10UseCMakeGenerate project files; I downloaded theCMakeVersion is2.8.11.1, the first time you configure, you don't seeVTK_USE_MFCoption, by check " Advancedcheck box to find theVtk_gui_supportoption, tick this option and clickConfig"Button to find theVTK_USE_MFCNote that if you do not select theVTK_USE_MFCoption, you cannot generate aVTKMFCThe information required by the project, (the specific process reference note "VTK Installation and source code compilation"). (2) Compile your own project will encounter a lot of compile error in the following code: Std::numeric_limits<double >::max (); Std::max (); The compilation error is: "(": "::" illegal tag on the rightError Reason: function templateMaxwith thevisualc++The global macro in theMaxconflict. The solution found online is to enclose "std::numeric_limits<double>::max" in parentheses; (Std::numeric_limits<double>::max) ();(std:: Max) (); Another workaround is to add the header file to the conflicting file: #undef max #undef min (3) Some other debugging problems.
2. Modify Point cloud Display module Dr. Tian modified the code midpoint cloud display type issensor_msgs::P ointCloud2
- This->binary_blob.reset ();
- Binary_blob = sensor_msgs::P ointCloud2::P tr (newsensor_msgs::P ointCloud2);
- Read new data
- *.PCD file
- PCL::P Cdreader Pcd_reader;
- if (Pcd_reader.read (char*) _bstr_t (Filename.c_str ()), *binary_blob)! = 0)//* load the file
- {
- MessageBox (_t ("couldn ' T read PCData file!"));
- Return
- }
- }
- if (Binary_blob ==null)
- {
- MessageBox ("Please load PCD file firstly!");
- Return
- }
- Else
- {
- Other handles
- if (Pcl::getfieldindex (*binary_blob, "RGB") >0)
- {
- Color_handler =pcl::mfc_visualization::P ointcloudcolorhandlerrgbfield<sensor_msgs::P ointcloud2>::P TR
- (newpcl::mfc_visualization::P ointcloudcolorhandlerrgbfield<sensor_msgs::P ointcloud2> (Binary_blob));
- This->viewer->addpointcloud (Binary_blob, Color_handler,sensor_origin, sensor_orientation);
- }
- Else
- {
- Xyz_handler =pcl::mfc_visualization::P ointcloudgeometryhandlerxyz<sensor_msgs::P ointcloud2>::P TR
- (newpcl::mfc_visualization::P ointcloudgeometryhandlerxyz<sensor_msgs::P ointcloud2> (Binary_blob));
- This->viewer->addpointcloud (Binary_blob, Xyz_handler,sensor_origin, sensor_orientation);
- }
- This->viewer->resetcamera ();
We have amended it toPCL::P OINTCLOUD<PCL::P ointxyz>: and independent display functionvoid Cpointcloudlabdlg::simplevis (PCL::P OINTCLOUD<PCL::P ointxyz>::P tr Cloud) {//Statistics pick point clouds//Create 3D window and add point cloud viewer- >removeallpointclouds (); Viewer->removeallshapes (); Viewer->setbackgroundcolor (0,0,0); VIEWER->ADDPOINTCLOUD<PCL::P ointxyz> (Cloud, "sample Cloud"); Viewer->setpointcloudrenderingproperties (pcl::mfc_visualization::P cl_visualizer_point_size, 1, "Samplecloud") ; Viewer->addcoordinatesystem (1.0); Viewer->initcameraparameters (); Viewer->resetcamera (); }
Figure 1
Figure 2
Two. Point Cloud filtering1.Pass-through filter
This is a desk scene, filtered before its visualization results are shown in 2. It is obvious that there is a large piece of noise data on the right side, for this large and the main point cloud data with a clear boundary of the noise data, the fastest way is to directly design a pass-through filter, the method is simple and easy to use, and the effect is obvious, the only shortage is the need for manual filtering, that the user must go through several Find the approximate boundary between the noise data and the principal point cloud data. Figure 3 is The result of the pass-through filter, which is set to preserve the x - coordinate Point cloud data between the -0.9~0.6, It is clear that the large amount of noise data in the left and right parts of the desk has been removed.
Figure 3For roadway
Figure 42.StatisticOutlierRemovalFilter Removal outliersAlthough the pass-through filter can quickly remove a large number of noise points, but it has a lot of limitations, one is the need for manual filtering, the need to artificially determine the approximate location of the noise point, after several attempts to find the approximate range of filtering, and the second is the application of direct filtering is limited, unless the noise point and the main point cloud data has a Here is a method that does not require artificial judgment and can be limited to remove the outliers around the main point cloud, which can solve some of the problems: establish the topological structure of the point cloud data, a statistical analysis of the neighborhood of each point, and trim off those points that do not meet certain criteria. Our sparse outlier removal method is based on the calculation of the distance distribution from the point to the neighboring point in the input data. For each point, we calculate its average distance to all of its adjacent points. The resulting result is a Gaussian distribution whose shape is determined by the mean and standard deviation, and the average distance is defined as an outlier and can be removed from the dataset, at points outside the standard range (defined by the global distance mean and variance). UseStatisticoutlierremovalFilter removal before outliers 3as shown, after filtering 5is shown.
three. Point Cloud Lite
The lower-right corner of the two images above shows the number of points.
1. Bounding box method
the method is to first use a body bounding box to constrain the point cloud, all the point cloud data placed in the bounding box, and then the large bounding box into a number of small boxes of the same size, select with the Small box center point or the closest point to the center point to replace all the points in the box, The number of point clouds processed by this method is the number of small boxes, the method is simple to operate and can effectively reduce the number of point clouds. first set the bounding box length and width height, generally we use cubes. The longer the edge length, the greater the degree of simplification.
2. Based on Alpha Shapes
The point cloud simplification algorithm based on alphashapes is found in the study of the convex hull model of three-dimensional point cloud, the convex hull model of three-dimensional point cloud can approximate the contour of the object surface, and by extracting the convex hull of the three-dimensional convex hull model to construct the surface of the object, it can greatly reduce the amount of point cloud data. But three-dimensional convex hull can not really reflect the contour of the object, when the surface of the object is sunken, the convex hull can not be reflected, so a alphashapes concept is derived, the method can effectively maintain the original appearance of the object, and its streamlining precision is easy to control. The above point cloud is further simplified below.
Four. Point Cloud rebuild1. Greedy Projection triangulation algorithmSetting Parameters
From for notes (Wiz)
List of attachments
Point cloud processing software development progress