# Lens Projections and Distortion: From Rectilinear to Fisheye, and Which Calibration Model Fits

> Why wide lenses bend straight lines, the projection functions behind rectilinear and fisheye lenses, barrel, pincushion and mustache distortion, radial and tangential distortion and their physical causes, and how each maps to a calibration model: Brown–Conrady, Kannala–Brandt, unified, EUCM, double sphere and FOV.

Page: https://egocam.ai/lens-physics/projections-and-distortion/

Every lens maps directions in the world to positions on the sensor. That mapping is the **projection**. A calibration model is a formula for it, with a few free parameters that the calibration fits. Choosing a model means choosing a formula whose shape matches what the lens physically does.

This page covers the projections lenses are designed to, the ways real lenses depart from them, and which calibration model fits which lens. It builds on [how a lens forms an image](https://egocam.ai/lens-physics/how-a-lens-forms-an-image/) and on the [camera calibration guide](https://egocam.ai/calibration/camera-calibration/).

## The projection function

Most lenses are rotationally symmetric, so the projection can be described with two numbers:

- **θ** (theta): the angle between an incoming ray and the optical axis;
- **r**: the distance from the principal point to where that ray lands on the sensor.

The **projection function** r(θ) says how far out a ray at angle θ lands. Lenses are designed to follow one of a few classic functions, and the focal length f is the scale factor in each.

## The classic projections

| Projection | Formula | What it preserves | r/f at θ = 60° | r/f at θ = 90° |
|---|---|---|---|---|
| Perspective (rectilinear, pinhole) | `r = f · tan(θ)` | straight lines | 1.73 | infinite |
| Equidistant (f-theta) | `r = f · θ` | equal radial distance per degree | 1.05 | 1.57 |
| Equisolid angle | `r = 2f · sin(θ/2)` | equal image area per solid angle | 1.00 | 1.41 |
| Stereographic | `r = 2f · tan(θ/2)` | local shapes and angles | 1.15 | 2.00 |
| Orthographic | `r = f · sin(θ)` | (compresses the edge hardest) | 0.87 | 1.00 |

θ is in radians inside the formulas. Commonlands's [fisheye guide](https://commonlands.com/blogs/technical/wide-angle-lenses-and-fisheye-camera-lens-distortion) lists the same five, noting that rectilinear "preserves straight lines but cannot reach 180°", equidistant "holds the radial scale constant for angular measurement", equisolid "maps equal solid angles on the viewing sphere to equal image areas", stereographic "preserves local shapes and angles", and orthographic is "rare in machine vision".

> **Diagram:** How far from the image centre a ray lands (r, in units of f) for a ray arriving θ off the axis. The perspective (pinhole) curve r = f·tan θ runs to infinity at 90°, so no rectilinear lens can reach a 180° view. The fisheye projections stay finite. All five agree near the axis, which is why a narrow lens looks like a pinhole.

Near the axis, all five agree, because tan θ, θ, 2 sin(θ/2), 2 tan(θ/2) and sin θ are all close to θ for small angles. That is why a narrow lens can be calibrated as a pinhole with a small correction. They part ways quickly beyond about 30°.

## Why wide lenses distort

The perspective projection keeps straight lines straight, but it is expensive at wide angles. Its image radius grows as tan θ, which runs to infinity at 90°. The image scale along the radius grows as `f / cos²θ`: at 60° off axis, each degree takes four times as many pixels as at the centre. A rectilinear lens covering a very wide field must spend most of its sensor on the edges, and it cannot reach 180° at all.

So lens designers trade straight lines for coverage. A **fisheye** lens follows one of the other projections on purpose. Commonlands puts it plainly: "The curved-line rendering in a fisheye image is a geometric consequence of the projection, not a manufacturing defect."

This is also why the pinhole model with a distortion polynomial stops working on fisheye lenses. Usenko, Demmel and Cremers, comparing camera models, write that "in practice, even when distortion model is added the pinhole camera demonstrates suboptimal performance for a field-of-view greater than 120°."

## Distortion: departures from the ideal projection

**Distortion** is the difference between where a ray actually lands and where an ideal projection would put it. It moves image points without blurring them. For a lens intended to be rectilinear, distortion is usually quoted as a percentage:

```
distortion (%) = (r_actual − r_ideal) / r_ideal × 100
```

where r_ideal = f · tan(θ). A negative value means the image is compressed toward the edge; a positive value means it is stretched.

### Barrel, pincushion and mustache

> **Diagram:** The same square grid through three kinds of radial distortion, drawn with the model x_d = x(1 + k1·r² + k2·r⁴). Barrel (k1 < 0) bows lines outward, pincushion (k1 > 0) bows them inward, and mustache (k1 < 0 with k2 > 0) turns from barrel near the centre to pincushion toward the edge.

- **Barrel distortion**: magnification falls with distance from the centre. Straight lines away from the centre bow outward. Commonlands notes that "Residual barrel in a rectilinear wide-angle lens and designed barrel in a fisheye both grow with field angle."
- **Pincushion distortion**: magnification rises with distance from the centre. Lines bow inward.
- **Mustache distortion**: barrel near the centre, turning toward pincushion at the edge, so straight lines wave. In the radial model below, it shows up as a negative k1 with a positive k2.

Classical optics explains the first two with the position of the aperture stop. A stop in front of a positive lens tends to give barrel distortion; a stop behind it, pincushion. Commonlands notes that barrel distortion in a conventional lens "is classified as a third-order (Seidel) transverse aberration", while "In fisheye lenses the curvature is the intended projection mapping, far beyond the third-order regime, not an aberration."

### Radial and tangential distortion

**Radial distortion** moves points along the line from the principal point, by an amount that depends only on their distance from it. It comes from the lens design itself, so it is symmetric about the axis. The OpenCV documentation says real lenses usually have "mostly radial distortion, and slight tangential distortion."

**Tangential (decentering) distortion** moves points partly sideways. It comes from manufacturing and assembly: lens elements whose centres do not lie exactly on one axis, or a lens not quite square to the sensor. The OpenCV tutorial describes it as occurring "because the image-taking lense is not aligned perfectly parallel to the imaging plane." Duane Brown's 1966 paper, *Decentering distortion of lenses*, is the classic treatment.

Two smaller effects have their own terms in OpenCV:

- **Thin-prism distortion** (coefficients s1 to s4): further asymmetric terms for what the radial and tangential terms leave over.
- **Sensor tilt** (τx, τy): OpenCV models a sensor tilted relative to the lens, noting that "The tilt causes a perspective distortion".

### Real radial distortion is monotonic

The image radius of a real lens always increases as the ray angle increases. A fitted model that bends back on itself is wrong, even if its error looks small. The OpenCV documentation warns: "Radial distortion is always monotonic for real lenses, and if the estimator produces a non-monotonic result, this should be considered a calibration failure." It adds that such a result "may look deceptively good near the image center but will work poorly in e.g. AR/SFM applications." One way it happens: if the target never reached the image corners, nothing constrains the high-order terms there.

## From physics to calibration models

Each calibration model encodes an assumption about the physical projection. In every model below, fx, fy, cx and cy are the focal lengths and principal point in pixels, and (x, y, z) is the point in camera coordinates.

### Pinhole with radial–tangential distortion (Brown–Conrady, "radtan")

The assumption: the lens is nearly rectilinear, with a small radial correction and a small decentering correction. Project with the pinhole, x′ = x/z and y′ = y/z, then, with r² = x′² + y′²:

```
x″ = x′ · (1 + k1·r² + k2·r⁴ + k3·r⁶) + 2·p1·x′·y′ + p2·(r² + 2·x′²)
y″ = y′ · (1 + k1·r² + k2·r⁴ + k3·r⁶) + p1·(r² + 2·y′²) + 2·p2·x′·y′
u  = fx · x″ + cx
v  = fy · y″ + cy
```

The k terms are radial and the p terms tangential. OpenCV's full version adds a rational denominator `(1 + k4·r² + k5·r⁴ + k6·r⁶)` to the radial factor, plus thin-prism and tilt terms. Kalibr calls the model `radtan`, with coefficients `[k1 k2 r1 r2]` (its r1 and r2 are the tangential terms). Because it starts with x/z, it cannot represent rays at or beyond 90° off axis.

Choose it for normal and moderately wide lenses. The mrcal documentation reports that the 8-parameter rational model "works decently well for wide lenses". For non-fisheye lenses, it says, its 4- and 5-parameter OpenCV models "work ok".

### Kannala–Brandt ("equidistant", OpenCV fisheye)

The assumption: the image radius is a polynomial in the ray angle θ, starting from the equidistant projection. In the form used by OpenCV's fisheye module and the double sphere paper:

```
θ    = atan2( √(x² + y²), z )
d(θ) = θ + k1·θ³ + k2·θ⁵ + k3·θ⁷ + k4·θ⁹
u    = fx · d(θ) · x / √(x² + y²) + cx
v    = fy · d(θ) · y / √(x² + y²) + cy
```

With all k = 0 it is a pure equidistant lens. The odd polynomial can bend to fit equisolid and stereographic lenses as well, so one model covers most fisheyes. [Kannala and Brandt (2006)](https://doi.org/10.1109/TPAMI.2006.153) proposed it as "suitable for fish-eye lens cameras as well as for conventional and wide-angle lens cameras". Kalibr calls it `equi`; OpenCV implements it in `cv::fisheye`.

One implementation detail matters for very wide lenses. Usenko et al. point out that OpenCV and Kalibr apply it after a pinhole projection, so it has a singularity at z = 0, that is, at 90° off axis, "which makes it unsuitable for fisheye lenses with field-of-view close to 180°". Unprojection also needs an iterative solve, because the polynomial has no closed-form inverse.

### Unified camera model ("omni", Mei)

The assumption: the point is first projected onto a unit sphere, then onto the image through a pinhole set back from the sphere's centre by a distance ξ (xi). The model was built for **catadioptric** cameras, which combine a lens with a curved mirror. In the parameterisation Usenko et al. propose, with `d = √(x² + y² + z²)` and α in [0, 1]:

```
u = fx · x / (α·d + (1 − α)·z) + cx
v = fy · y / (α·d + (1 − α)·z) + cy
```

With α = 0 it reduces to a pinhole. It can also model fisheye lenses, but Usenko et al. note that "it does not fit most fisheye lenses perfectly; thus, an additional distortion model is often added." Kalibr's `omni` model and OpenCV's `cv::omnidir` module both follow Mei and Rives (2007), usually paired with radtan distortion.

### Extended unified camera model (EUCM)

The assumption: like the unified model, but the sphere is replaced by an ellipsoid, controlled by a second parameter β. The projection is the same as above with:

```
d = √( β·(x² + y²) + z² )
```

With β = 1 it is the unified model again. EUCM has two distortion-like parameters (α, β), a closed-form inverse and no trigonometric functions, which makes it fast. It was introduced by Khomutenko, Garcia and Martinet, and Kalibr supports it as `eucm`.

### Double sphere (DS)

The assumption: the point is projected onto two unit spheres in turn, offset by ξ, and then through a pinhole shifted by α/(1 − α). With `d1 = √(x² + y² + z²)` and `d2 = √(x² + y² + (ξ·d1 + z)²)`:

```
u = fx · x / (α·d2 + (1 − α)·(ξ·d1 + z)) + cx
v = fy · y / (α·d2 + (1 − α)·(ξ·d1 + z)) + cy
```

Usenko, Demmel and Cremers describe it as a model "that well fits with large field-of-view lenses, is computationally inexpensive and has a closed-form inverse". It has six parameters in total. Kalibr supports it as `ds`.

### Field-of-view model (FOV)

The assumption: the image distance is roughly proportional to the ray angle, with one parameter w. In Usenko et al.'s notation, with `r_u = √(x² + y²)`:

```
r_d = atan2( 2·r_u·tan(w/2), z ) / w
u   = fx · r_d · x / r_u + cx
v   = fy · r_d · y / r_u + cy
```

It comes from Devernay and Faugeras (2001), *Straight lines have to be straight*. Usenko et al. write that, according to its authors, the parameter w "approximately corresponds to the field-of-view of an ideal fisheye lens". Kalibr offers it as a distortion model named `fov`. With a single parameter it is the most constrained of the fisheye models.

### Non-parametric and spline models

When the best parametric model still leaves a pattern in the residuals, some tools fit a flexible surface instead. mrcal's splined stereographic model is "mrcal's attempt to model real-world lens behavior with more fidelity than the usual parametric models make possible." Such models need dense target coverage across the whole image, because a spline is only constrained where there is data.

## How the models compare

Usenko et al. calibrated five lenses from 122° to 195° field of view with every model above. On their 195° lens (first sequence), the mean reprojection errors were:

| Model | Parameters | Mean reprojection error |
|---|---|---|
| Unified (UCM) | 5 | 0.236 px |
| FOV | 5 | 0.417 px |
| Double sphere | 6 | 0.145 px |
| EUCM | 6 | 0.145 px |
| Kannala–Brandt, 2 coefficients | 6 | 0.164 px |
| Kannala–Brandt, 4 coefficients | 8 | 0.145 px |

Their summary: "The evaluation results demonstrate that the model based on high-order polynomials (i.e., KB 8) shows the lowest reprojection error but is 5-10 times slower than competing models." Double sphere came within 1% of it on every sequence, and EUCM within 2%.

Fitting can also fail outright. The BabelCalib authors, testing on fisheye and catadioptric datasets, report that "Kalibr and OpenCV have both a 24% failure rate for the Kannala-Brandt model, and Kalibr has a 34% failure rate for FOV and 51% failure rate for EUCM." Their method avoids this by first fitting a simpler back-projection model that needs no initial guess, then converting it to the model the user wants. Wide-angle calibrations need a sanity check, not just a final error number.

## Which model for which lens

| Lens | Physical behaviour | Model to start with | Where to find it | Notes |
|---|---|---|---|---|
| Normal field of view | nearly rectilinear, slight barrel | pinhole + radtan (k1, k2, p1, p2, maybe k3) | OpenCV default; Kalibr `pinhole` + `radtan` | Add k3 only if the corners need it. |
| Wide rectilinear, up to about 120° | strong barrel, still rectilinear by design | pinhole + rational radtan (k1–k6) or Kannala–Brandt | OpenCV with the rational flag; mrcal `OPENCV8`; Kalibr `pinhole` + `equi` | Check the result is monotonic. |
| Fisheye, beyond about 120° and short of 180° | equidistant, equisolid or stereographic | Kannala–Brandt (4 coefficients), double sphere or EUCM | OpenCV `cv::fisheye`; Kalibr `pinhole` + `equi`, `ds`, `eucm` | DS and EUCM are faster to project and unproject; KB fit best in Usenko et al. |
| Fisheye near or beyond 180° | rays at or behind the lens plane | double sphere, EUCM or unified + distortion | Kalibr `ds`, `eucm`, `omni` + `radtan`; OpenCV `cv::omnidir` | Avoid implementations that divide by z first. |
| Catadioptric (lens + mirror) | single viewpoint via a mirror | unified (Mei) + radtan | Kalibr `omni` + `radtan`; OpenCV `cv::omnidir` | What the unified model was built for. |
| Any lens, highest fidelity | whatever the residuals show | splined model | mrcal splined stereographic | Needs dense coverage of the whole image. |

Three rules hold whatever the lens.

1. **Use the model your pipeline consumes.** A SLAM system or dataset format that expects Kannala–Brandt parameters gains nothing from a better fit in a model it cannot read.
2. **Judge the fit by its residuals across the whole image**, not by one RMS number. A pattern in the corner residuals means the model cannot follow the lens.
3. **Cover the edges.** Distortion is largest where the target is hardest to place. A model fitted only in the centre will extrapolate, and a high-order polynomial extrapolates badly.

## Sources

- OpenCV, [calib3d module documentation](https://github.com/opencv/opencv/blob/4.x/modules/calib3d/include/opencv2/calib3d.hpp) (source of the [published docs](https://docs.opencv.org/4.x/d9/d0c/group__calib3d.html)): the radial–tangential, rational, thin-prism and tilted-sensor models, the fisheye model, and the monotonicity warning.
- OpenCV, [camera calibration tutorial source](https://github.com/opencv/opencv/blob/4.x/doc/py_tutorials/py_calib3d/py_calibration/py_calibration.markdown): radial and tangential distortion.
- OpenCV contrib, [omnidir module](https://github.com/opencv/opencv_contrib/blob/4.x/modules/ccalib/include/opencv2/ccalib/omnidir.hpp): Mei's unified model.
- Kalibr, [supported models](https://github.com/ethz-asl/kalibr/wiki/supported-models), ETH Zurich ASL.
- Usenko, V., Demmel, N. and Cremers, D. (2018). [The double sphere camera model](https://arxiv.org/abs/1807.08957). *International Conference on 3D Vision (3DV)*: model definitions and the comparison table.
- Lochman, Y. et al. (2021). [BabelCalib: A universal approach to calibrating central cameras](https://arxiv.org/abs/2109.09704). *ICCV*: calibration failure rates.
- Kannala, J. and Brandt, S. S. (2006). [A generic camera model and calibration method for conventional, wide-angle, and fish-eye lenses](https://doi.org/10.1109/TPAMI.2006.153). *IEEE TPAMI* 28(8).
- Mei, C. and Rives, P. (2007). Single view point omnidirectional camera calibration from planar grids. *IEEE ICRA*.
- Khomutenko, B., Garcia, G. and Martinet, P. An enhanced unified camera model. *IEEE Robotics and Automation Letters* 1(1): 137–144.
- Devernay, F. and Faugeras, O. (2001). Straight lines have to be straight. *Machine Vision and Applications* 13(1).
- Brown, D. C. (1966). Decentering distortion of lenses. *Photogrammetric Engineering* 32(3): 444–462.
- Brown, D. C. (1971). Close-range camera calibration. *Photogrammetric Engineering* 37(8): 855–866.
- [mrcal lens models](https://mrcal.secretsauce.net/lensmodels.html): OpenCV model guidance and the splined model.
- Hecht, E. *Optics*. Pearson: aperture-stop position and distortion (standard textbook optics).
- Commonlands, [Wide-angle lenses and fisheye camera lens distortion](https://commonlands.com/blogs/technical/wide-angle-lenses-and-fisheye-camera-lens-distortion): the classic projections and barrel distortion.
