如何将obj文件(存储的点云数据,输出是点云三维模型)转换成pcd文件
#include
#include
#include
#include
//#include //formROSMsg所属头文件;
#include
#include //loadPolygonFileOBJ所属头文件;
//#include
using namespace std;
using namespace pcl;
int main()
{
pcl::PolygonMesh mesh;
pcl::io::loadPolygonFile("G:\data.obj", mesh);
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZ>);
pcl::fromPCLPointCloud2(mesh.cloud, *cloud);
pcl::io::savePCDFileASCII("G:\\dianyun.pcd", *cloud);
cout << cloud->size() << endl;
cout << "OK!";
cin.get();
return 0;
}
试试这个代码。
如果想读取颜色值,换成PointXYZRGB后会出现颜色识别不了的问题,这是怎么回事啊
这个提取的只有角点,太稀疏了