要将pcl::PointXYZ点的索引的颜色设置为绿色,并使用一个小球来表示,您可以使用PointCloud的可视化工具来实现。下面是一个示例代码:

#include <pcl/visualization/pcl_visualizer.h>

// 创建PCL可视化对象
pcl::visualization::PCLVisualizer::Ptr viewer(new pcl::visualization::PCLVisualizer("PointCloud Viewer"));

// 设置背景颜色为黑色
viewer->setBackgroundColor(0, 0, 0);

// 设置点云颜色为绿色
pcl::PointXYZ point = cloud->points[57];
viewer->addSphere(point, 0.05, 0, 255, 0);

// 显示点云
viewer->spin();

在上述代码中,我们使用PCLVisualizer创建了一个名为"PointCloud Viewer"的可视化对象。然后,我们将背景颜色设置为黑色,并将点的颜色设置为绿色。最后,我们使用addSphere函数向可视化对象中添加一个半径为0.05的小球,其颜色为绿色。最后,调用spin函数显示点云

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

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

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