Skip to content

KDTreeFlann search error with step by step run #6235

@shaochengyan

Description

@shaochengyan

Checklist

Describe the issue

I have a raw points (Point Cloud):

pts.shape, pts.dtype, pts
((16384, 3), dtype('float64'), array([[-31.31369972...9332435]]))

First, I create a KDTree with those pts:

tree = o3d.geometry.KDTreeFlann(pts.T)  # pts: Nx3 PointCloud

Second, I search the first point of pts 4 time and print the search result:

for i in range(4):
    [_, idx, _] = tree.search_radius_vector_3d(pts[1], 1.0)
    print(idx)

And I get the right output:

IntVector[394, 8041, 13635, 8113, 8973, 8188, 7123, 12216, 10548, 4917, 12064, 7143, 12259, 10308, 7851, 11758, 7895, 6135, 6029, 15343, 13311, 900, 13522, 1754, 15737, 15095, 13257, 16065, 8997, 2104, 7788, 15170, 16380, 11741, 10534, 11297, 14786, 2958, 12394, 13639, 2518, 8299, 8166, 2005, 11585, 11278, 3435, 138, 3111, 14269, 3733, 4541, 12016, 15167, 708, 9356, 5590, 1720, 8538, 14302, 1021, 7559, 6001, 6838, 7665, 1514, 4528, 11021, 6099, 3882, 3538, 8620, 5909, 11504, 1418, 4362]
IntVector[394, 8041, 13635, 8113, 8973, 8188, 7123, 12216, 10548, 4917, 12064, 7143, 12259, 10308, 7851, 11758, 7895, 6135, 6029, 15343, 13311, 900, 13522, 1754, 15737, 15095, 13257, 16065, 8997, 2104, 7788, 15170, 16380, 11741, 10534, 11297, 14786, 2958, 12394, 13639, 2518, 8299, 8166, 2005, 11585, 11278, 3435, 138, 3111, 14269, 3733, 4541, 12016, 15167, 708, 9356, 5590, 1720, 8538, 14302, 1021, 7559, 6001, 6838, 7665, 1514, 4528, 11021, 6099, 3882, 3538, 8620, 5909, 11504, 1418, 4362]
IntVector[394, 8041, 13635, 8113, 8973, 8188, 7123, 12216, 10548, 4917, 12064, 7143, 12259, 10308, 7851, 11758, 7895, 6135, 6029, 15343, 13311, 900, 13522, 1754, 15737, 15095, 13257, 16065, 8997, 2104, 7788, 15170, 16380, 11741, 10534, 11297, 14786, 2958, 12394, 13639, 2518, 8299, 8166, 2005, 11585, 11278, 3435, 138, 3111, 14269, 3733, 4541, 12016, 15167, 708, 9356, 5590, 1720, 8538, 14302, 1021, 7559, 6001, 6838, 7665, 1514, 4528, 11021, 6099, 3882, 3538, 8620, 5909, 11504, 1418, 4362]
IntVector[394, 8041, 13635, 8113, 8973, 8188, 7123, 12216, 10548, 4917, 12064, 7143, 12259, 10308, 7851, 11758, 7895, 6135, 6029, 15343, 13311, 900, 13522, 1754, 15737, 15095, 13257, 16065, 8997, 2104, 7788, 15170, 16380, 11741, 10534, 11297, 14786, 2958, 12394, 13639, 2518, 8299, 8166, 2005, 11585, 11278, 3435, 138, 3111, 14269, 3733, 4541, 12016, 15167, 708, 9356, 5590, 1720, 8538, 14302, 1021, 7559, 6001, 6838, 7665, 1514, 4528, 11021, 6099, 3882, 3538, 8620, 5909, 11504, 1418, 4362]

However, when I next execute the search code again, it is wrong as:

image
You can see, when I execute the same code second time, it return null idx!

Steps to reproduce the bug

This happen occasional.

Error message

I have a raw points (Point Cloud):

pts.shape, pts.dtype, pts
((16384, 3), dtype('float64'), array([[-31.31369972...9332435]]))

First, I create a KDTree with those pts:

tree = o3d.geometry.KDTreeFlann(pts.T)  # pts: Nx3 PointCloud

Second, I search the first point of pts 4 time and print the search result:

for i in range(4):
    [_, idx, _] = tree.search_radius_vector_3d(pts[1], 1.0)
    print(idx)

And I get the right output:

IntVector[394, 8041, 13635, 8113, 8973, 8188, 7123, 12216, 10548, 4917, 12064, 7143, 12259, 10308, 7851, 11758, 7895, 6135, 6029, 15343, 13311, 900, 13522, 1754, 15737, 15095, 13257, 16065, 8997, 2104, 7788, 15170, 16380, 11741, 10534, 11297, 14786, 2958, 12394, 13639, 2518, 8299, 8166, 2005, 11585, 11278, 3435, 138, 3111, 14269, 3733, 4541, 12016, 15167, 708, 9356, 5590, 1720, 8538, 14302, 1021, 7559, 6001, 6838, 7665, 1514, 4528, 11021, 6099, 3882, 3538, 8620, 5909, 11504, 1418, 4362]
IntVector[394, 8041, 13635, 8113, 8973, 8188, 7123, 12216, 10548, 4917, 12064, 7143, 12259, 10308, 7851, 11758, 7895, 6135, 6029, 15343, 13311, 900, 13522, 1754, 15737, 15095, 13257, 16065, 8997, 2104, 7788, 15170, 16380, 11741, 10534, 11297, 14786, 2958, 12394, 13639, 2518, 8299, 8166, 2005, 11585, 11278, 3435, 138, 3111, 14269, 3733, 4541, 12016, 15167, 708, 9356, 5590, 1720, 8538, 14302, 1021, 7559, 6001, 6838, 7665, 1514, 4528, 11021, 6099, 3882, 3538, 8620, 5909, 11504, 1418, 4362]
IntVector[394, 8041, 13635, 8113, 8973, 8188, 7123, 12216, 10548, 4917, 12064, 7143, 12259, 10308, 7851, 11758, 7895, 6135, 6029, 15343, 13311, 900, 13522, 1754, 15737, 15095, 13257, 16065, 8997, 2104, 7788, 15170, 16380, 11741, 10534, 11297, 14786, 2958, 12394, 13639, 2518, 8299, 8166, 2005, 11585, 11278, 3435, 138, 3111, 14269, 3733, 4541, 12016, 15167, 708, 9356, 5590, 1720, 8538, 14302, 1021, 7559, 6001, 6838, 7665, 1514, 4528, 11021, 6099, 3882, 3538, 8620, 5909, 11504, 1418, 4362]
IntVector[394, 8041, 13635, 8113, 8973, 8188, 7123, 12216, 10548, 4917, 12064, 7143, 12259, 10308, 7851, 11758, 7895, 6135, 6029, 15343, 13311, 900, 13522, 1754, 15737, 15095, 13257, 16065, 8997, 2104, 7788, 15170, 16380, 11741, 10534, 11297, 14786, 2958, 12394, 13639, 2518, 8299, 8166, 2005, 11585, 11278, 3435, 138, 3111, 14269, 3733, 4541, 12016, 15167, 708, 9356, 5590, 1720, 8538, 14302, 1021, 7559, 6001, 6838, 7665, 1514, 4528, 11021, 6099, 3882, 3538, 8620, 5909, 11504, 1418, 4362]

However, when I next execute the search code again, it is wrong as:

image
You can see, when I execute the same code second time, it return null idx!

Expected behavior

No response

Open3D, Python and System information

- Operating system: Ubuntu 20.04
- Python version: Python 3.7
- Open3D version: 0.17.0
- System architecture: x86
- Is this a remote workstation?: My wsl2
- How did you install Open3D?: pip

Additional information

No response

Metadata

Metadata

Assignees

Labels

bugNot a build issue, this is likely a bug.neighbor searchNearest neighbor search related.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions