在Open3D中,open3d.geometry.OrientedBoundingBox类表示一个有方向的边框框。get_box_points函数可以从一个open3d.geometry.OrientedBoundingBox对象中获取包含该边框框的所有点的坐标。
def get_box_points(self) -> np.ndarray:
该函数没有任何参数。
该函数返回一个形状为(8, 3)的numpy数组,表示该边框框中所有点的坐标。
import open3d as o3d
import numpy as np
box = o3d.geometry.OrientedBoundingBox(center=[0, 0, 0], R=np.eye(3), extent=[1, 2, 3])
box_points = box.get_box_points()
print(box_points)
输出:
[[ 0.5 -1. 1.5]
[ 0.5 -1. -1.5]
[ 0.5 1. 1.5]
[ 0.5 1. -1.5]
[-0.5 -1. 1.5]
[-0.5 -1. -1.5]
[-0.5 1. 1.5]
[-0.5 1. -1.5]]
numpy数组中的每一行都表示一个点的坐标。open3d.geometry.OrientedBoundingBox的get_min_bound()和get_max_bound()函数获取边框框的最小坐标和最大坐标,然后将其加到每个点的坐标上即可。