-
Notifications
You must be signed in to change notification settings - Fork 103
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
sdf/camera.sdf: fields for projection matrix #1088
sdf/camera.sdf: fields for projection matrix #1088
Conversation
Signed-off-by: Brian Chen <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the PR! The C++ classes in SDFormat should reflect the XML spec. Do you mind adding the new elements here, with their respective tests?
Lines 175 to 193 in 3dd02cc
<element name="intrinsics" required="0"> | |
<description>Camera intrinsic parameters for setting a custom perspective projection matrix (cannot be used with WideAngleCamera since this class uses image stitching from 6 different cameras for achieving a wide field of view). The focal lengths can be computed using focal_length_in_pixels = (image_width_in_pixels * 0.5) / tan(field_of_view_in_degrees * 0.5 * PI/180)</description> | |
<element name="fx" type="double" default="277" required="1"> | |
<description>X focal length (in pixels, overrides horizontal_fov)</description> | |
</element> | |
<element name="fy" type="double" default="277" required="1"> | |
<description>Y focal length (in pixels, overrides horizontal_fov)</description> | |
</element> | |
<element name="cx" type="double" default="160" required="1"> | |
<description>X principal point (in pixels)</description> | |
</element> | |
<element name="cy" type="double" default="120" required="1"> | |
<description>Y principal point (in pixels)</description> | |
</element> | |
<element name="s" type="double" default="0.0" required="1"> | |
<description>XY axis skew</description> | |
</element> | |
</element> <!-- End Intrinsics --> | |
</element> <!-- End Lens --> |
Also, note that we use CamelCase
for function names, so the function names should be updated not to use _p
. Maybe SetLensProjection*
?
Thanks for the feedback! I'll make those changes |
Signed-off-by: Brian Chen <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mind to add tests for the new methods ?
@@ -151,6 +151,24 @@ | |||
<element name="cy" type="double" default="120" required="1"> | |||
<description>Y principal point (in pixels)</description> | |||
</element> | |||
<element name="p_fx" type="double" default="277" required="0"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for adding the elements! I'm wondering if it's best to put these inside a new <projection>
element that's a sibling of intrinsics
. Or maybe a child of intrinsics
? I'd have to refresh my computer vision knowledge.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, I don't know enough about these parameters to have a useful opinion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for adding the elements! I'm wondering if it's best to put these inside a new
<projection>
element that's a sibling ofintrinsics
. Or maybe a child ofintrinsics
? I'd have to refresh my computer vision knowledge.
IIUC the projection matrix is the cumulative effect of intrinsic and extrinsic parameters. So unless a xml element can have two parents (which I don't think is possible) I think @chapulina's suggestion to put these inside a new sibling <projection>
element is best. I've done this in de4e536
References
Signed-off-by: Brian Chen <[email protected]>
Yup, I missed it earlier. They've been added in a26db0e |
Signed-off-by: Brian Chen <[email protected]>
445a45b
to
de4e536
Compare
Signed-off-by: Brian Chen <[email protected]>
Codecov Report
@@ Coverage Diff @@
## sdf9 #1088 +/- ##
==========================================
+ Coverage 87.75% 87.81% +0.05%
==========================================
Files 64 64
Lines 10055 10099 +44
==========================================
+ Hits 8824 8868 +44
Misses 1231 1231
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
to improve test coverage, let's add these new fields to the |
Signed-off-by: Brian Chen <[email protected]>
…/sdformat into brianc/sdf9/configure_proj_mat
Signed-off-by: Steve Peters <[email protected]>
Signed-off-by: Steve Peters <[email protected]>
C++ classes now match the spec
@ahcorde @chapulina you had requested changes, but I believe they have been addressed, so I dismissed your reviews. I'll merge on Monday unless I hear otherwise |
🎉 New feature
Summary
This PR adds sdf fields to allow for configuration of the camera projection matrix.
Related PR in ign-sensors3: gazebosim/gz-sensors#249
Test it
Make a camera with sdf tags specifying these new fields.
Checklist
codecheck
passed (See contributing)