Skip to content

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

Open
@Buglakova

Description

@Buglakova

Checklist

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?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions