Mesh visualizing PCL 1.6 using PCLVisualizer

7.2k views Asked by At

I would visualize mesh resulting from GreedyProjectionTriangulation using PCL 1.6.

I found I have to use

pcl::visualization::PCLVisualizer.addPolygonMesh()

but my problem is how to use PCLVisualizer and not

pcl::visualization::CloudViewer

to get also the streaming.

I tried this:

http://www.pcl-users.org/Simple-Kinect-viewer-that-writes-a-PCD-tp3883792p3940787.html

and also the suggestion to solve

http://www.pcl-users.org/Simple-Kinect-viewer-that-writes-a-PCD-tp3883792p3954525.html

that is adding arguments to function openNIGrabber. Anyway, for the compiler is ok, but when I run it aborts. I'm using VS2010 64bit

Could someone suggest me another solution?

1

There are 1 answers

0
Dinl On

This works in pcl 1.8 and PCL 1.7.2:

pcl::PolygonMesh mesh;
pcl::io::loadPolygonFileOBJ("table.obj",mesh);

boost::shared_ptr<pcl::visualization::PCLVisualizer> viewer (new pcl::visualization::PCLVisualizer ("3D Viewer"));
viewer->setBackgroundColor (0, 0, 0);
viewer->addPolygonMesh(mesh,"meshes",0);
viewer->addCoordinateSystem (1.0);
viewer->initCameraParameters ();
while (!viewer->wasStopped ()){
    viewer->spinOnce (100);
    boost::this_thread::sleep (boost::posix_time::microseconds (100000));
}