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

K from camera_info #2935

Closed
monajalal opened this issue Nov 21, 2023 · 4 comments
Closed

K from camera_info #2935

monajalal opened this issue Nov 21, 2023 · 4 comments
Labels

Comments

@monajalal
Copy link

monajalal commented Nov 21, 2023

Should I assume the following K from D435 is already calibrated and correct? also could you please provide the format?
K: [385.240478515625, 0.0, 319.2182922363281, 0.0, 385.240478515625, 236.77352905273438, 0.0, 0.0, 1.0]
like what is order of f_x, f_fy, c_x, c_y, etc


---
root@77c9b6999e4b:/workspace# rostopic echo /camera/depth/camera_info


header: 
  seq: 202
  stamp: 
    secs: 1700595923
    nsecs:  63802242
  frame_id: "camera_depth_optical_frame"
height: 480
width: 640
distortion_model: "plumb_bob"
D: [0.0, 0.0, 0.0, 0.0, 0.0]
K: [385.240478515625, 0.0, 319.2182922363281, 0.0, 385.240478515625, 236.77352905273438, 0.0, 0.0, 1.0]
R: [1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0]
P: [385.240478515625, 0.0, 319.2182922363281, 0.0, 0.0, 385.240478515625, 236.77352905273438, 0.0, 0.0, 0.0, 1.0, 0.0]
binning_x: 0
binning_y: 0
roi: 
  x_offset: 0
  y_offset: 0
  height: 0
  width: 0
  do_rectify: False


I am trying to convert my K to the following format but I am not sure what is the order of f_x, f_y, c_x, and c_y in either one.

(base) mona@ada:~/BundleSDF/milk/2022-11-18-15-10-24_milk$ cat cam_K.txt 
6.153791503906250000e+02 0.000000000000000000e+00 3.147796325683593750e+02
0.000000000000000000e+00 6.153792114257812500e+02 2.366492004394531250e+02
0.000000000000000000e+00 0.000000000000000000e+00 1.000000000000000000e+00

thanks for any help.

@monajalal
Copy link
Author

monajalal commented Nov 21, 2023

What further confuses me, is when I use the following topic, I get a different K

K: [616.056884765625, 0.0, 321.5348815917969, 0.0, 616.2793579101562, 235.87950134277344, 0.0, 0.0, 1.0]

root@77c9b6999e4b:/workspace# rostopic echo /camera/color/camera_info

---
header: 
  seq: 15
  stamp: 
    secs: 1700596149
    nsecs: 718137264
  frame_id: "camera_color_optical_frame"
height: 480
width: 640
distortion_model: "plumb_bob"
D: [0.0, 0.0, 0.0, 0.0, 0.0]
K: [616.056884765625, 0.0, 321.5348815917969, 0.0, 616.2793579101562, 235.87950134277344, 0.0, 0.0, 1.0]
R: [1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0]
P: [616.056884765625, 0.0, 321.5348815917969, 0.0, 0.0, 616.2793579101562, 235.87950134277344, 0.0, 0.0, 0.0, 1.0, 0.0]
binning_x: 0
binning_y: 0
roi: 
  x_offset: 0
  y_offset: 0
  height: 0
  width: 0
  do_rectify: False

so what is cam_K.txt as in BundleSDF refer to? https://github.com/NVlabs/BundleSDF

@monajalal
Copy link
Author

monajalal commented Nov 21, 2023

assuming I should use color camera info (why not depth?),
does this sound correct?

6.160568847656250000e+02 0.000000000000000000e+00 3.215348815917969000e+02
0.000000000000000000e+00 6.162793579101562000e+02 2.358795013427734400e+02
0.000000000000000000e+00 0.000000000000000000e+00 1.000000000000000000e+00

for cam_K.txt file?

@monajalal
Copy link
Author

I may be wrong but seems using

6.160568847656250000e+02 0.000000000000000000e+00 3.215348815917969000e+02
0.000000000000000000e+00 6.162793579101562000e+02 2.358795013427734400e+02
0.000000000000000000e+00 0.000000000000000000e+00 1.000000000000000000e+00

works for BundleSDF

@MartyG-RealSense
Copy link
Collaborator

MartyG-RealSense commented Nov 22, 2023

Hi @monajalal RealSense cameras are calibrated in the factory during the manufacturing process. So they may not need to be re-calibrated unless something happens to mis-calibrate the sensors, such as a hard knock or a drop on the ground.

You can use the RealSense SDK's rs-enumerate-devices tool to find out the calibration values for your particular camera. This can be done by launching the tool in calibration mode with the -c parameter.

rs-enumerate-devices -c

The calibration values are unique for each individual RealSense cameras and will also differ for each resolution. Shown below is the calibration information from rs-enumerate-devices for my own D435 at resolutions 848x480 and 1280x720.

image

You will see that the D435's five distortion coefficients are all zero. This is because RealSense artifically sets them all to 0 for reasons provided by a RealSense team member at IntelRealSense/librealsense#1430 (comment)

RealSense refers to CX and CY (the Principal Point) as PPX and PPY.

The distortion model plumb_bob is an alternative name for the Brown-Conrady distortion model used by RealSense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants