PCL: 根据几何规则的曲面剖分-贪婪法表面重建三角网格
生活随笔
收集整理的這篇文章主要介紹了
PCL: 根据几何规则的曲面剖分-贪婪法表面重建三角网格
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
??????? 點云場景中進行物體識別,使用全局特征的方法嚴重依賴于點云分割,難以適應雜亂場景。使用局部特征,即對點云進行提取類似于3D SURF、ROPS之類的局部特征,需要尋找離散點云塊的局部顯著性。
?????? 點云的基本局部顯著性有某一點處的曲率。
一、幾何尺寸
? ? ? ? 可表述為顯著性曲率的曲率閾值與物體的幾何大小有關。 ? ? ? ?
??????? ????????? ?? ???
????? ? 典型三維模型Dragon和ball兩個物體,ball也可以進行三維剖分,但其三維剖分沒有任何幾何意義,而deagon的三維剖分有特異性。
二、無規則三角化
參考PCL官方網站鏈接:Fast triangulation of unordered point clouds
代碼:
?????
#include <pcl/point_types.h> #include <pcl/io/pcd_io.h> #include <pcl/kdtree/kdtree_flann.h> #include <pcl/features/normal_3d.h> #include <pcl/surface/gp3.h>int main (int argc, char** argv) {// Load input file into a PointCloud<T> with an appropriate typepcl::PointCloud<pcl::PointXYZ>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZ>);pcl::PCLPointCloud2 cloud_blob;pcl::io::loadPCDFile ("bun0.pcd", cloud_blob);pcl::fromPCLPointCloud2 (cloud_blob, *cloud);//* the data should be available in cloud// Normal estimation*pcl::NormalEstimation<pcl::PointXYZ, pcl::Normal> n;pcl::PointCloud<pcl::Normal>::Ptr normals (new pcl::PointCloud<pcl::Normal>);pcl::search::KdTree<pcl::PointXYZ>::Ptr tree (new pcl::search::KdTree<pcl::PointXYZ>);tree->setInputCloud (cloud);n.setInputCloud (cloud);n.setSearchMethod (tree);n.setKSearch (20);n.compute (*normals);//* normals should not contain the point normals + surface curvatures// Concatenate the XYZ and normal fields*pcl::PointCloud<pcl::PointNormal>::Ptr cloud_with_normals (new pcl::PointCloud<pcl::PointNormal>);pcl::concatenateFields (*cloud, *normals, *cloud_with_normals);//* cloud_with_normals = cloud + normals// Create search tree*pcl::search::KdTree<pcl::PointNormal>::Ptr tree2 (new pcl::search::KdTree<pcl::PointNormal>);tree2->setInputCloud (cloud_with_normals);// Initialize objectspcl::GreedyProjectionTriangulation<pcl::PointNormal> gp3;pcl::PolygonMesh triangles;// Set the maximum distance between connected points (maximum edge length)gp3.setSearchRadius (0.025);// Set typical values for the parametersgp3.setMu (2.5);gp3.setMaximumNearestNeighbors (100);gp3.setMaximumSurfaceAngle(M_PI/4); // 45 degreesgp3.setMinimumAngle(M_PI/18); // 10 degreesgp3.setMaximumAngle(2*M_PI/3); // 120 degreesgp3.setNormalConsistency(false);// Get resultgp3.setInputCloud (cloud_with_normals);gp3.setSearchMethod (tree2);gp3.reconstruct (triangles);// Additional vertex informationstd::vector<int> parts = gp3.getPartIDs();std::vector<int> states = gp3.getPointStates();// Finishreturn (0); }圖形效果:
??????
總結
以上是生活随笔為你收集整理的PCL: 根据几何规则的曲面剖分-贪婪法表面重建三角网格的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Linux udev 动态管理Oracl
- 下一篇: Rancher集群启动服务挂载rbd存储