Convex hull detection of point cloud is more commonly used. PCL comes with Convex hull detection ConvexHull, which is a relatively simple function. Set the dimension setDimension of ConvexHull, and record it here
Header: #include <; pcl/surface/convex_hull.h>
Header: #include <; pcl/surface/convex_hull.h>
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZ>);
pcl::io::loadPCDFile<pcl::PointXYZ>("bun_45.pcd", *cloud);
pcl::ConvexHull<pcl::PointXYZ> hull;
hull.setInputCloud(cloud);
hull.setDimension(3);
std::vector<pcl::Vertices> polygons;
pcl::PointCloud<pcl::PointXYZ>::Ptr surface_hull(new pcl::PointCloud<pcl::PointXYZ>);
hull.reconstruct(*surface_hull, polygons);
cout << surface_hull->size() << endl;
// ---------------------- Visualizer -------------------------------------------
boost::shared_ptr<pcl::visualization::PCLVisualizer> viewer(new pcl::visualization::PCLVisualizer);
viewer->setBackgroundColor(255,255,255);
pcl::visualization::PointCloudColorHandlerCustom<pcl::PointXYZ> color_handler(cloud, 255, 255, 0);
viewer->addPointCloud(cloud, color_handler, "sample cloud");
viewer->setPointCloudRenderingProperties(pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 6, "sample cloud");
pcl::visualization::PointCloudColorHandlerCustom<pcl::PointXYZ> color_handlerK(surface_hull, 255, 0, 0);
viewer->addPointCloud(surface_hull, color_handlerK, "point");
viewer->setPointCloudRenderingProperties(pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 6, "point");
//viewer->addPolygon<pcl::PointXYZ>(surface_hull, 0, 0, 255, "polyline");
while (!viewer->wasStopped())
{
viewer->spinOnce(100);
}
Adopting Stanford Rabbit Point Cloud, the effect is shown in the figure below:
If the point cloud in a certain convex hull is further separated from the scene, Crophull can be used for filtering
CropHull filtering can refer to: https://blog.csdn.net/zfjBIT/article/details/92795689
Thanks for the correction of Xiao snail. If we get the convex hull curve, further triangulation is needed. It is not correct to connect the convex hull points only
Read More:
- DNS name does not exist
- Tensorflow: How to use expand_Dim() to add dimensions
- Vs cannot open the source file unistd. H under Windows
- Learning notes — opengl01
- C++ compiler prompt “undefined reference to…”[How to Fix]
- Vs2015 configuring OpenGL development environment: configuration of glfw library and glad Library
- C + + pauses the black window system (“pause”); (get ch(), getchar(), system (pause)’s connection and difference
- Numpy adds a new dimension: newaxis
- In tensorflow tf.reduce_ Mean function
- Error c2061: syntax error: identifier ‘this_ FILE’
- Vs2015 configuring OpenGL (glfw Library)
- Screen Overlay Detected
- “Typeerror: invalid dimensions for image data” in Matplotlib drawing imshow() function
- [Warning] incompatible implicit declaration of built-in function ‘strcat’
- Spring cloud config does not read bootstrap.properties/yml
- Error c2011: “a certain class”: redefinition of “class” type
- Integration openfeign failed to start
- X Error of failed request: BadWindow (invalid Window parameter)
- OpenGL development environment configuration [vs2017] + common problems
- C / C + + library function (tower / tower) realizes the conversion of letter case