3

How can I check specific point coordinates in PCLVisualizer? There are no information regarding this topic in help:

| Help:
-------
          p, P   : switch to a point-based representation
          w, W   : switch to a wireframe-based representation (where available)
          s, S   : switch to a surface-based representation (where available)

          j, J   : take a .PNG snapshot of the current window view
          c, C   : display current camera/window parameters
          f, F   : fly to point mode

          e, E   : exit the interactor
          q, Q   : stop and call VTK's TerminateApp

           +/-   : increment/decrement overall point size
     +/- [+ ALT] : zoom in/out 

          g, G   : display scale grid (on/off)
          u, U   : display lookup table (on/off)

    r, R [+ ALT] : reset camera [to viewpoint = {0, 0, 0} -> center_{x, y, z}]

    ALT + s, S   : turn stereo mode on/off
    ALT + f, F   : switch between maximized window mode and original size

          l, L           : list all available geometric and color handlers for the current actor map
    ALT + 0..9 [+ CTRL]  : switch between different geometric handlers (where available)
          0..9 [+ CTRL]  : switch between different color handlers (where available)

    SHIFT + left click   : select a point

          x, X   : toggle rubber band selection mode for left mouse button

Does camera/window parameters contain such information? When I press c I get following output:

0.104105,104.105/-2.05844,1.35894,132.23/-0.65883,-6.36161,134.911/0.252413,0.357973,0.898968/0.523599/640,512/0,52
Szał Pał
  • 306
  • 1
  • 7
  • 20
  • 2
    The point picking callback: http://docs.pointclouds.org/1.2.0/classpcl_1_1visualization_1_1_p_c_l_visualizer.html#ae8d38a6277cbab766b4e4c5e9c9b4e66 – D.J.Duff Nov 02 '14 at 17:13

1 Answers1

5

You have to capture the point picking event.

First create the point picking callback:

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;
   }
}

and then, in your code, tell the PCLvisualizer to use it:

pcl::visualization::PCLVisualizer visualizer("PCL visualizer");
[...]
visualizer.registerPointPickingCallback(pp_callback, (void*)&visualizer);
[...]
visualizer.spin();
pier07
  • 121
  • 1
  • 7