我正在尝试使用预定义的PCL(Point Cloud Library)函数加载带纹理的.obj文件,如下所示:
pcl::TextureMesh texture_mesh;
int loaded = pcl::io::loadOBJFile(<path to obj>,texture_mesh);
boost::shared_ptr<pcl::visualization::PCLVisualizer> result_view(new pcl::visualization::PCLVisualizer("Viewer"));
result_view->addTextureMesh(texture_mesh, "texture mesh", 0);
while (!result_view->wasStopped())
{
//---{ update the viewer }
result_view->spinOnce(100);
boost::this_thread::sleep(boost::posix_time::microseconds(100000));
}
但是,纹理未正确加载且模型保持无色。我试图将“texture_mesh”保存到新的.obj以查看结果,但看起来纹理坐标混乱了。
我的问题是:
1) Are the files in the correct format?
2) Is the obj loading and veiwing correct?
3) Has anyone had success loading textured .obj files with PCL?
为了证明这个问题,我在这里初步建立了一个测试仓库loadOBJ
在src中提供的路径是相对的,所以设置cmake source = loadOBJ,build = loadOBJ / build。
Due to the relative path I had to edit the output of saving the obj with pcl, this is noted in the READMEs.
Due to issue with not knowing enough about git, I had to manually upload the .obj files haha
这只是Windows机器上的一个问题,它已经在unix上测试过,运行正常。