std::vector<pcl::Vertices> polys;
pcl::Vertices v1, v2;
v1.vertices.push_back(0);
v1.vertices.push_back(1);
v1.vertices.push_back(2);
v2.vertices.push_back(2);
v2.vertices.push_back(3);
v2.vertices.push_back(0);
polys.push_back(v1);
polys.push_back(v2);
pcl::PointXYZ pt0, pt1, pt2, pt3;
//fill pt0, pt1,..., pt3 with your values!
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZ>);
cloud->push_back(pt0);
cloud->push_back(pt1);
cloud->push_back(pt2);
cloud->push_back(pt3);
pcl::PolygonMesh mesh;
mesh.polygons = polys;
//convert cloud to blob
pcl::PCLPointCloud2::Ptr cloud_blob(new pcl::PCLPointCloud2);
pcl::toPCLPointCloud2(*cloud2, *cloud_blob);
mesh.cloud = *cloud_blob;
std::string ply_filename("mesh.ply");
pcl::io::savePLYFile(ply_filename, mesh);
在PCL中根据三角形索引和顶点手动创建mesh
最新推荐文章于 2024-01-24 15:40:28 发布