💬Comments welcome. To leave a note, select any text and click the note / highlight button that pops up — or open the panel with the tab at the top-right (‹). Notes are visible only inside our private review group.
Computational Photography, an AI-powered Slopendium — 09 Optics, lenses, and aberration correction
expand to📖 Full book outlinejump to1 parts · 11 chapters · 39 sections · 48 figures embedded · 7 placeholders · double-click a figure to enlarge
Part 9 OPTICS, LENSES, AND ABERRATION CORRECTION
Bottom line: in theory (thin-lens optics) everything converges nicely. In practice it is hard to make **all** the rays, from **all** field points, at **all** wavelengths, through **all** of the aperture, converge to the right place.
• because Snell's law is **non-linear** (the cubic term the thin lens dropped) and lenses are **not infinitely thin**;
• because the refractive index depends on **wavelength** (dispersion);
• because real surfaces, mounts, and air gaps add stray light, manufacturing error, and motion.
But with **computation** we can calibrate and correct — so the optics only has to get *close*, and software finishes the job. That partnership is the spine of the part.
---
9.1 Aberrations and optical challenges
fig-thin-lens-vs-real
fig-thin-lens-vs-real · side-by-side "convenient lie vs reality": ideal thin lens (single plane, all parallel rays → one focus) vs a real thick multi-surface lens where outer rays focus short of the paraxial focus (spherical aberration → blur, no single point)
fig-doublet-triplet-gauss
fig-doublet-triplet-gauss · cross-sections of three classic designs as stacked glass elements — achromatic doublet (2), Cooke triplet (3, + − +), double-Gauss (6, ≈symmetric about the stop); each labels element count and the aperture stop
fig-double-gauss
fig-double-gauss · a labelled double-Gauss cross-section: 6 elements ≈symmetric about the central aperture stop, parallel ray bundle traced to the focal plane; notes near-mirror symmetry cancels odd aberrations (coma, distortion, lateral colour)
fig-telephoto-vs-retrofocus
fig-telephoto-vs-retrofocus · two two-group schematics — telephoto (+ then −, principal plane H′ pushed in front → physical length < f) vs retrofocus/inverted-telephoto (− then +, long back-focal distance to clear the SLR mirror); marks f vs physical length, H′, F′
fig-zoom-mechanism
fig-zoom-mechanism · a zoom at two focal lengths (short-f/wide vs long-f/tele): moving variator + compensator groups slide along the axis to change f while the focal plane (sensor) stays fixed; motion arrows between states
fig-principal-planes-pupils
fig-principal-planes-pupils · a thick-lens cardinal-points diagram: principal planes H, H′, nodal points N, N′, entrance & exit pupils (the stop imaged by front/rear groups), focal points F, F′; f measured from H′ via the H→H′ equivalent-thin-lens construction
equations
thick-lens / system focal length via the two principal planes (FUNDAMENTALS' $1/f=1/u+1/v$ holds when $u,v$ are measured from $H, H'$)
f-number from the **entrance-pupil** diameter $N = f/D_{\text{EP}}$ (not the front element)
T-stop $T = N/\sqrt{\tau}$ (transmittance $\tau<1$)
effective vs back focal length.
9.2 Aberrations correction
fig-achromat-doublet
fig-achromat-doublet · an achromatic doublet: positive crown cemented to negative flint; singlet panel (red & blue split = chromatic aberration) vs doublet panel (red = blue at a common focus); labels crown/flint, low/high dispersion
⬜ figure not yet created
the dispersion cancels)
fig-lens-profile-correction
fig-lens-profile-correction · computational lens correction: a real window-grid facade degraded (barrel + vignette + lateral CA) → a measured profile's three radial maps (warp / gain / per-channel rescale) → corrected; note: geometric defects only, not blur (Aberrations correction)
fig-psf-deconvolution
fig-psf-deconvolution · non-blind deconvolution by the measured PSF: a real crop convolved with a comatic PSF (inset) + noise → Wiener deconvolution (sharper) → under-regularized (noise amplified); image = scene ∗ PSF (Aberrations correction)
equations
**achromat condition** $\phi_1/V_1 + \phi_2/V_2 = 0$ (powers weighted by dispersion cancel the chromatic term — Abbe number $V_d=(n_d-1)/(n_F-n_C)$ from the challenges chapter)
image = scene $*$ **PSF** $\to$ correction = **deconvolution** by the *measured, spatially-varying* PSF (cross-ref Wiener $\hat X = \overline K Y/(|K|^2+\mathrm{SNR}^{-1})$).
9.3 Lens optimization
fig-merit-function-loop
fig-merit-function-loop · lens design as optimization, a closed loop: parameters → ray-trace (fields × wavelengths × pupil zones) → merit function Φ (weighted spot/wavefront + constraints) → damped-least-squares step → repeat; the book's forward-model+loss+optimizer pattern (Lens optimization)
⬜ figure not yet created
before/after optimization) fig-wb-before-after
fig-lens-design-tradeoff
fig-lens-design-tradeoff · lens-design Pareto cartoon as a 6-axis radar (sharpness, speed, size, weight, cost, distortion): fast pro prime vs compact phone lens overlaid, plus a dashed polygon showing where software correction shifts the phone lens (Lens optimization)
fig-rms-spot-vs-field
fig-rms-spot-vs-field · RMS spot radius (µm) vs field (center→corner) for 3 wavelengths, rising toward the edge, with the Airy diffraction limit as a shaded dashed floor (Lens optimization)
• the move: add elements → add **surfaces, glasses, and air gaps** → add free parameters to *trade off* aberrations against each other. The art is doing it with as few elements as the quality target allows (cost, weight, flare).
equations
ray-trace forward model — apply Snell's law $n_1\sin\theta_1=n_2\sin\theta_2$ surface-by-surface (no paraxial approximation)
merit function $\Phi = \sum_{\text{fields}}\sum_{\lambda}\sum_{\text{pupil rays}} w_i\,\lVert (x_i,y_i) - (\bar x,\bar y)\rVert^2 \
+\
(\text{constraints on } f, \text{length, edge thickness}\dots)$ — a weighted sum of squared transverse ray errors plus penalties
damped-least-squares (Levenberg–Marquardt-style) update on the parameter vector.
9.4 A short bestiary of classic designs
• **achromatic doublet**: a positive crown + negative flint, usually cemented; the *minimum* system that corrects color (two wavelengths) and is also used to tame spherical aberration. (Full treatment in *Aberrations correction*.) [`fig-doublet-triplet-gauss`]
• **Cooke triplet**: three elements (+ − +) — the smallest design with enough freedom to correct **all** the primary (Seidel) aberrations *and* color; the ancestor of most simple lenses. [`fig-doublet-triplet-gauss`]
• **double-Gauss (Planar)**: roughly **symmetric about the aperture stop**, 6–7 elements; symmetry automatically cancels the *odd* aberrations (coma, distortion, lateral color), which is why it dominates fast normal lenses ($f$/2 and faster). [`fig-double-gauss`]
• **telephoto vs. retrofocus** — two ways to decouple physical length from focal length: [`fig-telephoto-vs-retrofocus`]
• **telephoto** (positive group then negative): the rear negative group pushes the rear principal plane *forward*, so a long-focal-length lens is **physically shorter** than its $f$.
• **retrofocus / inverted telephoto** (negative then positive): pushes the rear principal plane *back*, giving a long **back-focal distance** — needed so a wide-angle lens clears the SLR mirror box (and historically why mirrorless can go wider/smaller).
• **zoom**: a variable-focal-length system — groups slide so $f$ changes (the *variator*) while a *compensator* group keeps the image plane fixed; many elements, many compromises, the hardest thing to optimize. [`fig-zoom-mechanism`]
9.5 Special optics
fig-scheimpflug-tilt
fig-scheimpflug-tilt · the Scheimpflug principle: tilting the lens makes the lens plane, image plane & plane of focus meet in a common line → the focus plane tilts into a wedge of sharpness; contrasted with the parallel (untilted) case
fig-fisheye-projection
fig-fisheye-projection · projection mappings — image radius r vs incidence angle θ for rectilinear (r=f·tanθ, blows up near 90°), equidistant (r=f·θ) and equisolid (r=2f·sin(θ/2)); why fisheye reaches ~180° where rectilinear can't
fig-seidel-aberrations
fig-seidel-aberrations · the five monochromatic (Seidel) aberrations at a glance — spherical, coma, astigmatism, field curvature, distortion — each a tiny ray/spot icon + a one-line "what it looks like" note
fig-catadioptric-mirror-lens
fig-catadioptric-mirror-lens · a mirror (catadioptric) lens: light folds via primary + secondary mirror (Cassegrain); central obstruction → ring-shaped (doughnut) bokeh — folded path + doughnut-highlight inset
fig-wide-angle-perspective-distortion
fig-wide-angle-perspective-distortion · wide-angle perspective distortion: off-axis spheres image as radially-stretched ellipses (flat-sensor geometry), and faces near a wide frame's edge are widened — not a lens flaw; forward-ref to correction (Pinhole image formation)
fig-anamorphic-squeeze
fig-anamorphic-squeeze · anamorphic optics: 2× horizontal squeeze at capture → de-squeeze in post; a circle → vertical oval on sensor → restored; oval bokeh + horizontal flares noted
fig-fresnel-zones
fig-fresnel-zones · a Fresnel lens: collapse a thick convex lens into concentric ring "zones" that keep the local surface slope but drop the bulk; cross-section of a normal lens vs its Fresnel equivalent
fig-grin-vs-metalens
fig-grin-vs-metalens · three ways to bend light: shaped bulk lens (refraction), a GRIN rod (curved ray through a varying-index medium, flat faces), and a metalens (flat surface, sub-wavelength nanostructures setting a phase profile); "keep the phase, drop the thickness"
fig-tilt-shift-perspective
fig-tilt-shift-perspective · the *shift* movement (not tilt): tilting the camera up keystones a building (converging verticals) vs. keeping the sensor vertical/parallel and raising the lens within a large image circle, so verticals stay parallel — architectural perspective control
fig-telescope-types
fig-telescope-types · refractor (doublet objective → focus) vs. reflectors — Newtonian (concave primary + flat 45° secondary → side focus) and Cassegrain (primary + convex secondary → focus through a hole behind the primary); glass vs. mirrors to a focus
fig-microscope-objective
fig-microscope-objective · high-NA objective at a short working distance: finite (fixed tube length, objective forms the image directly) vs. infinity-corrected (subject at front focus → parallel "infinity space" → separate tube lens forms the image)
fig-soft-focus
fig-soft-focus · a soft-focus portrait lens: under-corrected spherical aberration (marginal rays cross nearer than paraxial → halo at the paraxial plane) and the resulting PSF — a sharp core inside a broad glow vs. a well-corrected lens; a *wanted* aberration
fig-apodization-pupil
fig-apodization-pupil · an apodizing filter: pupil transmission profile (hard-edged plain aperture vs. radially graded) → the defocus disk each makes (flat disk with a hard ring vs. a smoothly fading disk, no ring) — shaping the bokeh PSF in hardware
equations
**Scheimpflug condition** (lens plane, image plane, focus plane meet in one line) + the **Hinge rule** for where the focal wedge pivots
fisheye projection laws $r = f\theta$ (equidistant), $r = 2f\sin(\theta/2)$ (equisolid-angle) vs. rectilinear $r = f\tan\theta$
anamorphic squeeze factor (typ. 2×)
Fresnel = local surface slope preserved, bulk removed.
9.6 Focus, autofocus
fig-focus-conjugate-move
fig-focus-conjugate-move · focusing geometry: as subject distance u changes the image distance v must change (1/f=1/u+1/v); the lens slides to keep the image plane on the fixed sensor — near vs far focus (lens extends vs retracts)
fig-contrast-af-curve
fig-contrast-af-curve · contrast-detect AF: high-frequency contrast (sharpness) vs focus position, peaked at best focus; hill-climb arrows that must overshoot past the peak then step back (no direction cue)
⬜ figure not yet created
hunting to find it)
fig-pdaf-principle
fig-pdaf-principle · phase-detect AF: a separator splits the beam to two line sensors; the signed phase (separation) of the two profiles gives direction + amount of defocus ("stereo in the lens"); in-focus vs front/back-focus
fig-dual-pixel-af
fig-dual-pixel-af · on-sensor / dual-pixel AF: a photodiode split into L/R halves under one microlens; the L vs R images give per-pixel disparity → defocus; split-pixel cross-section + the two readout images
fig-depth-from-defocus
fig-depth-from-defocus · depth from defocus: the blur-disk diameter grows with distance from the focus plane; two shots at different focus/aperture → estimate depth from the relative blur
equations
focus error → sensor shift via $1/f=1/u+1/v$ (differentiate to get sensor move per diopter)
contrast metric (sum of squared gradients / high-pass energy) maximized
phase-detect: **disparity between the two pupil half-images is proportional to defocus** (it is stereo with a baseline = the pupil split — ties to FUNDAMENTALS $Z=fB/d$)
defocus blur radius $\propto$ distance from focus and aperture (from *Depth of field*).
9.7 Depth of field
fig-dof-double-cone
fig-dof-double-cone · object-space DoF as a double cone in front of the lens, waist on the focus plane (the blur for one scene point) 🟨
fig-dof-coc
fig-dof-coc · depth of field via the circle of confusion: the double cone behind the lens; points whose blur disk stays within the CoC limit c at the sensor are "acceptably sharp" → near/far DoF limits; CoC + hyperfocal H=f²/(N·c) labeled
⬜ figure not yet created
pointer to FUNDAMENTALS for the full geometry)
fig-bokeh-shapes
fig-bokeh-shapes · bokeh: out-of-focus highlights take the aperture's shape — circular (many blades / wide open) vs polygonal (few blades, stopped down); synthetic defocus-disk fields + aperture insets
fig-cats-eye-vignetting
fig-cats-eye-vignetting · cat's-eye bokeh: off-axis defocus disks clipped into lemon / cat's-eye shapes by optical (mechanical) vignetting toward the frame edge; round at centre → clipped at edge, tilted toward centre
fig-focus-stacking
fig-focus-stacking · optics-chapter illustrative figure (07-07 Figure 4): a stepped-focus stack → sharpness selection → all-in-focus composite. Synthetic per-slice defocus on one photo (`sourced/corn-cobs.jpg`, © Frédo Durand) — license-safe. The full real-data treatment lives in part-08 `fig-focalstack-*`
equations
**all imported** from FUNDAMENTALS (circle of confusion, hyperfocal $H=f^2/(Nc)$, near/far limits, DoF scaling). New here: aperture-shape ⇒ defocus-disk shape (the disk is the **image of the aperture stop**)
cat's-eye area loss from off-axis pupil clipping.
9.8 Fake (synthetic) depth of field
---
9.9 Glare suppression
fig-lens-flare-ghosting
fig-lens-flare-ghosting · stray light: a bright source, a ray reflecting off two internal lens surfaces → a "ghost" landing displaced on the sensor, plus a veiling-glare wash; ghost vs flare labelled
fig-dr-clip-vs-noise
fig-dr-clip-vs-noise · one exposure's two walls — clipping at full-well above, the noise floor below — shading the narrow band of scene contrast that fits between them 🟨
fig-ar-coating-interference
fig-ar-coating-interference · anti-reflection coating: a quarter-wave film cancels the front-surface reflection by destructive interference (top-surface reflection vs film–glass reflection, extra path λ/2 → out of phase); two emergent wavelets summing to ~0 + design rules $n_c=\sqrt{n_1 n_2}$, $d=\lambda/4n_c$
fig-lens-hood-baffles
fig-lens-hood-baffles · lens hood + internal blackened baffles: an off-axis source (sun outside the frame) is blocked by the hood; stray light that sneaks in is trapped/absorbed by baffles; wanted image-forming rays (within the angle of view) pass through to the sensor
fig-veiling-glare-psf
fig-veiling-glare-psf · a PSF with a bright core + a broad low-level skirt (veiling glare) on a log-radial profile; second panel shows the integrated veil lifting blacks / reducing contrast
equations
Fresnel reflectance at an interface $R=\left(\frac{n_1-n_2}{n_1+n_2}\right)^2$ (~4%/surface for air–glass → why an uncoated multi-element lens loses huge contrast)
**quarter-wave AR condition** — coating index $n_c=\sqrt{n_1 n_2}$ and thickness $\lambda/4$ for destructive interference
veiling glare modeled as the image $*$ a **broad glare PSF** → deconvolution.
9.10 Optical stabilization
fig-handshake-motion-blur
fig-handshake-motion-blur · hand-shake motion blur: a small angular shake $\Delta\theta$ over the exposure smears a point into a streak of length $\approx f\,\Delta\theta$ on the sensor (lens as pivot, focal length $f$); the $t<1/f$ shutter rule of thumb
fig-ois-vs-ibis
fig-ois-vs-ibis · two stabilization strategies side-by-side: lens-shift OIS (floating lens group moves) vs sensor-shift IBIS (sensor moves on a magnetic stage), moving element highlighted, same gyro/IMU input
fig-gyro-feedback-loop
fig-gyro-feedback-loop · the stabilization control loop as a block diagram: gyro/IMU senses angular rate → controller → actuator moves the lens group/sensor → position sensor feeds residual error back (sense→control→actuate→measure, ~kHz)
fig-digital-vs-optical-stab
fig-digital-vs-optical-stab · optical (in lens/sensor, before capture, full resolution & FOV) vs digital/electronic IS (crop-and-warp in software after capture): the EIS safety-margin crop + warp costing resolution/field of view vs the optical in-lens/sensor correction
equations
image-plane shift for a camera rotation $\Delta\theta$ is $\approx f\,\Delta\theta$ (so **longer $f$ ⇒ more blur ⇒ more correction needed**)
stabilization benefit quoted in **stops** = $\log_2$ of the shutter-time ratio it allows
the actuator must move the element/sensor to make the **net image displacement ≈ 0** over the exposure.
9.11 The eye as an optical instrument: vision and its correction
fig-eye-as-camera
fig-eye-as-camera · the eye as a camera: cornea + crystalline lens = objective, iris/pupil = aperture, retina = sensor (fovea), accommodation = autofocus — labelled cross-section
fig-refractive-errors
fig-refractive-errors · the four refractive errors — myopia / hyperopia / astigmatism / presbyopia — where the image focuses vs the retina and the correcting (negative / positive / cylindrical / add) lens
⬜ figure not yet created
bifocal vs progressive vs AF-glasses focal zones [schem] fig-bifocal-progressive-af