viewer.addPointCloud(model_keypoints, model_keypoint_color, "model_keypoints"); viewer.addPointCloud(scene_keypoints, scene_keypoint_color, "scene_keypoints"); viewer.setPointCloudRenderingProperties(pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 3, "model_keypoints"); viewer.setPointCloudRenderingProperties(pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 3, "scene_keypoints");如何改成对原始点云可视化
时间: 2024-03-21 14:43:50 浏览: 157
Sift特征提取.zip_SIFT特征_matlab提取sift_图像处理_特征 matlab_计算机视觉
5星 · 资源好评率100%
如果你想要可视化原始点云,可以直接使用 `addPointCloud` 函数。下面是示例代码:
```cpp
pcl::visualization::PCLVisualizer viewer("Point Cloud Viewer");
pcl::PointCloud<pcl::PointXYZ>::Ptr model_cloud(new pcl::PointCloud<pcl::PointXYZ>);
pcl::PointCloud<pcl::PointXYZ>::Ptr scene_cloud(new pcl::PointCloud<pcl::PointXYZ>);
// load your model and scene point clouds
// visualize model point cloud
pcl::visualization::PointCloudColorHandlerCustom<pcl::PointXYZ> model_color(model_cloud, 255, 0, 0);
viewer.addPointCloud(model_cloud, model_color, "model_cloud");
viewer.setPointCloudRenderingProperties(pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 3, "model_cloud");
// visualize scene point cloud
pcl::visualization::PointCloudColorHandlerCustom<pcl::PointXYZ> scene_color(scene_cloud, 0, 255, 0);
viewer.addPointCloud(scene_cloud, scene_color, "scene_cloud");
viewer.setPointCloudRenderingProperties(pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 3, "scene_cloud");
while (!viewer.wasStopped())
{
viewer.spinOnce();
}
```
在这个示例中,我们使用 `addPointCloud` 函数可视化了原始的模型点云和场景点云。同时,我们设置了点云的渲染属性,包括点的大小和颜色。最后,我们使用 `viewer.spinOnce()` 函数来显示点云,并且等待用户关闭可视化窗口。
阅读全文