-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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 D405 VGA resolution intrinsics calculation #13060
Conversation
src/ds/d400/d400-private.cpp
Outdated
//D405 needs special calculation because the ISP crops the full sensor image using non linear transformation. | ||
rs2_intrinsics get_d405_color_stream_intrinsic(const std::vector<uint8_t>& raw_data, uint32_t width, uint32_t height) | ||
{ | ||
// Convert normalized focal lenght and principal point to pixel units (K matrix format) |
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.
length
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.
Done
src/ds/d400/d400-private.cpp
Outdated
k( 2, 1 ) = ( k( 2, 1 ) + 1 ) * resolutions_list[res].y / 2.f; // ppy | ||
}; | ||
|
||
// Scale focal lenght and principal point in pixel units from one resolution to another (K matrix format) |
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.
length
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.
Done
src/ds/d400/d400-private.cpp
Outdated
}; | ||
|
||
auto table = check_calib< ds::d400_rgb_calibration_table >( raw_data ); | ||
auto raw_res = width_height_to_ds_rect_resolutions( 1280, 800 ); |
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.
Can you explain why we take this resolution?
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.
This is the raw sensor resolution.
These values where also hard coded in the matlab algorithm I was based on. Special for D405 handling.
src/ds/d400/d400-private.cpp
Outdated
rs2_intrinsics get_d405_color_stream_intrinsic(const std::vector<uint8_t>& raw_data, uint32_t width, uint32_t height) | ||
{ | ||
// Convert normalized focal length and principal point to pixel units (K matrix format) | ||
auto k_to_pixels = [&]( float3x3 & k, ds_rect_resolutions res ) |
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.
Please rename k_to_pixels to normalized_k_to_pixels
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.
Done
k( 2, 0 ) = k( 2, 0 ) - ( resolutions_list[scale_res].x - resolutions_list[output_res].x ) / 2; // ppx | ||
k( 2, 1 ) = k( 2, 1 ) - ( resolutions_list[scale_res].y - resolutions_list[output_res].y ) / 2; // ppy | ||
} | ||
else | ||
{ | ||
k_to_pixels( k, calibration_res ); | ||
normalized_k_to_pixels( k, calibration_res ); |
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.
What is the difference between normalized_k_to_pixels
and k_to_pixels
?
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.
No difference, just renaming based on Remi's comment.
The code always assumes a "normalized k" input and changes it to pixel units based on the requested resolution.
Close and reopen to trigger CI |
Tracked on [RSDSO-18999]