Fisheye camera model calibration
If your camera has a wide view angle and, as a consequence, strong distortions, you need to use the fisheye camera model. OpenCV provides functions to work with the fisheye camera model. Let's review how to calibrate such a camera type in OpenCV.
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 numpy as np
- Capture frames from the camera, detect a chessboard pattern on each frame, and accumulate the frames and corners until we have a big enough number of samples:
cap = cv2.VideoCapture(0) pattern_size = (10, 7) samples = [] while True: ret, frame = cap.read() if not ret: break res, corners = cv2.findChessboardCorners(frame, pattern_size) img_show = np.copy(frame) cv2.drawChessboardCorners(img_show, pattern_size, corners, res) cv2.putText(img_show, 'Samples...