您可以使用pcl::visualization::PointCloudColorHandlerCustom类将索引为57的点的颜色设置为绿色,并使用pcl::visualization::PointCloudGeometryHandlerSphere类可视化为一个小球。

以下是示例代码:

// 设置点云颜色处理器为绿色
pcl::visualization::PointCloudColorHandlerCustom<pcl::PointXYZ> color_handler(cloud, 0, 255, 0);

// 设置点云几何处理器为球体
pcl::visualization::PointCloudGeometryHandlerSphere<pcl::PointXYZ> geometry_handler(cloud, 0.01);

// 创建点云可视化对象
pcl::visualization::PCLVisualizer viewer("PointCloud Viewer");

// 添加点云到可视化对象中,使用设置的颜色和几何处理器
viewer.addPointCloud<pcl::PointXYZ>(cloud, color_handler, geometry_handler, "cloud");

// 设置点云显示大小
viewer.setPointCloudRenderingProperties(pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 1, "cloud");

// 显示点云
viewer.spin();

请注意,这里的代码假设您已经加载了点云数据到cloud变量中。您可能需要根据您的实际情况进行修改

pclPointXYZ point5 = cloud-points57;把这个点的索引的颜色设置为绿色并且可视化用一个小球表示

原文地址: https://www.cveoy.top/t/topic/h8sg 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录