isl-org / isl-org/Open3D

[Bug] 3D Bounding Box Improper Rotation Matrices

Open
#5,388 4 comments 0 reactions 0 assignees View on GitHub
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 Observation
Using : open3d 0.15.2

TLDR; Orientated Bounding Boxes are inconsistent:
- Mix between proper and improper Rotation matrices
- Mix of reflections in improper Rotation matrices
- Incompatible with other frameworks.
____________________________________________________________________________________________________

Hello,
I am creating bounding boxes from pointcloud clusters. I am using orientated bounding boxes. Rotating the bounding box by its transposed Rotation matrix will align it with the axes (I know allignedbboxes exist, this is just to describe the issue). This works correctly if I stick with open3d.

However other packages (scipy, spatialmath) have issues with the Open3D rotation matrix. Converting to quaternion or vectors and reversing into rotation matrix causes issues and the rotations are incorrect. I have observed that the determinant of the Open3D Rotation matrices are mixed between -1 and 1. This inconsistency is incompatible with all frameworks I have tried (scipy, pytransform3d, spatialmath, etc.) (Picture 1 vs Picture 2. This makes further processing challenging/impossible.

`
bbox = o3d.geometry.OrientedBoundingBox.create_from_points(points=pc.points)
r = R.from_matrix(np.array(bbox.R))
bbox.rotate(np.transpose(r.as_matrix()))
`

This is what it looks like if I transpose the open3d rotation matrix with scipy.
![scipy](https://user-images.githubusercontent.com/72140033/182162558-4e2f7864-d2ad-42f1-9d46-b7f3230e3d83.png)

This is what it looks like if I transpose the incorrect Open3D rotation matrices (expected result)
![o3d](https://user-images.githubusercontent.com/72140033/182162561-e3e3cf31-4ebc-4579-b01b-f57216574760.png)

I have found a workaround : [credit](https://bytemeta.vip/repo/intel-isl/Open3D/issues/4006), however, this shows the next issue. See the box of the small window and compare it to the last picture. Within the improper rotation matrices, the reflections are inconsistent. Some aligned boxes "fell over" on their side instead of remaining upright. Others align correctly.

![1](https://user-images.githubusercontent.com/72140033/182566243-f22640ca-d900-4304-b23a-92035324871d.png)

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.