Open3D
求解离散点最优包围空间
常用的凸包算法:
AABB
OOB
conda activete deeplabv3plus(环境名称–安装好open3D的)
python demo.py
import open3d as o3d
def main():
# 读取点云数据
pc = o3d.io.read_point_cloud("downsampled_pcd.pcd")
# 获取点云的包围盒
aabb_box = pc.get_axis_aligned_bounding_box()
aabb_box.color = (1, 0, 0)
obb_box = pc.get_oriented_bounding_box()
obb_box.color = (0, 1, 0)
# 计算包围盒体积
aabb_volume = aabb_box.volume()
obb_volume = obb_box.volume()
print(f"aabb算法包围盒体积: {aabb_volume} ")
print(f"obb算法包围盒体积: {obb_volume} ")
# 可视化
o3d.visualization.draw_geometries([aabb_box, obb_box, pc], "result", 800, 600, 50, 50, False, False, True)
if __name__ == "__main__":
main()