可以使用PCL里面现成的函数pcl::copyPointCloud()

#include <pcl/common/impl/io.h>

    pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_xyz (new pcl::PointCloud<pcl::PointXYZ> ());  
    pcl::PointCloud<pcl::PointXYZRGBA>::Ptr cloud_xyzrgba (new pcl::PointCloud<pcl::PointXYZRGBA> ());
    pcl::copyPointCloud(*cloud_xyz, *cloud_xyzrgba);

或者手动转换:

cloud_xyzrgba->points.resize(cloud_xyz->size());
for (size_t i = 0; i < cloud_xyz->points.size(); i++) {
    cloud_xyzrgb->points[i].x = cloud_xyz->points[i].x;
    cloud_xyzrgb->points[i].y = cloud_xyz->points[i].y;
    cloud_xyzrgb->points[i].z = cloud_xyz->points[i].z;
}

参考网站:
http://answers.ros.org/question/9515/how-to-convert-between-different-point-cloud-types-using-pcl/

相关文章:

  • 2022-12-23
  • 2022-02-18
  • 2022-12-23
  • 2021-09-05
  • 2022-12-23
  • 2022-12-23
  • 2021-12-13
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-03
  • 2022-12-23
  • 2021-11-20
  • 2022-01-08
相关资源
相似解决方案