使用2D信息的3D点云分割

问题描述

我有以下问题:我有一个神经网络,可以检测我在 RGB 图像上寻找的对象的边界框。神经网络返回检测对象边界框的左下角和右上角坐标以及分割掩码。 我想使用此信息使用 pcl 库来区分点云中检测到的对象。 我写了以下代码,但 out_pointcloud 的大小似乎是空的。

           pcl::Vertices x_Box_vertices;
           x_Box_vertices.vertices.push_back(x_bottom_left_vertice);
           x_Box_vertices.vertices.push_back(x_top_right_vertice);

           pcl::Vertices y_Box_vertices;
           y_Box_vertices.vertices.push_back(y_bottom_left_vertice);
           y_Box_vertices.vertices.push_back(y_top_right_vertice);

           std::cout << "Bottom left: " << x_bottom_left_vertice << "," << y_bottom_left_vertice << std::endl;
           std::cout << "Top right: " << x_top_right_vertice<< "," << y_top_right_vertice << std::endl;

           std::vector<pcl::Vertices> Box_vertices{x_Box_vertices,y_Box_vertices};

           pcl::CropHull<pcl::PointXYZRGB> cropFrontHull;
           cropFrontHull.setHullIndices(Box_vertices);
           pcl::PointCloud<pcl::PointXYZRGB>::Ptr p_cloud(new pcl::PointCloud<pcl::PointXYZRGB> (cloud));
           cropFrontHull.setHullCloud(p_cloud);
           std::cout << p_cloud->size() << std::endl;

           pcl::PointCloud<pcl::PointXYZRGB> out_pointcloud;
           cropFrontHull.filter(out_pointcloud);
           std::cout << out_pointcloud.size() << std::endl;

cloud 变量是 pcl::PointCloud<pcl::PointXYZRGB> cloud,它存储点云,我想从中区分检测到的对象。

解决方法

从问题中不清楚您使用的是什么传感器。但您需要的是一种将深度传感器校准为与 RGB 传感器在同一帧中的方法

以下是使用 kinect2 https://github.com/code-iai/iai_kinect2/tree/master/kinect2_calibration 的示例,请查看存储库中“未校准的深度云”​​和“校准的深度云”​​之间的区别。

如果您能够做到这一点,RGB 图像中的 X-Y 将与深度图像中的 X-Y 相同,并且您将不会遇到获得正确点云的问题。