使用KD树搜索的维数少于云 [英] Use a KD Tree to search in fewer dimensions than the cloud
问题描述
我想使用2D(xy
)标准在3D(xyz
)中搜索点云.
I'd like to search my 3D (xyz
) for point cloud using a 2D (xy
) criteria.
即找到x = 2 AND y = 4附近的所有点,无论其Z坐标如何"
i.e. "Find all the points near x=2 AND y=4 regardless of their Z coordinate"
从概念上讲,我认为我可以通过创建仅考虑x&的KD树来解决此问题.是的,但是我似乎还是找不到PCL工具来做到这一点.
Conceptually, I thought I could solve this by creating a KD tree that only considered x & y, but I can't seem to find anyway with the PCL tools to do that.
是否有一个好的(已经写好的)方法来做到这一点?还是我必须实现自己的[可能较慢的] Kd树?
Is there a good (already written) way to do this? Or will I have to implement my own [likely slower] Kd tree?
推荐答案
如果您正在考虑KD树,那么对检索到的点有一些限制,无论是最近点数还是它们的距离.
If you were thinking about a KD Tree, then you are having some limits on the retrieved points either by number of closest or their distance.
在您的情况下,那应该是距离,所以,您就得到了(x-dx, x+dx) and (y-dy, y+dy)
之间的点.
In your case, that should be the distance, So, then you get the point between (x-dx, x+dx) and (y-dy, y+dy)
.
在pcl中执行此操作的一种方法是使用 pcl :: getPointsInBox()
One way to do that in pcl is using pcl::getPointsInBox()
在给定边界的情况下获取位于框中的一组点.
Get a set of points residing in a box given its bounds.
参数
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点,如下所示:
So, if you want to get points between x(1.25, 1.75) and y(2.25, 2.75), you have to create the two MinMax points as follows :
PointMin(1.25, 2.25, min_z)
PointMax(1.75, 2.75, max_z)
min_z & max_z
可以任意设置为高和低(-15,40),这意味着您将获得具有指定(x,y)范围的所有点,而无需考虑(z)
min_z & max_z
could be set arbitrarly low and high as(-15, 40), granting that you'll be getting all the points with the specified (x,y) range without regard to (z)
这篇关于使用KD树搜索的维数少于云的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!