How to do it

You need to complete the following steps:

  1. Import the necessary modules:
import cv2import numpy as np
  1. Load the camera matrix, the distortion coefficients, and two frames taken by the camera:
camera_matrix = np.load('../data/pinhole_calib/camera_mat.npy')dist_coefs = np.load('../data/pinhole_calib/dist_coefs.npy')img_0 = cv2.imread('../data/pinhole_calib/img_00.png')img_1 = cv2.imread('../data/pinhole_calib/img_10.png')
  1. Undistort the frames:
img_0 = cv2.undistort(img_0, camera_matrix, dist_coefs)img_1 = cv2.undistort(img_1, camera_matrix, dist_coefs)
  1. Find the chessboard corners on both images:
pattern_size = (10, 7)res_0, corners_0 = cv2.findChessboardCorners(img_0, pattern_size)res_1, corners_1 = cv2.findChessboardCorners(img_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.