Unable to rectify stereo cameras correctly

I’m noticing a lot of residual distortion in that last image pair. I also notice that features line up on some of the lines, but not others. For example the line that intersects the top of the table leg on the left image seems quite a bit off in the right image.

What reprojection error value are you getting when you calibrate the camera? (I would focus on getting intrinsic calibration for each camera as an independent “one time” process. Once you have the intrinsics well calibrated you can focus only on calibrating the extrinsics / relative pose of the pair.)

I agree with crackwitz’s suggestion to use a Charuco pattern so that you get more calibration points closer to the image edges/corners - this will help a lot with your distortion model. I also suggest using the 8 parameter (rational) model by using the flag CALIB_RATIONAL_MODEL. (I get much better results with that)

In addition to looking at the calibration score, I undistort the image and draw lines on it that coincide with the chessboard pattern. I find it helpful to look at how closely the lines match up with the chessboard image, particularly further out (near the corners) of the image. I also inspect the vanishing point / intersection of the lines. High quality calibrations result in a very tight intersection radius, lower quality results have a much larger “intersection” point. I have found that the score doesn’t always give a good indication of calibration results - particularly if you end up filtering a lot of points or otherwise don’t use points near the corners of the image.

I have included an example of a distorted / undistorted (with lines drawn) image to show what I mean.

For reference, these images are from a calibration that included 15 input images and had an RMS error of about 0.15.

Note that with a lens with this much distortion the Charuco calibration process doesn’t do a great job finding point in the highly distorted area on its own. This could be related to the size of the markers I’m using, which don’t get detected very well toward the edges. I iteratively add points (predict locations, find with cornerSubpix) in order to use all of the points in the image. In other words, the Charuco calibration can unlock better results but you will probably have to do some additional work for best results.

1 Like