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

disto CameraParameter contains only first five coefficients #128

Closed
2 tasks done
ozendelait opened this issue Dec 15, 2022 · 4 comments
Closed
2 tasks done

disto CameraParameter contains only first five coefficients #128

ozendelait opened this issue Dec 15, 2022 · 4 comments
Assignees
Labels
bug Something isn't working feature_request New feature or request

Comments

@ozendelait
Copy link

Preliminary Checks

  • This issue is not a duplicate. Before opening a new issue, please search existing issues.
  • This issue is not a question, feature request, or anything other than a bug report directly related to this project.

Description

The distortion coefficients within the zed2-ros2-wrapper camera_info messages (as well as the disto CameraParameters returned by the ZED API for calibration_parameters_raw
https://www.stereolabs.com/docs/api/structsl_1_1CameraParameters.html#a5e66eff1633b3ba90dbbf12121163179 ) only contains the first five coefficients k1 k2 p1 p2 k3 even if the conf File contains k4 k5 k6 (or s1 s2 s3 s4).
I confirmed that the additional rational/thin prism coefficients are indeed applied to correctly undistort the images, however only the first five of the 8/12 parameters are returned by the API

Steps to Reproduce

  1. Have a camera connected /svo with a .conf file where the [LEFT_DISTO]/[RIGHT_DISTO] contains values for k4,k5,k6
  2. Launch ROS2 node zed2-ros2-wrapper; general/self_calib (==camera_disable_self_calib) set to false
  3. check ../left_raw/camera_info distortion coefficients (parameter "D", "distortion_model")

Expected Result

D has 8 coefficients
distortion_model is "rational_polynomial"

Actual Result

D has 5 coefficients (the first 5 of the expected 8)
distortion_model is "plumb_bob"

ZED Camera model

ZED2i

Environment

ZED SDK 3.8.2

Anything else?

Same bug when checking via python ZED API (e.g. pyzed camera.get_camera_information().calibration_parameters_raw.left_cam.disto )
The ROS1/ROS2 wrappers have hard-coded plumb_bob/resize(5) behaviour:
https://github.com/stereolabs/zed-ros2-wrapper/blob/master/zed_components/src/zed_camera/src/zed_camera_component.cpp#L1941
Changing k4/k5/k6 in the conf file does change the rectified images -> Coeffs are used

@ozendelait ozendelait added the bug Something isn't working label Dec 15, 2022
@Myzhar
Copy link
Member

Myzhar commented Dec 15, 2022

Hi @ozendelait
can you please compile and run this simple test program and post the output?
test_camera_params.zip

You should get something similar to this if the camera has been calibrated with RATIONAL POLYNOMIAL model:

* Left sensor raw: 
  - fx: 1066.31
  - fy: 1066.56
  - h_fov: 97.433
  - v_fov: 65.2786
  - distortions: -1.20545 2.62023 -0.000168449 0.000492456 0.103145 -1.11128 2.47128 0.271241 0 0 0 0 

* Right sensor raw: 
  - fx: 1066.3
  - fy: 1066.63
  - h_fov: 97.4336
  - v_fov: 65.2752
  - distortions: -1.05884 2.02888 7.78117e-05 -5.15948e-05 0.188083 -0.963161 1.87829 0.340221 0 0 0 0

@ozendelait
Copy link
Author

ozendelait commented Dec 15, 2022

Hi, yes; correct. I get this:

* Left sensor raw: 
  - fx: 534.12
  - fy: 534.125
  - h_fov: 105.628
  - v_fov: 73.1086
  - distortions: -0.92338 2.25279 0.000322705 3.9471e-05 0.0839577 -0.826327 2.11526 0.234659 0 0 0 0 

* Right sensor raw: 
  - fx: 534.72
  - fy: 534.605
  - h_fov: 105.566
  - v_fov: 73.0594
  - distortions: -1.02549 2.26474 -0.000252286 -5.28801e-05 0.184219 -0.924819 2.10794 0.353717 0 0 0 0 

@Myzhar
Copy link
Member

Myzhar commented Dec 15, 2022

OK, I noted the modification to be applied by the ZED Wrapper.
I will add it in the next few days if I find the right moment.
Regarding Python output, I reported the issue to the Python team.

@Myzhar Myzhar self-assigned this Dec 15, 2022
@Myzhar Myzhar added the feature_request New feature or request label Dec 15, 2022
Myzhar added a commit that referenced this issue Dec 19, 2022
@Myzhar
Copy link
Member

Myzhar commented Dec 19, 2022

Fixed f3d9fa7

@Myzhar Myzhar closed this as completed Dec 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working feature_request New feature or request
Development

No branches or pull requests

2 participants