0

有一个浊点向量,

std::vector<pcl::PointCloud<pcl::PointXYZI>::Ptr> cloud_points(2);

我设法将它们绘制为点:

pcl::visualization::PointCloudColorHandler<pcl::PointXYZI>::Ptr cloud_points_left(new pcl::visualization::PointCloudColorHandlerCustom<pcl::PointXYZI>(255, 0, 0));
        pcl::visualization::PointCloudColorHandler<pcl::PointXYZI>::Ptr cloud_points_right(new pcl::visualization::PointCloudColorHandlerCustom<pcl::PointXYZI>(0, 0, 255));

handler_cloud_points->setInputCloud(cloud_points);
viewer->addPointCloud(cloud_points, *handler_cloud_points, "cloud", vector);
viewer->setPointCloudRenderingProperties(pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 1, "cloud", vector);
viewer->setPointCloudRenderingProperties(pcl::visualization::PCL_VISUALIZER_OPACITY, 1, "cloud", vector);

cloud_points_left->setInputCloud(cluster_cloud_points[0]);
viewer->addPointCloud(cluster_cloud_points[0], *cloud_points_left, "left", vector);
viewer->setPointCloudRenderingProperties(pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 5, "left", vector);
     

cloud_points_right->setInputCloud(cluster_cloud_points[1]);
viewer->addPointCloud(cluster_cloud_points[1], *cloud_points_right, "right", vector);
viewer->setPointCloudRenderingProperties(pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 5, "right", vector);

我设法用 addLine 函数在左点之间画了一条线:

viewer->addLine<pcl::PointXYZI>(cluster_cloud_points[0]->points[0], cluster_cloud_points[0]->points[cluster_cloud_points[0]->points.size() - 1], "line");

但我实际上想要在 addLine 函数中作为前 2 个参数给出的这 2 个点之间的曲线。有什么办法可以做到这一点?

4

0 回答 0