PCL PCD文件转换成PLY文件
初学PCL,百度+文档 有问题请提出 同进步
直接上代码
#include <pcl/io/pcd_io.h>
#include <pcl/io/ply_io.h>
#include<pcl/PCLPointCloud2.h>
#include<iostream>
#include<string>
using namespace pcl;
using namespace pcl::io;
using namespace std;
int PCDtoPLYconvertor(string& input_filename, string& output_filename)
{
pcl::PCLPointCloud2 cloud;
if (loadPCDFile(input_filename, cloud) < 0)
{
cout << "Error: cannot load the PCD file!!!" << endl;
return -1;
}
PLYWriter writer;
writer.write(output_filename, cloud, Eigen::Vector4f::Zero(), Eigen::Quaternionf::Identity(), false, true); 注意第一个参数为false 为true时文件有问题
return 0;
}
int main()
{
string input_filename = "//liankou.pcd";
string output_filename = "//liankou.ply";
PCDtoPLYconvertor(input_filename, output_filename);
return 0;
}
------------------------------------------------------------------------------------------------------
作者:Doron419
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接。
如果觉得这篇文章对你有小小的帮助的话,记得在右下角点个“推荐”哦,博主在此感谢!


浙公网安备 33010602011771号