Skip to content

Lenses and distortion

A camera lens is an optical assembly of curved glass or plastic; it gathers, bends, and focuses light onto a camera’s digital sensor.

Focal length and field of view

Focal length sets magnification. For a given sensor, a shorter focal length gives a wider field of view (FOV) and smaller objects; a longer focal length narrows the FOV and fills the frame with distant detail. FOV depends on both focal length and sensor size, so the same lens gives a different FOV on a different sensor.

Angular resolution follows directly: spreading a fixed pixel count over a wider FOV means fewer pixels per degree.

Aperture and depth of field

The F-number (focal length over aperture diameter) sets how much light the lens passes and how much is in focus. A low f-number passes more light, which helps the exposure budget, but shrinks depth of field, so near and far objects cannot both be sharp. A high f-number deepens focus but starves the sensor and eventually softens the image through diffraction.

Distortion models

Lenses distort rays of light that pass through them. Lens-related deviations are modeled and removed before the image is used for geometry. OpenCV has a good tutorial: Understanding lens distortion.

Barrel distortion diagram Pincushion distortion diagram
Figure 7 — Radial distortion: barrel distortion (lines bow outward) and pincushion distortion (lines pinch inward), each worst at the frame edge. Source: WolfWings, public domain and WolfWings, public domain, via Wikimedia Commons.
  • Radial distortion bends straight lines into barrels or pincushions, worst at the frame edge. The standard polynomial model uses coefficients k₁, k₂, k₃:
xd = x (1 + kr² + kr⁴ + kr⁶)
  • Tangential distortion comes from a lens not parallel to the sensor, with coefficients p₁, p₂:
xd = x + [ 2pxy + p₂(r² + 2x²) ]
  • Fisheye (equidistant) models very wide lenses, where the radial polynomial breaks down. OpenCV uses a separate four-coefficient fisheye model (k₁ to k₄); see the fisheye module. Above roughly 150° an omnidirectional or double-sphere model fits better.
Photograph taken through a fisheye lens
Figure 8 — A fisheye lens. Strong radial curvature near the edges is the rule, not a defect, and requires the equidistant model rather than the standard radial polynomial. Source: Thomas's Pics, CC BY 2.0, via Wikimedia Commons.
  • Rational polynomial adds denominator terms for wide lenses that are not quite fisheye.

The model has to match the lens. Forcing the standard radial model onto a fisheye leaves large residuals at the edge, which is exactly where obstacles first appear.