Domanda

I follow the tutorial of the PCL website.

It use the point cloud type below:

pcl::PCLPointCloud2

I wonder if I can auto recognize the type of the point cloud like pcl::PointXYZ, pcl::PointXYZNomralsthen convert them automatically to the function I would like to use? Is there any function in pcl::PCLPointCloud2 able to find the type of the point cloud?

Like this:

if(POINT_CLOUD_WITHOUT_NORMALS)
    pcl::fromPointCloud2(pointcloud2, *cloud_without_normal);
else if(POINT_CLOUD_WITH_NORMALS)
    pcl::fromPointCloud2(pointcloud2, *cloud_normal);

Thanks very much!

È stato utile?

Soluzione

I found a way to recognize the type of the cloud by using pcl::getFieldsList

This returns the type of a cloud in the format of std::string.

Ex.

pcl::PointXYZ returns x y z

pcl::PointXYZNormal returns x y z normal_x normal_y normal_z curvature

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top