Computational Photography
Phone cameras beat physics with math: tiny lenses, noisy sensors, yet stunning night shots. Computational photography stacks bursts, merges exposures, and learns priors to outshoot glass.
Why Does This Exist?
Phone bodies cannot carry glass: millimeter-thick lenses and pea-sized sensors cap light collection a hundredfold below full-frame cameras. Physics says phone photos should be noisy, blurry, and range-starved — and single shots are. Yet night modes stun, because the shutter fires bursts while algorithms do the seeing.
Computational photography replaces optics with computation: align-and-merge bursts for noise, multi-exposure fusion for range, subpixel dithering for resolution, learned denoisers and tone maps for finish. The shot is a computation with a lens attached. The ray-recording sibling is light field imaging; the measurement-frugal sibling is compressive sensing.
The one idea you need first. Align-and-merge registers a burst to one reference frame, then averages: signal adds coherently while independent noise averages down by for frames. HDR merging weights each exposure's pixels by well-exposedness (downweighting clipped highs and noisy lows) so every tone comes from its best witness.
Think of It Like This
A choir versus a soloist
One great soprano outsings any amateur — a single full-frame exposure beats any single phone frame. But eight decent singers in tight harmony produce a wall of sound no solo throat matches: voices add, wobbles cancel, and the blend covers individual cracks.
Burst photography is the choir. Each frame is a mediocre singer (noisy, dim); alignment is the rehearsal putting everyone on the same note; averaging is the performance where signal harmonizes and noise — singing random notes — cancels itself. HDR adds sections: basses (shadows) and sopranos (highlights) each sing their best range.
How It Actually Works
Capture fires a burst around the shutter press (including pre-shutter frames from the always-running viewfinder stream). Pipeline stages: pick the sharpest reference, align the rest hierarchically (global motion, then tile-level flow), merge with robustness weights that reject misaligned tiles, then demosaic, denoise with learned priors, tone-map, and sharpen. Night modes extend exposures and lean harder on alignment; super-resolution modes exploit subpixel handshake jitter as free dithering.
Motion breaks the harmony assumption: movers need detection and single-frame fallback, or they smear into ghosts.
Worked example
Noise: single-frame noise ; -frame merged noise — nearly threefold cleaner, the choir dividend.
HDR: one scene point reads (near clipping), , and across three exposures. Well-exposedness weights , , :
Merged value : the mid exposure dominates, the clipped one barely votes, the dark one assists. Every tone elects its best witness.
Code
The point of this snippet is the merge: weights elect exposures and the average lands at .
def hdr_merge(values: list, weights: list) -> float: total = sum(weights) return sum(v * w for v, w in zip(values, weights)) / total
print(round(hdr_merge([250.0, 120.0, 30.0], [0.1, 1.0, 0.6]), 1)) # -> 95.9print(round(8.0**0.5, 2)) # -> 2.83Watch Out For
Ghosts where alignment surrendered
Movers defeat tile alignment: pedestrians smear, wheels duplicate, flags shred. Robustness weights downweight the damage, but large motion leaves visible ghosts or fallback seams that read as artifacts in prints.
Detect motion magnitude per tile and fall back to the single best frame there. Review bursts with motion before shipping the merge — the failure hides at thumbnail scale and surfaces at full size.
Watercolor faces from heavy priors
Aggressive learned denoisers erase pores, hair strands, and fabric weave along with noise, leaving waxy "watercolor" skin. The metric (noise down!) improves while the portrait dies.
Tune denoising strength per content (faces weaker than skies) and A/B at crop with human raters. Noise numbers cannot see texture murder; eyes can.
The Quick Version
- Computational photography trades glass for bursts: align, merge, and let math outshoot optics.
- Eight frames cut noise -fold; the worked HDR merge lands at from three exposures.
- Night modes, super-resolution bursts, and learned finishers extend the same pipeline.
- Movers break alignment into ghosts — detect motion and fall back per tile.
- Heavy denoisers watercolor faces; judge strength at full crop with human eyes.