如何在 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

最佳答案

您必须捕获点拾取事件。
首先创建点拾取回调:

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();

关于point-cloud-library - 在 PCLVisualizer 中检查点坐标,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/26699427/

10-12 03:01