How to convert vtk object to pcl::TextureMesh when using vtkOBJImporter class to load .obj file?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

How to convert vtk object to pcl::TextureMesh when using vtkOBJImporter class to load .obj file?

Vinmean
My code for loading the .obj file along with texture information is as below. I have used vtkOBJImporter class. But I don't know how to convert this into pcl's TextureMesh datatype.

#include <pcl/common/common.h>
#include <pcl/io/obj_io.h>
#include <pcl/io/vtk_lib_io.h>
#include <pcl/visualization/pcl_visualizer.h>
#include <pcl/common/transforms.h>
#include <vtkOBJImporter.h>
#include <vtkRenderWindow.h>
#include <vtkCamera.h>
#include <vtkNew.h>
#include "vtksys/SystemTools.hxx"
#include <vtkOBJImporterInternals.h>

int main(int argc, char** argv)
{
          vtkNew<vtkOBJImporter> importer;
          std::string filenameOBJ("mesh.obj");
          std::string filenameMTL("mesh.mtl");
          std::string texfile1;
          std::string texture_path1 = vtksys::SystemTools::GetFilenamePath("mesh_material0000_map_Kd.png");

          importer->SetFileName(filenameOBJ.data());
          importer->SetFileNameMTL(filenameMTL.data());
          importer->SetTexturePath(texture_path1.data());

          boost::shared_ptr<pcl::visualization::PCLVisualizer> result_view(new pcl::visualization::PCLVisualizer("Viewer"));
          result_view->setSize(1280,720);
          importer->SetRenderWindow(result_view->getRenderWindow());
          importer->Update();

          vtkSmartPointer<vtkRenderer> renderer =result_view->getRenderWindow()->GetRenderers()->GetFirstRenderer();
          renderer->ResetCamera();

          result_view->spin();

        return 0;
}
Loading...