isl-org / isl-org/Open3D

Use o3d.geometry.KDTreeFlann with o3d.t.geometry.PointCloud

Open
#6,314 4 comments 0 reactions 1 assignee Claimed by @theNded View on GitHub
documentation neighbor search question
Dominant language
C++
Stars
14k
Forks
2.6k
Avg merge
5d 18h
Merged PRs (30d)
6

Description

### Checklist

- [X] I have searched for [similar issues](https://github.com/isl-org/Open3D/issues).
- [X] For Python issues, I have tested with the [latest development wheel](http://www.open3d.org/docs/latest/getting_started.html#development-version-pip).
- [X] I have checked the [release documentation](http://www.open3d.org/docs/release/) and the [latest documentation](http://www.open3d.org/docs/latest/) (for `master` branch).

### My Question

Hello,

I register two point clouds and then I'd like to find several nearest neighbors in the moving point cloud for each point in the fixed point cloud. I handle point clouds using `o3d.t.geometry.PointCloud`, especially because I have additional custom attributes of the points that I need to read and write.
I try to use `o3d.geometry.KDTreeFlann ` like this:

```
pcd1 = o3d.t.io.read_point_cloud("point_cloud_1.pcd")
pcd2 = o3d.t.io.read_point_cloud("point_cloud_2.pcd")
pcd1_tree = o3d.geometry.KDTreeFlann(pcd1.point.positions.numpy())
example_point = pcd2.point.positions.numpy()[0]
n, idx, d = pcd1_tree.search_hybrid_vector_3d(example_point, 10, 1)

```
which gives
`
RuntimeError: search_hybrid_vector_3d() error!
`
I assume that the data type of the point is wrong (it's `float64` numpy array) but not sure how to fix it.
Is there a way to do the same without going back to the legacy geometry classes?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.