20201016-PCL函数-可视化
void showAcloud(pcl::PointCloud<pcl::PointXYZ>::Ptr cloud)
{
//TODO::添加一个点云cloud并显示在窗口中,id为Acloud,颜色为random_green,点的大小设置为2
pcl::visualization::PCLVisualizer viewer("look!");
viewer.setBackgroundColor(1, 1, 1);
viewer.initCameraParameters();
pcl::visualization::PointCloudColorHandlerCustom<pcl::PointXYZ> random_green(cloud, 100, 200, 50);
viewer.addPointCloud(cloud, random_green, "Acloud");
viewer.setPointCloudRenderingProperties(pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 2, "Acloud");
while (!viewer.wasStopped())
{
viewer.spinOnce(100);
}
return;
}
void showAcloud(pcl::PointCloud<pcl::PointXYZ>::Ptr Acloud, pcl::PointCloud<pcl::PointXYZ>::Ptr Bcloud)
{
//TODO::添加两个点云cloudA,cloudB并显示在窗口中,id为Acloud,颜色为random_green,另一个id为Bcloud,颜色为random_red,点的大小设置为2
pcl::visualization::PCLVisualizer viewer("look!");
viewer.setBackgroundColor(1, 1, 1);
viewer.initCameraParameters();
pcl::visualization::PointCloudColorHandlerCustom<pcl::PointXYZ> random_green(Acloud, 100, 200, 50);
pcl::visualization::PointCloudColorHandlerCustom<pcl::PointXYZ> random_red(Bcloud, 200, 50, 200);
viewer.addPointCloud(Acloud, random_green, "Acloud");
viewer.addPointCloud(Bcloud, random_red, "Bcloud");
viewer.setPointCloudRenderingProperties(pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 2, "Acloud");
viewer.setPointCloudRenderingProperties(pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 2, "Bcloud");
while (!viewer.wasStopped())
{
viewer.spinOnce(100);
}
return;
}
主函数
int main()
{
//可视化两个点云
showAcloud(cloud, RNcloud);
return;
}