txt文件中数据为XYZ
将txt文件转为pcd点云数据文件程序:
// 将txt文件转换为pcd文件
#if 1
#include<iostream>
#include<fstream>
#include <string>
#include <vector>
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>
using namespace std;
int main()
{
fstream fsread;
pcl::PointCloud<pcl::PointXYZ> cloud;
pcl::PCDWriter writer;
fsread.open("lidar.txt");
pcl::PointXYZ pclPnt;
while(!fsread.eof())
{
fsread>>pclPnt.x>>pclPnt.y>>pclPnt.z;
cloud.push_back(pclPnt);
}
fsread.close();
writer.write("lidar.pcd",cloud);
return 0;
}
#endif
变换之后: