isl-org / isl-org/Open3D

Inconsistent rotation matrix of get_oriented_bounding_box()

Open
#6,245 1 comment 0 reactions 0 assignees View on GitHub
boundingbox question
Dominant language
C++
Stars
14k
Forks
2.6k
Avg merge
5d 18h
Merged PRs (30d)
6

Description

### Checklist

- [X] I have searched for [similar issues](https://github.com/isl-org/Open3D/issues).
- [X] For Python issues, I have tested with the [latest development wheel](http://www.open3d.org/docs/latest/getting_started.html#development-version-pip).
- [X] I have checked the [release documentation](http://www.open3d.org/docs/release/) and the [latest documentation](http://www.open3d.org/docs/latest/) (for `master` branch).

### My Question

I extract the rotation matrix, as well as centre points and all corner points of individual bounding boxes with the following code.

`for i in range(labels.max()+1):
# id is array of point names in main point cloud, owned by cluster with label i
id = np.where(labels == i)[0]
pcd_i = outlier_cloud.select_by_index(id)
obb = pcd_i.get_oriented_bounding_box() #robust=False robust flag doen't work

#check if the OBB rotatio matrix is right--handed
rot_mat = obb.R
#rot_mat = getRotationMatrix(rotation_matrix=obb.R)
#check if the cluster is useful
center_point = obb.get_center()
obb.color = (0,1,0)
mesh_r = o3d.geometry.TriangleMesh.create_coordinate_frame(0.1,origin = obb.get_center())
mesh_r.rotate(rot_mat, obb.get_center())

#use only the bounding boxes where the center point is smaller than a treshold value
if center_point[2] <= mean_z_value:
boxes_rotation.append(np.asarray(rot_mat)) #add cornerpoints to list
boxes_center.append(np.asarray(obb.get_center()))
boxes_corner.append(np.asarray(obb.get_box_points()))

box_list.append(obb)
box_list.append(mesh_r)`

I then use the data in a robotics simulation environment to create the boxes in a virtual enviroment. I have noticed that it seems as if the rotation matrix of individual bounding boxes is not consistent.

I always need the rotation to start from a world coordinate system. Can anyone help me with this?

Many thanks for the help.

![image](https://github.com/isl-org/Open3D/assets/78587101/d1cabc62-f5e5-42bf-bac1-88325e6ae283)
Results in Open3D

![image](https://github.com/isl-org/Open3D/assets/78587101/c11448f4-5ca2-4740-881b-e521a44ef313)
Results in robotics simulation

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.