parsley72
parsley72

Reputation: 9087

What is a good result from OpenCV stereo_calib?

I downloaded and built OpenCV 4.1.1 (using install-opencv.sh) then tried using stereo_calib on my camera, but the results are consistently poor; I get an RMS error of 0.6. The blog post Building OpenCV Stereo Vision - Calibration says:

When calibration finished, it outputs and RMS error. I got an RMS of 0.3 which is pretty good for VGA cameras, but it could be better. If RMS is anything above 0.5, I'd advise that you repeat the process.

In order to demonstrate a good example I used the sample data provided in samples/data - stereo_calib.xml and the images it lists. The result from stereo_calib is:

..........................13 pairs have been successfully detected.
Running stereo calibration ...
done with RMS error=0.635856
average epipolar err = 0.443478

This seems to be about the same as I get from my data. Is this a reasonable result, even though the RMS error is above 0.5? What about the average epipolar err?

I used the results to run stereo_match on the first example image:

stereo_match -i=intrinsics.yml -e=extrinsics.yml -o=disparity.png -p=point_cloud.txt --max-disparity=16 --blocksize=15 left01.jpg right01.jpg

The resulting disparity doesn't look great:

disparity.png

But viewing point_cloud.txt in CloudCompare does seem to show a flat object (the chessboard), albeit poorly. Is this working correctly? Or is it a bad example?

Upvotes: 0

Views: 654

Answers (1)

sebasth
sebasth

Reputation: 996

Disparity is the distance (in pixels) between corresponding points in two images from stereo camera pair (and is inversely proportional to distance). A quick by hand estimation shows the largest disparity (in original non-rectified image) to be over 130 (top right corner of the chessboard).

You need to have large enough disparity search range to get a decent disparity. The value for max-disparity has to be much higher, at least as large as largest expected disparity.

High RMS error in calibration usually indicates a bad calibration, but a low RMS error does not necessarily mean the calibration is good. If you want to quickly check your stereo calibration, for visualization you can rectify the input images and then draw some horizontal lines on both images. If the calibration is good, for any point in one image, the corresponding point in the other image is found, if visible, on the same horizontal line (same y-coordinate, the difference in x-coordinate is the disparity).

Upvotes: 1

Related Questions