Point cloud processing based on Open3D 9-bounding box AABB, OBB

A bounding box is a simple geometric space that contains objects of complex shape. The purpose of adding a bounding volume to an object is to quickly perform collision detection or filter before performing accurate collision detection (that is, when the bounding volume collides, accurate collision detection and processing are performed).
insert image description here

Bounding volume types include sphere, axis-aligned bounding box (AABB), oriented bounding box (OBB), 8-DOP, and convex hull;

  • Sphere bounding box: use at least three points to determine the circumcircle (sphere);
  • AABB bounding box: It is simple to calculate the maximum and minimum coordinates, but the space is redundant and cannot better express the real pose of the object;

get_axis_aligned_bounding_box

  • OBB bounding box: PCA is performed first, and the calculation of obtaining the direction with the largest projection variance as the coordinate axis direction is more complicated, but there is no redundancy in space, and it is also the most commonly used;

get_oriented_bounding_box

import open3d as o3d
import numpy as np
pcd = o3d.io.read_point_cloud("./data/bunny.ply")


#获取AABB包围盒
aabb = pcd.get_axis_aligned_bounding_box()
aabb.color = (1, 0, 0)
[center_x, center_y, center_z] = aabb.get_center()
vertices = aabb.get_box_points()
side=aabb.get_extent()


#获取OBB包围盒
obb = pcd.get_oriented_bounding_box()
# obb = pcd.get_minimal_oriented_bounding_box()
obb.color = (0, 0, 1)
[center_x, center_y, center_z] = obb.get_center()
vertices=obb.get_box_points()

o3d.visualization.draw_geometries([pcd, aabb, obb], window_name="bouding box")


insert image description here

Guess you like

Origin blog.csdn.net/zfjBIT/article/details/131036323