文章目录
- 环境:
- 1.1 包围盒法介绍:
- 2.1 python代码
- 3.1 可视化
- 4.1 体积Calculation
环境:
Open3D
1.1 包围盒法介绍:
求解离散点最优包围空间
常用的凸包算法:
AABB
OOB
2.1 python代码
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()