Goal
Compute a single projection model and calibration procedure that spans conventional (narrow-angle), wide-angle, and fish-eye lenses — including fields of view at and beyond 180° — from views of a planar calibration pattern alone. Input: pixel coordinates of circular control points at known planar positions, observed in views. Output: a forward model mapping a 3-D ray direction to pixel coordinates, and a backward model mapping pixel coordinates back to a ray direction. The defining property is an odd-power polynomial in the incidence angle (the angle between the principal axis and the incoming ray) that stays finite as , a regime where the pinhole model with additive distortion terms diverges outright.
Algorithm
Let denote the incidence angle between the principal axis and an incoming ray, and the azimuth angle around the axis. Let denote the image-plane radius. Let denote a ray direction. Let denote normalised image coordinates and pixel coordinates. Let denote focal-length-like pixel scale factors and the principal point.
The pinhole projection (Eq. 1) diverges as ; classical fish-eye lenses instead approximately follow one of several closed-form alternatives — stereographic , equidistant , equisolid-angle , or orthogonal . Rather than selecting one of these per lens type, all five (including the pinhole) are generalised by a single odd-power polynomial:
truncated to 5 terms, sufficient for sub-pixel approximation of all five reference projections. is assumed monotonically increasing on , so recovering from a measured requires numerically rooting a 9th-order polynomial and selecting the real root in range.
Real lenses deviate from radial symmetry through decentering and tilted elements. Two additional terms, separable in and , are added:
each with 7 free parameters. The distorted normalised coordinates are , and pixel coordinates follow from the affine map .
Combining the radial polynomial, the asymmetric terms, and the affine map gives the full forward model with 23 parameters (): 5 radial () plus 7+7 asymmetric plus 4 affine. Two reduced variants — (radial + affine only, 9 parameters, no asymmetric distortion) and (2-term radial + affine, 6 parameters) — trade capacity for robustness against overfitting when control points do not cover the full image. The backward model has no closed form for the asymmetric-distortion inverse and is approximated by a first-order Taylor expansion around the distorted point.
- Initialise by fitting to the nominal manufacturer projection; initialise from the observed circular image boundary or, for full-frame lenses, from the image center and pixel pitch.
- Back-project each observed point onto the unit sphere by solving from per point, then compute a per-view homography between sphere points and the planar pattern by a linear algorithm with data normalisation, refined by minimising the angle between predicted and back-projected unit vectors.
- Extract initial rotations and translations from , orthogonalising by SVD.
- Jointly refine all internal and external parameters (and asymmetric-distortion parameters, if used) by Levenberg-Marquardt minimisation of the total squared reprojection error .
- Apply the centroid-correction step: because circular control-point centroids are not the projections of the true circle centers under a nonlinear model, numerically integrate the modelled projection over the interior of each physical circle to compute the true expected centroid, rather than projecting the nominal circle center.
Implementation
Forward projection (Eq. 6-7) and the numerical inversion of by Newton's method, in Rust:
/// Forward radial projection r(theta) = k1*theta + k2*theta^3 + ... + k5*theta^9.
fn r_of_theta(theta: f64, k: [f64; 5]) -> f64 {
let t2 = theta * theta;
let mut term = theta;
let mut r = 0.0;
for &ki in &k {
r += ki * term;
term *= t2; // advance theta -> theta^3 -> theta^5 -> ...
}
r
}
/// dr/dtheta, needed for the Newton inversion step.
fn dr_dtheta(theta: f64, k: [f64; 5]) -> f64 {
let t2 = theta * theta;
let mut term = 1.0;
let mut deriv = 0.0;
for (n, &ki) in k.iter().enumerate() {
let power = 2 * n + 1;
deriv += ki * power as f64 * term;
term *= t2;
}
deriv
}
/// Invert r(theta) = r_target for theta via Newton's method (Eq. 6).
/// r(theta) is monotonic on [0, theta_max], so the root is unique there.
fn theta_from_r(r_target: f64, k: [f64; 5], theta0: f64, iters: usize) -> f64 {
let mut theta = theta0;
for _ in 0..iters {
let residual = r_of_theta(theta, k) - r_target;
let slope = dr_dtheta(theta, k).max(1e-12);
theta -= residual / slope;
}
theta
}
Remarks
- Real-camera RMS reprojection residuals (conventional/wide-angle lenses): Heikkilä's one-term-radial model reaches 0.061 px / 0.124 px; the 9-parameter variant reaches 0.055 px / 0.092 px despite lacking tangential terms; the full 23-parameter reaches 0.052 px / 0.057 px.
- Two-parameter fish-eye models (Mičušík's , ) fit only their design lens family: 's approximation error reaches 69 px against the pinhole curve and 90 px against the stereographic curve, versus 0.1 px for the 9-parameter polynomial fit to the same curves.
- The centroid-correction step is not optional at high accuracy: skipping it introduces a simulated 0.45 px RMS bias, larger than the reported real-data RMS residuals (0.089–0.146 px).
- The backward-model first-order Taylor approximation is negligible in practice: maximum back-project-then-reproject displacement is on the order of to px, several orders of magnitude below the forward-model residual.
- Model-order selection ( vs vs ) is a manual bias-variance trade-off: the full 23-parameter model can overfit systematic illumination-induced error when calibration images have poor corner coverage or non-uniform lighting.
When to choose Kannala–Brandt over Scaramuzza
Scaramuzza's omnidirectional calibration (IROS 2006) and Kannala–Brandt (TPAMI 2006) are same-year, independently developed generic lens models calibrated from planar-pattern views, with no paper-stated relation between them. Per the same-year tiebreaker, the broader-scope model hosts the comparison: Kannala–Brandt targets conventional, wide-angle, and fish-eye lenses under one parameterisation, while Scaramuzza's model is scoped to central omnidirectional cameras (catadioptric mirrors and fisheye lenses under a single-effective-viewpoint constraint).
| Kannala–Brandt 2006 | Scaramuzza 2006 | |
|---|---|---|
| Parameterisation | odd-power polynomial in incidence angle (Eq. 6) | Taylor polynomial in image radius : |
| Lens scope | conventional, wide-angle, fish-eye up to and beyond 180° FOV | central catadioptric mirrors and fisheye lenses |
| Central-projection assumption | not required (pinhole is a degenerate case of the model) | hard requirement (single effective viewpoint, closure) |
| Asymmetric distortion | optional 14-parameter decentering/tilt model (Eqs. 8-9) | not modelled (only an affine sensor-plane transform) |
| Model variants | / / (parameter-count trade-off) | single Taylor degree , chosen by increment-and-stop (typically ) |
| Calibration | homography-based initialisation with sphere back-projection, LM refinement, circular-marker centroid correction | linear extrinsic/intrinsic estimation, iterative image-center search, LM refinement |
Choose Kannala–Brandt when the sensor is a dioptric lens (no folding mirror) and asymmetric decentering distortion is expected to matter, or when circular calibration markers are used and centroid correction is needed to avoid the 0.45 px bias quantified above. Choose Scaramuzza when calibrating a catadioptric (mirror-based) omnidirectional camera, where the single-effective-viewpoint assumption applies directly and a minimal-parameter, fast-converging toolbox (roughly 3 seconds for the image-center search) is preferred over Kannala–Brandt's larger parameter set.
References
- J. Kannala, S. S. Brandt. A Generic Camera Model and Calibration Method for Conventional, Wide-Angle, and Fish-Eye Lenses. IEEE Transactions on Pattern Analysis and Machine Intelligence 28(8):1335–1340, 2006. PDF
- Z. Zhang. A Flexible New Technique for Camera Calibration. IEEE TPAMI 22(11):1330–1334, 2000.
- D. Scaramuzza, A. Martinelli, R. Siegwart. A Toolbox for Easily Calibrating Omnidirectional Cameras. IEEE/RSJ IROS, 2006. PDF