Use a KD Tree to search in fewer dimensions than the cloud

限于喜欢 提交于 2019-12-13 20:01:34

问题


I'd like to search my 3D (xyz) for point cloud using a 2D (xy) criteria.

i.e. "Find all the points near x=2 AND y=4 regardless of their Z coordinate"

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.

Is there a good (already written) way to do this? Or will I have to implement my own [likely slower] Kd tree?


回答1:


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.

In your case, that should be the distance, So, then you get the point between (x-dx, x+dx) and (y-dy, y+dy).

One way to do that in pcl is using 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

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 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)



来源:https://stackoverflow.com/questions/37351579/use-a-kd-tree-to-search-in-fewer-dimensions-than-the-cloud

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!