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