在PCLVisualizer中检查点坐标 [英] Checking point coordinates in PCLVisualizer

查看:404
本文介绍了在PCLVisualizer中检查点坐标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

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

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

推荐答案

您必须捕获点拾取事件.

You have to capture the point picking event.

首先创建点选择回调:

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使用它:

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

这篇关于在PCLVisualizer中检查点坐标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆