使用pcl实现txt转pcd

目录

  • 代码
  • 参考

转自:https://blog.csdn.net/qq_29462849/article/details/88725403

代码

#include
#include
#include 
#include 
#include 
#include 

using namespace std;


int main()
{
    fstream modelRead;
    pcl::PointCloud<pcl::PointXYZ> cloud;
    pcl::PCDWriter writer;

    modelRead.open("/home/oliver/dianyun.txt",std::ios_base::in);
    pcl::PointXYZ pclPnt;
    while(!modelRead.eof())
    {
        modelRead>>pclPnt.x>>pclPnt.y>>pclPnt.z;
        cloud.push_back(pclPnt);
    }
    modelRead.close();
    writer.write("/home/oliver/dianyun.pcd",cloud);
    return 0;
}


参考

PCL中把txt文件转换成.pcd文件(很简单)

你可能感兴趣的:(PointCloud)