使用 KD 树搜索比云更少的维度
Use a KD Tree to search in fewer dimensions than the cloud
我想使用 2D (xy
) 条件在我的 3D (xyz
) 中搜索点云。
即"Find all the points near x=2 AND y=4 regardless of their Z coordinate"
从概念上讲,我认为我可以通过创建一个只考虑 x 和 y 的 KD 树来解决这个问题,但我似乎无法找到 PCL 工具来做到这一点。
有没有好的(已经写好的)方法来做到这一点?还是我必须实现自己的[可能更慢] Kd 树?
如果您正在考虑 KD 树,那么您对检索点的最近数量或它们的距离有一些限制。
在你的情况下,那应该是距离,所以,你得到 (x-dx, x+dx) and (y-dy, y+dy)
.
之间的点
在 pcl 中做到这一点的一种方法是使用 pcl::getPointsInBox()
Get a set of points residing in a box given its bounds.
Parameters
cloud the point cloud data message
min_pt the minimum bounds
max_pt the maximum bounds
indices the resultant set of point indices residing in the box
所以,如果你想得到 x(1.25, 1.75) 和 y(2.25, 2.75) 之间的点,你必须按如下方式创建两个 MinMax 点:
PointMin(1.25, 2.25, min_z)
PointMax(1.75, 2.75, max_z)
min_z & max_z
可以设置为任意低和高如 (-15, 40),保证您将获得指定 (x,y) 范围内的所有点,而不考虑 (z)
我想使用 2D (xy
) 条件在我的 3D (xyz
) 中搜索点云。
即"Find all the points near x=2 AND y=4 regardless of their Z coordinate"
从概念上讲,我认为我可以通过创建一个只考虑 x 和 y 的 KD 树来解决这个问题,但我似乎无法找到 PCL 工具来做到这一点。
有没有好的(已经写好的)方法来做到这一点?还是我必须实现自己的[可能更慢] Kd 树?
如果您正在考虑 KD 树,那么您对检索点的最近数量或它们的距离有一些限制。
在你的情况下,那应该是距离,所以,你得到 (x-dx, x+dx) and (y-dy, y+dy)
.
在 pcl 中做到这一点的一种方法是使用 pcl::getPointsInBox()
Get a set of points residing in a box given its bounds.
Parameters
cloud the point cloud data message min_pt the minimum bounds max_pt the maximum bounds indices the resultant set of point indices residing in the box
所以,如果你想得到 x(1.25, 1.75) 和 y(2.25, 2.75) 之间的点,你必须按如下方式创建两个 MinMax 点:
PointMin(1.25, 2.25, min_z)
PointMax(1.75, 2.75, max_z)
min_z & max_z
可以设置为任意低和高如 (-15, 40),保证您将获得指定 (x,y) 范围内的所有点,而不考虑 (z)