How to do it

You need to complete the following steps:

  1. Import the necessary modules:
import cv2import globimport numpy as np
  1. 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)
  1. Find the chessboard points:
criteria = (cv2.TERM_CRITERIA_EPS + cv2.TERM_CRITERIA_MAX_ITER, 30, 1e-3)left_pts, right_pts = [], []img_size = Nonefor left_img_path, right_img_path in zip(left_imgs, right_imgs):    left_img = cv2.imread(left_img_path, cv2.IMREAD_GRAYSCALE)    right_img = cv2.imread(right_img_path, cv2.IMREAD_GRAYSCALE)    if img_size is None: img_size = (left_img.shape[1], ...

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.