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

Set custom projection matrix based on intrinsics params from SDF #293

Merged
merged 4 commits into from
Dec 7, 2022

Conversation

iche033
Copy link
Contributor

@iche033 iche033 commented Dec 1, 2022

🎉 New feature

Closes #288

Summary

This PR extends the camera sensor functionality to support custom projection matrix based on input instrinics values. Specifically, it reads the lens <instrinsics> params from SDF, builds the projection matrix from the input values using code ported from Gazebo-classic, and set the camera to use this custom projection matrix.

Expanded the camera intrinsics integration test to compare image output from cameras with different intrinsics values.

Checklist

  • Signed all commits for DCO
  • Added tests
  • Added example and/or tutorial
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • Consider updating Python bindings (if the library has them)
  • codecheck passed (See contributing)
  • All tests passed (See test coverage)
  • While waiting for a review on your PR, please help review another open pull request to support the maintainers

Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining Signed-off-by messages.

Signed-off-by: Ian Chen <ichen@osrfoundation.org>
Signed-off-by: Ian Chen <ichen@osrfoundation.org>
@github-actions github-actions bot added the 🌱 garden Ignition Garden label Dec 1, 2022
@codecov
Copy link

codecov bot commented Dec 1, 2022

Codecov Report

Merging #293 (7a4eac4) into gz-sensors7 (306e92a) will increase coverage by 0.19%.
The diff coverage is 87.09%.

@@               Coverage Diff               @@
##           gz-sensors7     #293      +/-   ##
===============================================
+ Coverage        71.66%   71.85%   +0.19%     
===============================================
  Files               37       37              
  Lines             4665     4690      +25     
===============================================
+ Hits              3343     3370      +27     
+ Misses            1322     1320       -2     
Impacted Files Coverage Δ
src/CameraSensor.cc 79.02% <87.09%> (+1.31%) ⬆️
src/Sensor.cc 91.44% <0.00%> (+1.60%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@scpeters
Copy link
Member

scpeters commented Dec 1, 2022

note that we've also added <projection> tags to SDFormat in case users want to specify the projection values independently from the intrinsics:

@iche033
Copy link
Contributor Author

iche033 commented Dec 1, 2022

yeah I saw that. I can add that in once #289 is merged.

@scpeters
Copy link
Member

scpeters commented Dec 1, 2022

yeah I saw that. I can add that in once #289 is merged.

sounds great; thanks

test/integration/camera.cc Outdated Show resolved Hide resolved
test/integration/camera.cc Outdated Show resolved Hide resolved
test/integration/camera.cc Outdated Show resolved Hide resolved
Signed-off-by: Ian Chen <ichen@osrfoundation.org>
@iche033 iche033 merged commit 2ec0200 into gz-sensors7 Dec 7, 2022
@iche033 iche033 deleted the set_intrinsics branch December 7, 2022 20:50
@iche033 iche033 mentioned this pull request Feb 9, 2023
9 tasks
iche033 added a commit that referenced this pull request Feb 14, 2023
This PR allows users to specify custom camera projection using the <projection> values from SDF (in addition to <instrinscs>, see #293).

Also bumped sdformat dep version as it need gazebosim/sdformat#1203

---------

Signed-off-by: Ian Chen <ichen@openrobotics.org>
Co-authored-by: Alejandro Hernández Cordero <ahcorde@gmail.com>
ahcorde pushed a commit that referenced this pull request Sep 13, 2023
Closes #288

This PR extends the camera sensor functionality to support custom projection matrix based on input instrinics values. Specifically, it reads the lens <instrinsics> params from SDF, builds the projection matrix from the input values using code ported from Gazebo-classic, and set the camera to use this custom projection matrix.

Expanded the camera intrinsics integration test to compare image output from cameras with different intrinsics values.

Signed-off-by: Ian Chen <ichen@osrfoundation.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🌱 garden Ignition Garden
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Camera sensor intrinsic parameters fx and fy are ignored
3 participants