在PCL中的QVTK中,调用 performAreaPick()遇到2个问题:
1)通过 pcl::visualization::PCLVisualizerInteractorStyle的StartSelect()函数设置为选择模式时,执行performAreaPick出错,通过按键盘x进入则不会出错;
2)有时候这个函数选不到点,我仔细逐步看过,确定对应坐标范围不是空白,而且实际确实有点。
请教各位多指教
运行环境:PCL1.8.0 VTK7.0 win10 x64
void PCSRviewer::mouseMoveEventCallback(const pcl::visualization::MouseEvent& event, void* cooki)
{
viewer = *static_cast<boost::shared_ptr<pcl::visualization::PCLVisualizer> *>(cooki);
vtkSmartPointer<vtkRenderWindow> Rwin = viewer->getRenderWindow( );
vtkRenderWindowInteractor* iren = Rwin ->GetInteractor( );
pcl::visualization::PCLVisualizerInteractorStyle* style = viewer->getInteractorStyle( );
pcl::visualization::MouseEvent::MouseButton button = event.getButton( );
pcl::visualization::MouseEvent::Type type = event.getType( );
// style->StartSelect();
//这里本身不出错,编译能通过。但通过它进入选择模式后,后面performAreaPick()出错。通过按键盘x进入选择模式,则不会出错。
if(event.getSelectionMode( ) == true)
{
if(button == pcl::visualization::MouseEvent::MouseButton::LeftButton)
{
vector<int> AreaIndices;
int areaidx = performAreaPick(iren, AreaIndices);
if(areaidx > 0)
emit sigSendPolygonPickingIndicesToWin(AreaIndices, polygon);
}
}
}
我希望:1)能够通过style->StartSelect(); 这个方式进入选择模式,避免按键盘x。
2)能够按照屏幕坐标来设定矩形范围,并给出当前屏幕上指定范围内的点;或者鼠标划过范围的屏幕上的点。