标签:现在 方法 ice udid poi static end pcl vat
这是类中的声明
private://点云回调函数 NuClearTask_MyPointCloudHandle //点云选择 static void ps_callback(const pcl::visualization::AreaPickingEvent& event, void* object) { NuClearTask *pThisObject = (NuClearTask*)object; pThisObject->PointSelect_callback(event); } void PointSelect_callback(const pcl::visualization::AreaPickingEvent& event);
调用的时候把点云所在类的对象指针传入
NuPointCloudHandle.viewer->registerAreaPickingCallback(ps_callback, (void*)this);
方法的实现在PointSelect_callback函数中
//点云选择 void NuClearTask::PointSelect_callback(const pcl::visualization::AreaPickingEvent& event) { static int num = 0; NuPointCloudHandle.selected_points_3d->points.clear(); std::vector< int > indices; if ((int)event.getPointsIndices(indices) == -1) return; for (int i = 0; i < indices.size(); ++i) { NuPointCloudHandle.selected_points_3d->points.push_back(NuPointCloudHandle.cloud->points.at(indices[i])); } std::string cloudName = to_string(num++) + "cloudred"; pcl::visualization::PointCloudColorHandlerCustom<PointTypeXYZ> red(NuPointCloudHandle.selected_points_3d, 255, 0, 0); NuPointCloudHandle.viewer->addPointCloud(NuPointCloudHandle.selected_points_3d, red, cloudName); NuPointCloudHandle.viewer->setPointCloudRenderingProperties(pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 3, cloudName); NuPointCloudHandle.viewer->updatePointCloud(NuPointCloudHandle.cloud, CloudID); }
标签:现在 方法 ice udid poi static end pcl vat
原文地址:https://www.cnblogs.com/Summerio/p/10160731.html