PCL 1.8.1 可视化点云数据并标记最大点
#include
typedef pcl::PointXYZ PointT;
int main()
{
// 读取PLY文件
pcl::PointCloud
// 寻找骨架中y值最大的连接节点
PointT maxPoint;
float maxY = -std::numeric_limits<float>::infinity();
for (const auto& point : cloud->points) {
if (point.y > maxY) {
maxY = point.y;
maxPoint = point;
}
}
// 标记最大节点为W
maxPoint.label = 'W';
// 可视化
pcl::visualization::CloudViewer viewer("PCL Viewer");
viewer.setBackgroundColor(0, 0, 0);
viewer.addPointCloud(cloud, "cloud");
viewer.setPointCloudRenderingProperties(pcl::visualization::PCL_VISUALIZER_COLOR, 1, 1, 1, "cloud");
// 使用addText3D方法在pcl1.8.1中显示文字
viewer.addText3D("W", maxPoint, 0.1, 1, 1, 1, "label");
viewer.spin();
// 输出PLY文件
pcl::io::savePLYFile("D:\\DIANYUNWENJIANJIA\\Wdianbiaoji_ply.ply", *cloud);
return 0;
}
原文地址: https://www.cveoy.top/t/topic/pBFv 著作权归作者所有。请勿转载和采集!