How it works

To calibrate a stereo pair using OpenCV, one must capture a few photos of a calibration pattern simultaneously from both cameras. In our case, we used a 9x6 chessboard. We used the cv2.findChessboardCorners function to find corners of the board which we will use for rig parameters estimation. We also need calibration pattern points in its local coordinate system. Since we know the size of the pattern and its shape, we can explicitly construct the list of points—pattern_points. Note that the units used here will be used for the translation vector between two cameras.

The calibration itself is performed in the cv2.stereoCalibrate function. As input, it takes a list of image points and a list of pattern points. You can also specify ...

Get OpenCV 3 Computer Vision with Python Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.