Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mesh visualizing PCL 1.6 using PCLVisualizer

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?

like image 517
SPS Avatar asked Jan 06 '14 20:01

SPS


1 Answers

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));
}
like image 154
Dinl Avatar answered Oct 21 '22 09:10

Dinl