I'm confused with when to use pcl::PointCloud2
vs pcl::PointCloudPointCloud
For example, using these definitions for pcl1_ptrA
, pcl1_ptrB
and pcl1_ptrC
:
pcl::PointCloud<pcl::PointXYZRGB>::Ptr pcl1_ptrA(new pcl::PointCloud<pcl::PointXYZRGB>); //pointer for color version of pointcloud
pcl::PointCloud<pcl::PointXYZRGB>::Ptr pcl1_ptrB(new pcl::PointCloud<pcl::PointXYZRGB>); //ptr to hold filtered Kinect image
pcl::PointCloud<pcl::PointXYZRGB>::Ptr pcl1_ptrC(new pcl::PointCloud<pcl::PointXYZRGB>); //ptr to hold filtered Kinect image
I can invoke the following PCL functions:
pcl::VoxelGrid<pcl::PointXYZRGB> vox;
vox.setInputCloud(pcl1_ptrA);
vox.setLeafSize(0.02f, 0.02f, 0.02f);
vox.filter(*pcl1_ptrB);
cout<<"done voxel filtering"<<endl;
cout<<"num bytes in original cloud data = "<<pcl1_ptrA->points.size()<<endl;
cout<<"num bytes in filtered cloud data = "<<pcl1_ptrB->points.size()<<endl; // ->data.size()<<endl;
Eigen::Vector4f xyz_centroid;
pcl::compute3DCentroid (*pcl1_ptrB, xyz_centroid);
float curvature;
Eigen::Vector4f plane_parameters;
pcl::computePointNormal(*pcl1_ptrB, plane_parameters, curvature); //pcl fnc to compute plane fit to point cloud
Eigen::Affine3f A(Eigen::Affine3f::Identity());
pcl::transformPointCloud(*pcl1_ptrB, *pcl1_ptrC, A);
However, if I instead use pcl::PCLPointCloud2
objects, e.g.:
pcl::PCLPointCloud2::Ptr pcl2_ptrA (new pcl::PCLPointCloud2 ());
pcl::PCLPointCloud2::Ptr pcl2_ptrB (new pcl::PCLPointCloud2 ());
pcl::PCLPointCloud2::Ptr pcl2_ptrC (new pcl::PCLPointCloud2 ());
This function works:
pcl::VoxelGrid<pcl::PCLPointCloud2> vox;
vox.setInputCloud(pcl2_ptrA);
vox.setLeafSize(0.02f, 0.02f, 0.02f);
vox.filter(*pcl2_ptrB);
But these do not even compile:
//the next 3 functions do NOT compile:
Eigen::Vector4f xyz_centroid;
pcl::compute3DCentroid (*pcl2_ptrB, xyz_centroid);
float curvature;
Eigen::Vector4f plane_parameters;
pcl::computePointNormal(*pcl2_ptrB, plane_parameters, curvature);
Eigen::Affine3f A(Eigen::Affine3f::Identity());
pcl::transformPointCloud(*pcl2_ptrB, *pcl2_ptrC, A);
I am having trouble discovering which functions accept which objects. Ideally, wouldn't all PCL functions accept pcl::PCLPointCloud2
arguments?