2

I am trying to load a textured .obj file using the predefined PCL (Point Cloud Library) functions like so:

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));
}

However, the texture is not loaded correctly and the model remains colourless. I have tried to save the "texture_mesh" to a new .obj to see the result but it appears the texture coords are being jumbled up.

My questions are:

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?

To demonstrate the issue, I have initialized a test repo here loadOBJ

paths supplied in src are relative so set 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

This is only an issue on windows machines, it has been tested on unix and runs fine.

rfho_bdss
  • 170
  • 1
  • 18

0 Answers0