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

Convert Cuboid2D to/from KITTI 3D data #1639

Merged
merged 4 commits into from
Oct 16, 2024

Conversation

itrushkin
Copy link
Contributor

@itrushkin itrushkin commented Oct 14, 2024

Summary

CVS-151427

New features

  • New Cuboid2D methods:
    • Cuboid2D.from_3d(dimensions, location, rotation_y, P, Tr_velo_to_cam): Creates a Cuboid2D object from KITTI 3D bbox annotation data. Matrix P (P2 in Kitti format context) is a 3x4 projection matrix in the left color camera coordinate system. Matrix Tr_velo_to_cam is a 3x4 projection matrix between LiDAR and camera coordinate systems.
    • cuboid_2d.to_3d(P_inv): Reconstructs approximate KITTI 3D bbox annotation data (dimensions, location and rotation_y) from 2D projection coordinates. P_inv matrix is a pseudo-inverse of camera-to-image projection matrix.

How to test

See unit test changes

Checklist

  • I have added unit tests to cover my changes.​
  • I have added integration tests to cover my changes.​
  • I have added the description of my changes into CHANGELOG.​
  • I have updated the documentation accordingly

License

  • I submit my code changes under the same MIT License that covers the project.
    Feel free to contact the maintainers if that's a concern.
  • I have updated the license header for each file (see an example below).
# Copyright (C) 2024 Intel Corporation
#
# SPDX-License-Identifier: MIT

Signed-off-by: Ilya Trushkin <[email protected]>
@itrushkin itrushkin requested review from a team as code owners October 14, 2024 12:03
@itrushkin itrushkin requested review from sooahleex and removed request for a team October 14, 2024 12:03
Signed-off-by: Ilya Trushkin <[email protected]>
Copy link

codecov bot commented Oct 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.23%. Comparing base (ff5fd94) to head (067bf4a).
Report is 20 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1639      +/-   ##
===========================================
+ Coverage    81.06%   81.23%   +0.16%     
===========================================
  Files          278      281       +3     
  Lines        32517    32881     +364     
  Branches      6607     5289    -1318     
===========================================
+ Hits         26360    26710     +350     
- Misses        4701     4721      +20     
+ Partials      1456     1450       -6     
Flag Coverage Δ
ubuntu-20.04_Python-3.10 81.21% <100.00%> (+0.16%) ⬆️
windows-2022_Python-3.10 81.21% <100.00%> (+0.16%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

return np.array([a, b, c, d])

@staticmethod
def _get_denorm(Tr_velo_to_cam_homo):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a question, what is the meaning of Tr_velo_to_cam_homo?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Calibration matrix Tr_velo_to_cam has a shape of 3 x 4. To project 3D points to the 2D plane, we need to have homogeneous coordinates where each point is represented as a vector with 1 additional dimension.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the projection matrix between Velodyne LiDAR to Camera, where LiDAR contains 4 dimensions ([X, Y, Z, 1]) and Camera contains 3 dimensions ([u, v, 1]). velo stands for Velodyne :)

Comment on lines +1376 to +1381
2---3
/| /|
5-+-8 |
| 2 + 3
1-+-4 |
| 5 + 6
|/ |/
1---4
8---7
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understood the overall structure, is there any reason to change the bottom and top face?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I aligned the order of points with Kitti format which describes top face first.

Copy link
Contributor

@sooahleex sooahleex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you update the documents and explanation of this feature in this pr too?

@itrushkin
Copy link
Contributor Author

Could you update the documents and explanation of this feature in this pr too?

@sooahleex, documentation is added in 657bf1b. PR description is extended as well.

@wonjuleee wonjuleee merged commit 3d533b9 into openvinotoolkit:develop Oct 16, 2024
8 checks passed
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

Successfully merging this pull request may close these issues.

3 participants