Pcl::PointCloud和pcl::PointCloud::Ptr类型的转换

pcl::PointCloud 和 pcl::PointCloud::Ptr类型的转换
加了ptr的是指针类型,两者可以互相转换

1.PointCloud::Ptr—>PointCloud
pcl::PointCloud cloud;
pcl::PointCloud::Ptr cloud_ptr(new pcl::PointCloud);
cloud=*cloud_ptr;


2.PointCloud—>PointCloud::Ptr
pcl::PointCloud::Ptr cloud_ptr(new pcl::PointCloud);
pcl::PointCloud cloud;
cloud_ptr=cloud.makeShared();


example:
1.
pcl::PointCloud cloudA;
pcl::octree::OctreePointCloudSearch octree(resolution);  
octree.setInputCloud(cloudA.makeShared());

    2.
    pcl::PointCloud::Ptr cloudA(new pcl::PointCloud);
    pcl::octree::OctreePointCloudSearch octree(resolution); 

octree.setInputCloud(cloudA);
--------------------- 

参考资料:https://blog.csdn.net/qq_39707351/article/details/83828242

你可能感兴趣的:(pcl,vs)