Pregunta

I am going to create two viewport in order to visualize two independent point cloud. Here is a part of my code:

PORT1 = 0; PORT2=0;

vis->createViewPort (0.5,0.0,1.0,1.0,PORT1);
vis->setBackgroundColor(0,0,0,PORT1);
vis->addPointCloud<pcl::PointXYZ>(*cloud1, "left cloud",PORT1);

vis->createViewPort (0.0,0.0,0.5,1.0,PORT2);
vis->setBackgroundColor(0.1,0.1,0.1,PORT2);
vis->addPointCloud<pcl::PointXYZ>(*cloud2, "right cloud",PORT2);

the visualizer shows cloud1 and cloud2 in the same window. But when i want to change the view of one pointcloud (using mouse), the other spin simultaneously . Is there any way to make different pointclouds to view independant from each other? (I have created the visualizer in a thread and so I can not create two different visualizer)

Thank you every body

¿Fue útil?

Solución

I have reached to an answer (from pcl users forum):

You can not use one visualizer in two or more threads. The current version of PCL (1.7), does not support this task. But you can make two different threads with different visualizers. Then you will see each cloud in separate windows, and you can change the view of each window independently.

Otros consejos

You can do them independent just creating separate camers for each of them. Your code updated with this advice will look in the following way:

PORT1 = 0; PORT2=0;
vis->createViewPort (0.5,0.0,1.0,1.0,PORT1);
vis->setBackgroundColor(0,0,0,PORT1);
vis->addPointCloud<pcl::PointXYZ>(*cloud1, "left cloud",PORT1);
vis->createViewPortCamera(PORT1);

vis->createViewPort (0.0,0.0,0.5,1.0,PORT2);
vis->setBackgroundColor(0.1,0.1,0.1,PORT2);
vis->addPointCloud<pcl::PointXYZ>(*cloud2, "right cloud",PORT2);
vis->createViewPortCamera(PORT2);

Where vis is:
boost::shared_ptr vis (new pcl::visualization::PCLVisualizer ("id"));

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top