PCL visualizer question

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

PCL visualizer question

Dcannt
Hi, I'm starting on usisng PCL so I'm noob...
I'm trying to make a real time visualizator of a point cloud from a kinect
camera but I only can view a static image of the point cloud on the
visualizator...
I'm using the follow code:

  std::cout << std::endl;

                        pcl::PointCloud <pcl::PointXYZRGB>::Ptr colored_cloud =
reg.getColoredCloud ();

                        pcl::visualization::PointCloudColorHandlerRGBField<pcl::PointXYZRGB>
rgb(colored_cloud);

                        viewer->addPointCloud<pcl::PointXYZRGB> (colored_cloud, rgb, "sample
cloud");
                        viewer->spinOnce ();
                }
                rate.sleep();

and to make a real time visualizator I use this but it doesn't work...:

  std::cout << std::endl;

                        pcl::PointCloud <pcl::PointXYZRGB>::Ptr colored_cloud =
reg.getColoredCloud ();

                        pcl::visualization::PointCloudColorHandlerRGBField<pcl::PointXYZRGB>
rgb(colored_cloud);
                        while(!viewer->wasStopped())
                        {
                                int N = 1;
                                for(int frameID=0;frameID<N;frameID++)
                                        {
                                        viewer->removePointCloud("sample cloud");
                                        viewer->addPointCloud<pcl::PointXYZRGB> (colored_cloud, rgb, "sample
cloud");
                                        viewer->spinOnce ();
                                        N = N+1;
                                        }
                        }
                }
                rate.sleep();






--
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: PCL visualizer question

Sérgio Agostinho
Have a look at the end of this tutorial
http://pointclouds.org/documentation/tutorials/pcl_visualizer.php#pcl-visualizer

while (!viewer->wasStopped ())
{
  viewer->spinOnce (100);
  boost::this_thread::sleep (boost::posix_time::microseconds (100000));
}
You might also need to revise that add/remove PointCloud logic. You should only add in the first iteration and from then onwards use updatePointCloud.

Cheers

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