Stereo rig calibration - estimation of extrinsics
In this recipe, you will learn how to calibrate a stereo pair, that is, an estimate relative rotation and translation between two cameras using the photos of a calibration pattern. This functionality is used when you're dealing with stereo cameras—you need to know the rig parameters to be able to reconstruct 3D information about the scene.
Getting ready
Before you proceed with this recipe, you need to install the OpenCV version 3.3 (or greater) Python API package.
How to do it
You need to complete the following steps:
- Import the necessary modules:
import cv2 import glob import numpy as np
- Set the pattern size and prepare lists with images:
PATTERN_SIZE = (9, 6) left_imgs = list(sorted(glob.glob('../data/stereo/case1/left*.png'))) right_imgs = list(sorted(glob.glob('../data/stereo/case1/right*.png'))) assert len(left_imgs) == len(right_imgs)
- Find the chessboard points:
criteria = (cv2.TERM_CRITERIA_EPS + cv2.TERM_CRITERIA_MAX_ITER, 30, 1e-3) left_pts...