Checking point coordinates in PCLVisualizer

≡放荡痞女 提交于 2019-12-05 21:56:32

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 ();
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!