Stereo Calibration - Export from Matlab to ROS

asked 2017-02-01 07:42:36 -0500

Steve3nto gravatar image

updated 2017-02-02 09:03:00 -0500

I am trying to calibrate a pair of ueye cameras, model CP USB 3.0.

if I use the camera calibrator node the quality of calibration is really bad. I followed this guide step by step

http://wiki.ros.org/camera_calibratio...

After calibration I clicked commit and I ended up with two files in my driver ueye node. I can then start the driver and I see in topic camera_info that the calibration file has been loaded.

Then I run stereo_image_proc node to rectify the images, but I get a very bad result. Topics image_rect_color and image_color are almost the same, meaning the calibration is almost not doing much and the images are not well rectified.

I then tried to perform calibration again using the Matlab computer vision toolbox, stereo calibration app.

https://nl.mathworks.com/help/vision/...

With this one I get a much better calibration and the images are well rectified, but now I don't know how to export the results from Matlab to the .ini calibration files used by the ueye driver.

I am attaching the files with the results for both ROS and Matlab. Could you please help me translate the results from Matlab into ROS?

I understand the camera matrix, but I don't know how to correctly match the results from Matlab into the Distortion, Rectification and Projection Matrices of the .ini calibration files.

MATLAB RESULTS

Camera 1 Intrinsics
-------------------
Focal length (pixels):   [ 1461.7220 +/- 2.6474     1474.2012 +/- 2.6417  ]
Principal point (pixels):[  967.4086 +/- 1.4924      605.6235 +/- 1.2613  ]
Radial distortion:       [   -0.1466 +/- 0.0027        0.1859 +/- 0.0218       -0.1559 +/- 0.0512  ]
Tangential distortion:   [    0.0013 +/- 0.0002       -0.0001 +/- 0.0002  ]

Camera 1 Extrinsics
-------------------
Rotation vectors:
                         [   -0.2224 +/- 0.0042        0.0308 +/- 0.0032        0.0819 +/- 0.0004  ]
                         [   -0.3702 +/- 0.0017        0.1900 +/- 0.0017       -0.1542 +/- 0.0004  ]
                         [   -0.2243 +/- 0.0014       -0.0319 +/- 0.0015        0.0321 +/- 0.0003  ]
                         [   -0.1585 +/- 0.0017       -0.0929 +/- 0.0017        0.0388 +/- 0.0002  ]
                         [   -0.1432 +/- 0.0028       -0.1294 +/- 0.0025        0.0287 +/- 0.0002  ]
                         [   -0.1654 +/- 0.0023       -0.1418 +/- 0.0022        0.0294 +/- 0.0003  ]
                         [   -0.1599 +/- 0.0015       -0.1060 +/- 0.0020        0.0091 +/- 0.0003  ]
                         [   -0.1778 +/- 0.0014       -0.0985 +/- 0.0015       -0.0059 +/- 0.0002  ]
                         [   -0.0896 +/- 0.0020       -0.0548 +/- 0.0020        0.0570 +/- 0.0002  ]
                         [    0.0955 +/- 0.0027       -0.3056 +/- 0.0021        0.1882 +/- 0.0004  ]
                         [   -0.0263 +/- 0.0013       -0.0513 +/- 0.0013       -0.0077 +/- 0.0001  ]
                         [   -0.1241 +/- 0.0012       -0.0498 +/- 0.0013        0.0662 +/- 0.0001  ]
                         [   -0.1763 +/- 0.0009       -0.1665 +/- 0.0011       -0.0308 +/- 0.0001  ]
                         [   -0.1448 +/- 0.0010        0.0007 +/- 0.0012        0.0004 +/- 0.0001  ]
                         [   -0.1954 +/- 0.0009        0.0887 +/- 0.0011        0.0147 +/- 0.0002  ]
                         [   -0.1018 +/- 0.0010       -0.0225 +/- 0.0012        0.0400 +/- 0.0002  ]
                         [   -0.2833 +/- 0.0010       -0.0481 +/- 0.0012        0.0655 +/- 0.0003  ]
                         [   -0.2673 +/- 0.0011       -0.0353 +/- 0.0013        0 ...
(more)
edit retag flag offensive close merge delete

Comments

Hi, did you find an answer by now? I'm facing the same problem, but can't translate the matlab stereoParams to the ROS projection matrix and rectification matrix. Anybody who can help?

mherrmann gravatar image mherrmann  ( 2018-08-29 04:47:03 -0500 )edit

I am also trying to get the projection and rectification matrix . I think [https://stackoverflow.com/questions/4...] would be useful. I converted first using cv2 and python and changed the parameters.

pravin1 gravatar image pravin1  ( 2019-06-15 11:56:06 -0500 )edit