Display textured mesh in pcl::visualization::PCLVisualizer

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Display textured mesh in pcl::visualization::PCLVisualizer

Smeh
I want to create textured mesh and show it in pcl visualizer.

I found some in documentation.And tried to do this.

/pcl::TextureMesh mesh;
pcl::TexMaterial texMat;
std::string pathText("C:\\TextMappingTest\\wood.png");
texMat.tex_file = pathText;
texMat.tex_name = "wood";

pcl::PolygonMesh::Ptr mesh1(new pcl::PolygonMesh);
pcl::toPCLPointCloud2(*outputData->m_vertices, mesh1->cloud);

mesh.cloud = mesh1->cloud;
Eigen::Vector2f cor1(0.0f,0.0f);
Eigen::Vector2f cor2(10.0f,10.0f);
std::vector<pcl::Vertices> faceV;
std::vector<Eigen::Vector2f> coord;
for (const auto &face : faces)
{
                pcl::Vertices tr;
                tr.vertices.resize(3);
                std::copy(face.begin(), face.end(), tr.vertices.begin());
                faceV.push_back(tr);
                mesh.tex_materials.push_back(texMat);
                mesh.tex_polygons.push_back(faceV);
                faceV.clear();
}
       
viewer->addTextureMesh(mesh);
viewer->resetCamera();
viewer->getRenderWindow()->Render();
viewer->updateCamera();/

But it doesnt work :/

1.Should i fully initialize  all pcl::TexMaterial  parameters,if yes how? Or
i did some mistakes?
Cause i cant find documentation with examples.
2.Can i use for texture big image, and use part of it for facet?
3. Is there any good example of working code?

I will be glad to any help!



--
Sent from: http://www.pcl-users.org/
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: Display textured mesh in pcl::visualization::PCLVisualizer

Sérgio Agostinho

TextureMesh support is very experimental, frail, buggy and poorly documented as you've experienced already. There are countless bugs in the issue tracker related to it (although all pertaining loading from Wavefront Obj files).

You might want to have a look at the pcl::TextureMapping class and the corresponding source  code.

Even the unit test using GP3 is commented out! It shows some code, so give it a try.

https://github.com/PointCloudLibrary/pcl/blob/master/test/surface/test_gp3.cpp#L158-L238

Bottom line is, it's not user friendly territory stable territory.

Good luck!



_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users

signature.asc (849 bytes) Download Attachment