Visualize XYZII PCD File

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

Visualize XYZII PCD File

This post has NOT been accepted by the mailing list yet.
This post was updated on .

I am a beginner with working with PCL. I am trying to visualize an XYZI PCD file but I am able to see any points on the viewer. Any idea what went wrong? Kindly help me out!

 pcl::PointCloud<pcl::PointXYZI>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZI>);
  if (pcl::io::loadPCDFile<pcl::PointXYZI> ("test_pcd.pcd", *cloud) == -1) //* load the file
     PCL_ERROR ("Couldn't read file test_pcd.pcd \n");
     return (-1);

  boost::shared_ptr<pcl::visualization::PCLVisualizer> viewer (new pcl::visualization::PCLVisualizer ("3D Viewer"));
  viewer->setBackgroundColor (0, 0, 0);

   pcl::visualization::PointCloudColorHandlerGenericField<pcl::PointXYZI> single_color(cloud, "intensity");
   viewer->addPointCloud<pcl::PointXYZI> (cloud, single_color, "sample cloud");

  viewer->setPointCloudRenderingProperties (pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 3, "sample cloud");
  viewer->addCoordinateSystem (1.0);
  viewer->initCameraParameters ();

  while (!viewer->wasStopped ())
      viewer->spinOnce (100);
      boost::this_thread::sleep (boost::posix_time::microseconds (100000));