ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

How to get raw stereo camera calibration from left and right camera_info messages

asked 2018-03-01 07:33:49 -0500

taihu gravatar image

Hi guys,

I am trying to obtain the stereo un-rectified calibration (that is un-rectified extrinsics R and t; and calibration matrix K for each camera) from the left_camera_info.yaml and the right_camera_info.yaml configuration files. The only unrectified information that I can get straightforward from the configuration files is the instrinsic matrix K and distortion parameters D. But I do not know how to get the un-rectified extrinsic R and T.

I think I should use R rotation rectification matrix and Projection matrix from right configuration file right_camera_info.yaml but I am not sure how should I use them.

Any suggestions? thank you very much

This is my left_camera_info.yaml

image_width: 672
image_height: 376
camera_name: narrow_stereo/left
camera_matrix:
  rows: 3
  cols: 3
  data: [348.522264, 0.000000, 344.483596, 0.000000, 348.449870, 188.808062, 0.000000, 0.000000, 1.000000]
distortion_model: plumb_bob
distortion_coefficients:
  rows: 1
  cols: 5
  data: [-0.174497, 0.027127, -0.000359, 0.000457, 0.000000]
rectification_matrix:
  rows: 3
  cols: 3
  data: [0.999873, 0.000708, 0.015892, -0.000683, 0.999999, -0.001578, -0.015893, 0.001567, 0.999872]
projection_matrix:
  rows: 3
  cols: 4
  data: [347.652079, 0.000000, 339.375946, 0.000000, 0.000000, 347.652079, 198.590004, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000]

This is my right_camera_info.yaml

image_width: 672
image_height: 376
camera_name: narrow_stereo/right
camera_matrix:
  rows: 3
  cols: 3
  data: [349.569635, 0.000000, 340.836585, 0.000000, 349.390781, 206.105440, 0.000000, 0.000000, 1.000000]
distortion_model: plumb_bob
distortion_coefficients:
  rows: 1
  cols: 5
  data: [-0.174606, 0.027855, -0.000108, -0.000141, 0.000000]
rectification_matrix:
  rows: 3
  cols: 3
  data: [0.999997, -0.000440, 0.002268, 0.000436, 0.999999, 0.001573, -0.002269, -0.001572, 0.999996]
projection_matrix:
  rows: 3
  cols: 4
  data: [347.652079, 0.000000, 339.375946, -41.272771, 0.000000, 347.652079, 198.590004, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000]
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2019-03-06 09:02:09 -0500

taihu gravatar image

updated 2019-03-06 09:03:03 -0500

I was doing a little bit research about this, and I could answer the question by myself. I just check the stereoRectify function implementation in OpenCV (this function is used to perform the rectification process in ROS).

I do the following to obtain them (python code):

// get un-rectified rotation matrix

R_unrectified = R_left_rectified.dot(inv(R_right_rectified))

// get un-rectified translation vector

fx = P_right_rectified[0][0]

t_rectified = np.array(P_right_rectified[:,3]) / fx

t_unrectified = inv(R_right_rectified).dot(t_rectified)

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2018-03-01 07:33:49 -0500

Seen: 625 times

Last updated: Mar 06 '19