Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] camera extrinsics #101

Open
3 tasks done
Yangr116 opened this issue Feb 23, 2025 · 0 comments
Open
3 tasks done

[Bug] camera extrinsics #101

Yangr116 opened this issue Feb 23, 2025 · 0 comments

Comments

@Yangr116
Copy link

Yangr116 commented Feb 23, 2025

Prerequisite

Task

I'm using the official example scripts/configs for the officially supported tasks/models/datasets.

Branch

main branch https://github.com/open-mmlab/mmdetection3d

Environment

torch

Reproduces the problem - code sample

Background:

I would like to convert the bbox of your great dataset into the format of Omni3D. So, I need to convert get the rotation matrix of a bbox (from the initial bbox coordinate into the camera coordinate).

My camera coordinate is: X towards right, Y towards down, Z towards into the screen. I think this is aligned with the camera coordinate in this dataset. (

Coordinates in Camera:
.. code-block:: none
z front
/
/
0 ------> x right
|
|
v
down y
)

I find that the bbox in this dataset lies in the world coordinate according to this code:

corners_img = intrinsic @ extrinsic_w2c @ corners.transpose()

When I visualize the box using my visualization code. I find the top face (blue-green) of the box is to the left:

Image

I print the 3d bbox info of a data point in the scannet:

explorer.show_image('scannet/scene0415_00', '00000', render_box=True)

And I add the below code into the line in

instance = select['instances'][i]
to check the bbox information:

                        import math
                        from scipy.spatial.transform import Rotation
                        print(f"#### {self.classes[self.id_to_index[instance['bbox_label_3d']]]}####")
                        print(f"bbox_3d in ann: {instance['bbox_3d']}")
                        angle = [1, 1, 1]
                        angle[:3] = map(lambda x: x*180 / math.pi, instance['bbox_3d'][-3:])
                        print(f"angle {angle}")
                        print(f"extrinsic: {extrinsic}")
                        extrinsic_w2c = np.linalg.inv(extrinsic)
                        rotmat = Rotation.from_matrix(extrinsic_w2c[:3, :3])
                        euler_angle = rotmat.as_euler('xyz', degrees=True).tolist()
                        print(f"extrinsic angle: {euler_angle}")

For a bounding box:

toilet####

bbox_3d in ann: [-0.42515089947718376, 0.31674408904254436, 0.3837619480912089, 0.7353889074944258, 0.4506813515427113, 0.8246120158582926, -0.0, 0.0, -0.0]
angle [-0.0, 0.0, -0.0]
extrinsic: [[-0.03071581 0.58103032 -0.81330209 0.29357407]
[ 0.9991814 0.03927344 -0.00967998 0.18009791]
[ 0.026316 -0.812934 -0.581761 1.199998 ]
[ 0. 0. 0. 1. ]]
extrinsic angle: [-179.04680239144434, 54.41982902742494, 93.02611718726739]

This shows that the Z-axis is rotated 90.

Why Z-axis is rotated 90?

Reproduces the problem - command or script

see before

Reproduces the problem - error message

rotation problem

Additional information

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant