【slam PCL 학습】-pcl::PointCloud::Ptr와 Pcl::PointCloud 두 종류의 상호 전환

12307 단어 SLAMpcl
1: Ptr 유형 및 비 Ptr 유형 상호 변환
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_Ptr(new pcl::PointCloud<pcl::PointXYZ>);
pcl::PointCloud<pcl::PointXYZ> cloud;
cloud=*cloud_Ptr;
cloud_Ptr=cloud.makeShared;

2: 실제 사용:
a) 비 Ptr
pcl::PointCloud<pcl::PointXYZ> cloud;
pcl::SACSegmentation<pcl::PointXYZ>seg;
****            (  )*****
seg.setInputCloud(cloud.makeShared());

b) Ptr 동적 스마트 포인터 유형
pcl::PointCloud<pcl::PointXYZ> cloud(new pcl::PointCloud<pcl::PointXYZ>;
pcl::SACSegmentation<pcl::PointXYZ>seg;
****            (  )*****
seg.setInputCloud(cloud);

ptr는 바늘 형식으로 서로 변환할 수 있습니다
**1.PointCloud::Ptr>PointCloud**
pcl::PointCloud<pcl::PointXYZ> cloud;
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_ptr(new pcl::PointCloud<pcl::PointXYZ>);
cloud=*cloud_ptr;

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

example:
1.
pcl::PointCloud<pcl::PointXYZ> cloudA;
pcl::octree::OctreePointCloudSearch<pcl::PointXYZ> octree(resolution);  
octree.setInputCloud(cloudA.makeShared());
2.
pcl::PointCloud<pcl::PointXYZ>::Ptr cloudA(new pcl::PointCloud<pcl::PointXYZ>);
pcl::octree::OctreePointCloudSearch<pcl::PointXYZ> octree(resolution); 
octree.setInputCloud(cloudA);

참조: 1.https://blog.csdn.net/qq_39707351/article/details/83828242

좋은 웹페이지 즐겨찾기