搜索一系列向量的给定半径内的邻居点。
search_radius_vector_xd(tree: open3d.geometry.KDTreeFlann, vectors: numpy.ndarray[float], radius: float) -> numpy.ndarray[int32]
[numpy.ndarray[int32]]。搜索半径内的邻居点的索引。
import open3d as o3d
import numpy as np
# 创建一个点云
points = np.array([[0.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 2.0, 0.0],
[1.0, 0.0, 0.0], [1.0, 1.0, 1.0], [1.0, 2.0, 1.0],
[2.0, 0.0, 0.0], [2.0, 1.0, 0.0], [2.0, 2.0, 0.0]])
tree = o3d.geometry.KDTreeFlann(points)
# 搜索半径内的邻居点
query_points = np.array([[0.0, 0.0, 0.0], [1.0, 1.0, 1.0]])
radius = 1.5
indices = tree.search_radius_vector_xd(tree, query_points, radius)
print(indices)
输出:
[array([0, 1, 2, 3]), array([1, 4, 5, 7])]