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

Fix intrinsics calculation for non BROWN D500 models #12618

Merged
merged 3 commits into from
Jan 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 20 additions & 7 deletions src/ds/d500/d500-private.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,14 @@ namespace librealsense

// update values in the distortion params of the calibration table
rgb_coefficients_table.distortion_model = RS2_DISTORTION_BROWN_CONRADY;

// Since we override the table we need an indication that the table had changed from
// outside this function Decided to use a reserve field for that
if( rgb_coefficients_table.reserved[3] != 0 )
throw invalid_value_exception( "reserved field read from RGB distortion model table is expected to be zero" );

rgb_coefficients_table.reserved[3] = 1;

rgb_coefficients_table.distortion_coeffs[5] = 0;
rgb_coefficients_table.distortion_coeffs[6] = 0;
rgb_coefficients_table.distortion_coeffs[7] = 0;
Expand Down Expand Up @@ -222,13 +230,18 @@ namespace librealsense
intrinsics.height = height;

// For D555e, model will be brown and we need the unrectified intrinsics
auto rect_params = compute_rect_params_from_resolution( table->rgb_coefficients_table.distortion_model
== RS2_DISTORTION_BROWN_CONRADY
? table->rgb_coefficients_table.base_instrinsics
: table->rectified_intrinsics,
width,
height,
false ); // symmetry not needed for RGB
// We use reserved[3] as a flag here to indicate the full distortion module is not
// really brown but we treat it as such because the HW fixes fisheye distortion.
bool use_base_intrinsics
= ( table->rgb_coefficients_table.distortion_model == RS2_DISTORTION_BROWN_CONRADY
&& table->rgb_coefficients_table.reserved[3] == 0 );
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe add a comment that we use reserved[3] as a flag here to indicate the full distortion module is not really brown but we treat it as such because the HW fixes fisheye distortion.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added


auto rect_params = compute_rect_params_from_resolution(
Copy link
Collaborator

Choose a reason for hiding this comment

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

This doesn't look like clang-format formatting :)

use_base_intrinsics ? table->rgb_coefficients_table.base_instrinsics
: table->rectified_intrinsics,
width,
height,
false ); // symmetry not needed for RGB

intrinsics.fx = rect_params[0];
intrinsics.fy = rect_params[1];
Expand Down
Loading