Problem zooming in pcd viewer

classic Classic list List threaded Threaded
1 message Options
AG
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Problem zooming in pcd viewer

AG
This post has NOT been accepted by the mailing list yet.
Hi,
I am new to pcl. I wrote a code to show xyz coordinates of point clicked by mouse on pcd viewer using online resources however I am unable to zoom in the pcd viewer window after a certain extent. It is giving the xyz coordinates but due to zooming in problem i am unable to identify the objects I need the coordinates of. The code is given below

#include <iostream>
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>
#include <pcl/visualization/pcl_visualizer.h>
#include<pcl/visualization/pcl_plotter.h>
#include <pcl/visualization/point_picking_event.h>

void
pp_callback(const pcl::visualization::PointPickingEvent& event, void* viewer_void)
{
   std::cout << "Picking event active" << std::endl;
     if(event.getPointIndex()!=-1)
     {
         float x,y,z;
         event.getPoint(x,y,z);
         std::cout << x<< ";" << y<<";" << z << std::endl;
     }
}
int
main (int argc, char** argv)
{
  pcl::PointCloud<pcl::PointXYZ>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZ>);

  if (pcl::io::loadPCDFile<pcl::PointXYZ> ("Lab_View.pcd", *cloud) == -1) //* load the file
  {
    PCL_ERROR ("Couldn't read file test_pcd.pcd \n");
    return (-1);
  }
  std::cout << "Loaded "
            << cloud->width * cloud->height
            << std::endl;

  boost::shared_ptr<pcl::visualization::PCLVisualizer> viewer (new pcl::visualization::PCLVisualizer ("3D Viewer"));
  pcl::visualization::PointCloudColorHandlerCustom<pcl::PointXYZ> single_color(cloud, 0, 255, 0);
  viewer->addPointCloud<pcl::PointXYZ> (cloud, single_color, "sample cloud");
  viewer->registerPointPickingCallback (pp_callback,(void*)&viewer);
 
  while (!viewer->wasStopped ())
   {
     viewer->spinOnce (100);
     boost::this_thread::sleep (boost::posix_time::microseconds (100000));
   }
}

Loading...