isl-org / Open3D

Open3D: A Modern Library for 3D Data Processing
http://www.open3d.org
Other
11.07k stars 2.26k forks source link

Minimal oriented bounding box is not minimal #6866

Closed belalhmedan90 closed 2 weeks ago

belalhmedan90 commented 1 month ago

Checklist

Describe the issue

I get non-minmal bounding box when calling get_minimal_oriented_bounding_box

minimal_obbox

Steps to reproduce the bug

import open3d as o3d

box_pcl = o3d.io.read_point_cloud(os.path.join(test_data_path, "pcl.ply"))

box_mesh = o3d.geometry.TriangleMesh.create_from_point_cloud_alpha_shape(
    pcd=box_pcl, alpha=1.0
)

obbox = box_pcl.get_minimal_oriented_bounding_box(robust=True)
obbox.color = [0.5, 0.2, 0.7]

obbox2 = box_mesh.get_minimal_oriented_bounding_box(robust=True)
obbox2.color = [0.5, 0.7, 0.2]
## Visu
o3d.visualization.draw_geometries(
    [box_mesh, obbox, obbox2],
    window_name="minimal_obbox",
    point_show_normal=False,
    mesh_show_wireframe=False,
    mesh_show_back_face=False,
)

Error message

No response

Expected behavior

To get minimal Oriented Bounding Box

Open3D, Python and System information

- Operating system: Ubuntu 20.04
- Python version: Python 3.8
- Open3D version: 0.18.0
- System architecture: x86
- Is this a remote workstation?: no
- How did you install Open3D?: pip
- Compiler version (if built from source): gcc 7.5

Additional information

No response

nicolaloi commented 1 month ago

I have reproduced the error, which is probably caused by MeshBase::GetMinimalOrientedBoundingBox having the same body as MeshBase::GetOrientedBoundingBox, instead of being similar to PointCloud::GetMinimalOrientedBoundingBox.

I'll open a PR.