检查PCLVisualizer中的点坐标

时间:2014-11-02 12:45:57

标签: point-cloud-library point-clouds

如何检查PCLVisualizer中的特定点坐标?帮助中没有关于此主题的信息:

| 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

camera/window parameters是否包含此类信息?当我按c时,我得到以下输出:

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

1 个答案:

答案 0 :(得分:2)

您必须捕获点选择事件。

首先创建点选择回调:

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

然后,在您的代码中,告诉PCLvisualizer使用它:

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