سؤال

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!

هل كانت مفيدة؟

المحلول

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

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top