isl-org / Open3D

Open3D: A Modern Library for 3D Data Processing
http://www.open3d.org
Other
11.44k stars 2.31k forks source link

octree to search for the nearest neighbor #5071

Open david-ngo-sixense opened 2 years ago

david-ngo-sixense commented 2 years ago

Checklist

My Question

Hello,

Thanks for your library. It is very great. I have a question concerning to octree (that I didn't find an answer in the documentation). Can we use octree to find the nearest neighbor of a point (with coordinate (x, y, z)). I know that in open3d, we use kdtree (knn) to search for a nearest neighbor. But I think it is faster in octree than in kdtree (in particular for the big point cloud).

Many thanks.

JTvD commented 1 year ago

Heey @david-ngo-sixense, its a late reply but according to the documentation it is possible to find the leafnode which contains the point with this function: http://www.open3d.org/docs/latest/tutorial/geometry/octree.html#Find-leaf-node-containing-point I tried both a kdtree and octree approach and in my case the kdtree is faster because it always returns a given number of points. For the octree you can have no neighboring points or thousands of them. Which is advisable depends on the usecase.