Camera calibration
Camera calibration recovers the intrinsic matrix and the lens distortion parameters of a camera from images of a known calibration target. Without accurate calibration, every downstream geometric computation — triangulation, pose estimation, epipolar search — is systematically wrong.
Zhang’s Method
Zhang’s method (1999) is the standard calibration procedure. It uses images of a planar checkerboard taken from multiple viewpoints. Each image provides correspondences between known 3D board corners and detected 2D image corners, giving constraints on both the homography (image-to-board) and the intrinsic parameters. The procedure:
- Detect checkerboard corners in images at different orientations.
- Compute homographies between the board plane and each image.
- Extract constraints on from each , using with and .
- Solve a linear system for the intrinsic parameters.
- Refine all parameters (intrinsic + extrinsic + distortion) via nonlinear least squares.
Where the constraints come from. Write . Since and with orthonormal, each view yields two linear equations in the entries of the symmetric matrix :
has 6 unknowns (5 if skew is assumed zero), so 3 views suffice; is then recovered from by Cholesky-style decomposition. This is why the board must be shown at different orientations — parallel views give redundant constraints.
Lens Distortion Models
Real lenses deviate from the ideal pinhole model. Two standard models:
Radial distortion causes straight lines to appear curved:
where is the squared distance from the principal point. gives barrel distortion; gives pincushion distortion. Wide-angle lenses have large .
Tangential distortion is caused by the lens not being perfectly parallel to the image plane:
In practice, (and sometimes ) are estimated jointly with . OpenCV implements this directly in cv::calibrateCamera().
Judging calibration quality
The standard quality metric is the RMS reprojection error returned by the calibration: reproject the board corners with the estimated parameters and measure the pixel residuals. Beyond the single number, check that:
- Residuals are evenly distributed across the image — a bias in the corners indicates an inadequate distortion model (e.g., a fisheye lens forced into the radial-tangential model).
- The board appeared in all regions of the image, including corners and edges, where distortion is strongest and otherwise unconstrained.
- Views included substantial tilt (not just frontal shots) so that focal length and principal point decorrelate.
Common pitfalls
- Motion blur and rolling shutter during capture corrupt corner detection; hold the board (or camera) still for each shot.
- A non-flat board: printed paper taped to cardboard bends; distortion estimates absorb the bending. Use a rigid, flat target.
- Too few poses near the image border — the high-order radial terms then overfit and extrapolate wildly outside the covered region.
- Calibrating at one focus/zoom setting and running at another: intrinsics change with focus; lock the lens and recalibrate whenever hardware settings change.
Why it matters for SLAM
SLAM systems assume that undistorted, calibrated observations feed their geometric solvers; a few pixels of uncorrected distortion at the image border can dominate reprojection error and corrupt the map. Calibration is also the template for harder problems you will meet later — camera-IMU and camera-LiDAR extrinsic calibration follow the same “known target + nonlinear refinement” pattern. Practically, calibrating your own camera with a checkerboard is one of the best first exercises in the field.