PCL 不同类型的点云之间进行类型转换


PCL 不同类型的点云之间进行类型转换

可以使用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/


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM