AutoCalib - Camera Calibration
Camera Calibration using Zhang’s Method
This project implements Zhang’s method for camera calibration. Camera calibration is essential in computer vision to obtain the intrinsic and extrinsic parameters of a camera, which are used to correct image distortions and understand the 3D geometry of the scene.
Theory
Zhang’s Camera Calibration Method
Zhang’s method is a well-known technique for camera calibration using a planar calibration object, such as a chessboard pattern. The method involves capturing multiple images of the calibration object at different orientations and positions. The main steps are:
-
Image and World Points Extraction:
- Detect and extract 2D image points (corners of the chessboard pattern) from the calibration images.
- Generate corresponding 3D world points based on the known dimensions of the chessboard.
-
Homography Computation:
- Compute homographies between the world points and the image points for each calibration image.
-
Intrinsic Parameters Calculation:
- Construct a system of linear equations using the homographies to solve for the intrinsic parameters of the camera.
-
Extrinsic Parameters Calculation:
- Using the intrinsic parameters, compute the extrinsic parameters (rotation and translation) for each image.
-
Distortion Coefficients:
- Estimate distortion coefficients to account for lens distortion.
-
Optimization:
- Optimize the intrinsic, extrinsic parameters, and distortion coefficients to minimize the reprojection error.
Prerequisites
To run the code, you need to have the following libraries installed:
numpy
opencv-python
matplotlib
scipy
You can install these libraries using pip:
pip install numpy opencv-python matplotlib scipy
To run the code (calibrate your camera with custom dataset)
Put all of your images in the “Calibration_Imgs” folder then run the Wrapper file.
python3 Wrapper.py