- 分辨率实际上取决于您的数据,如果您的点云以米为单位,那么它将是正确的。假设您有一个坐标 A=(1,0,0) 的 x,y,z 点和 B=(0,0,0) 中的另一个点。如果A点沿x轴距离B点1m,那么你是对的。PCL 的约定是点云应该以米为单位。
但只是为了说明:
pcl::PointCloud<pcl::PointXYZ> cloud_in_meters;
resolution = 1.0f;
pcl::octree::OctreePointCloudSearch<pcl::PointXYZ> octree(resolution);
和
pcl::PointCloud<pcl::PointXYZ> cloud_in_meters;
cloud_in_millimeters = cloud_in_meters*1000;
resolution = 1.0f/1000.f;
pcl::octree::OctreePointCloudSearch<pcl::PointXYZ> octree(resolution);
该程序将基本相同。
- 您可以通过 getIntersectedVoxelIndices 获取相交体素中点的索引。我知道这些文档具有误导性,但实际上这正是您所需要的。
例如:
std::vector< int > k_indices;
octree.getIntersectedVoxelIndices(origin, direction, k_indices, 1);
k_indices 是与射线相交的体积中具有点索引的向量。
你可以检查这个函数在做什么:
https ://github.com/PointCloudLibrary/pcl/blob/46cb8fe5589e88e36d79f9b8b8e5f4ff4fceb5de/octree/include/pcl/octree/impl/octree_search.hpp#L613