draft · v0.1.226
💬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.
💡 In a hurry? Jump to this chapter’s 1 big lesson ↓

2.14 Imaging as a linear system

The image-measurements chapter ended with a single pixel: its value is an integral of the light against a sampling kernel. That is true, but it is a statement about one number. A photograph is millions of numbers, and the whole point of computational photography is to reason about the camera that produced them — to ask not just "what did this pixel measure?" but "what did this camera, as a whole, do to the scene?" This chapter gives that question a single, compact answer.

Every imaging system can be written as a linear map. Discretize the scene into a list of numbers — a vector $\mathbf{x}$ — and discretize the image the same way into a vector $\mathbf{y}$, and the camera is a matrix $A$:

$$ \mathbf{y} = A\,\mathbf{x} + \mathbf{n}. $$

In words: the measured image is the matrix $A$ times the scene, plus measurement noise $\mathbf{n}$. This is nothing more than the image-measurements chapter's "a pixel is an integral," repeated for every pixel and with all the weights kept. Each pixel value was a weighted sum of scene radiances; collect the weights for pixel $i$ into the $i$-th row of $A$, and the matrix–vector product reproduces every one of those integrals at once. The content of this chapter is the realization that follows: which weights you put in $A$ is the imaging system. A pinhole, a lens, a coded aperture, a stereo pair — they differ only in their matrix.

This is the part's big lessons made concrete. We said image formation is selecting and combining rays: a pinhole selects a single ray for each pixel, a lens combines a whole cone of them. The matrix $A$ is exactly that selection-and-combination, written down. A row that is zero everywhere except one entry selects one scene element; a row full of small weights combines many. Read a camera's matrix and you have read what the camera does to light.

To keep $A$ small enough to look at, we work in flatland, a two-dimensional world with a one-dimensional scene and a one-dimensional sensor, and we discretize both, so that $A$ is a modest matrix we can draw as a picture (Figure 2.14.1). Everything generalizes to the real 2-D-scene, 2-D-sensor case; the matrices just get larger (a 2-D image flattened into a long vector, $A$ correspondingly huge), and they are too big to draw but conceptually identical. Flatland loses nothing essential and gains a matrix we can see.

fig-linsys-flatland
Figure 2.14.1. Imaging in flatland. A flat billboard carrying a color gradient stands at some depth in a 2-D world; below it, three imaging systems form a 1-D image on a 1-D sensor, drawn as the bundles of rays each one gathers: a pinhole (one ray per pixel — a sharp but light-starved image), a lens (a cone of rays per pixel — bright, but only one plane is in focus), and a stereo pair (two pinholes, two images). Discretizing the billboard and the sensor turns each of these into a small matrix $A$ with $\mathbf{y}=A\mathbf{x}$.

How we feed $A$ depends on how we choose to write down "the scene." There are two standard parameterizations, and the difference between them is the spine of this chapter. The first treats the scene as a flat billboard at a fixed depth — a single row of colored points. It is the obvious choice, it makes the matrices concrete, and it has one sharp limitation we will hit head-on. The second treats the scene as ray space — the set of all rays, the light field — and it is the parameterization that removes the limitation. We take them in turn.

2.14.1 Linear systems from a billboard to an image

Start with the simplest possible scene: a flat billboard standing at some chosen depth, facing the camera, painted with a 1-D pattern of color. Discretize it into a row of points, stack their values into $\mathbf{x}$, and ask what matrix each flatland camera applies. Because the billboard is flat and at a known depth, each system's $A$ is a small matrix we can render as a heat-map — bright where the weight is large, dark where it is zero — and the shape of that heat-map is the character of the camera (Figure 2.14.2).

fig-linsys-matrices
Figure 2.14.2. The same six flatland cameras, each as its matrix $A$ (billboard → image), rendered as a heat-map (bright = large weight). Pinhole: a permutation — one bright entry per row (sharp, light-starved). Pinspeck: its complement — all-ones minus the pinhole pattern. Lens: a banded blur — a smeared diagonal, narrow at the focal depth, wider off it. Corner camera: lower-triangular — a cumulative integral of the scene, inverted by differentiation. Stereo pair: a taller matrix — two pinhole blocks stacked, giving disparity. Coded aperture: a coded blur — a patterned band engineered to be invertible (and depth-revealing). The shape of the heat-map is the character of the camera.

Six cameras, six matrices, one picture each — and that gallery is genuinely the content of half this book in miniature: design the matrix, and you have designed the camera.

This billboard parameterization is tied to a single depth. The matrix $A$ for the lens was a band whose width came from how far the billboard sat from the focal plane; the matrix for the stereo pair encoded a disparity that came from the billboard's distance. Move the billboard nearer or farther and every one of these matrices changes — the lens band widens, the stereo shift grows. A billboard matrix describes the imaging of one flat scene at one depth, and a real scene has many depths at once. We need a way to write down the scene that does not bake in a depth. That is exactly what the light field does.

2.14.2 Linear systems from ray space (light fields) to an image

The fix is to stop describing the scene as a surface and start describing it as rays. Instead of "the color of the billboard at position $u$," take as the unknown "the radiance of the ray arriving at the camera from direction so-and-so, through aperture position so-and-so." The full set of those rays is ray space — the light field (Part 13) — and stacking all of it into $\mathbf{x}$ gives a parameterization that knows nothing about depth: depth is no longer a property of the operator; it is structure inside $\mathbf{x}$ (a depth edge is a particular pattern of which rays carry which color).

Once the scene is ray space, the imaging system becomes a fixed linear projection of that ray space down to the image — and crucially, the projection no longer depends on scene depth. One matrix describes the camera for every scene, because the scene's depth has moved out of $A$ and into $\mathbf{x}$. The same cameras from the billboard gallery reappear, now as different ways of slicing the one light field (Figure 2.14.3):

Every camera is a different projection of the same underlying light field. That single picture — drawn here after Levin, Freeman and Durand — ties the whole "cameras differ by how they slice the light field" theme together, and it is the reason the operator view is worth installing now.

fig-camera-tradeoffs-1
Figure 2.14.3. Every camera as a projection of the same light field. A flat-world scene (top) and its 2-D light field (the radiance of every ray, parameterized by position and direction); below, the set of rays that each camera integrates to form one image pixel — pinhole, lens, a focus change, a stereo pair, a plenoptic (light-field) camera, a coded aperture, and wavefront coding. Each camera is a different linear projection of the one light field; the differences between cameras are differences in which rays they sum, made visible. Reproduced from Levin, Freeman & Durand Levin, Freeman & Durand 2008.

This ray-space view is the natural home of the linear-system framing — Torralba, Isola and Freeman develop the camera as a linear system in exactly these terms Torralba, Isola & Freeman, Foundations of Computer Vision, and the Bayesian trade-off analysis that this figure comes from compares cameras precisely by how their light-field projections behave Levin, Freeman & Durand 2008. The idea to carry out of this section is the thesis of much of the rest of the book: a great deal of computational photography and computational optics is the search for new linear imaging systems $A$ — paired with the reconstruction method that inverts each one — that pull better images and extra information, notably depth, out of the light.

💡 Big lesson (L2.50) — a camera is a giant linear operator $\mathbf{y}=A\mathbf{x}+\mathbf{n}$

Strip away the glass and an imaging system is one linear map: it takes the scene $\mathbf{x}$ — written either as a flat billboard at a fixed depth or, more generally, as ray space (the light field) — and returns the image $\mathbf{y}=A\mathbf{x}+\mathbf{n}$, a linear projection of the scene plus sensor noise. The matrix $A$ is the camera: pinhole, lens, stereo, coded aperture, the motion-invariant sweep — they differ only in their rows. And because $A$ is a design rather than a fact of nature, building an optical system is choosing $A$: the whole of computational optics is engineering the operator — in space, in time, in ray space — together with the reconstruction that inverts it, to pull better images and extra information out of the light. Everything after this chapter is organized by one question about that operator: how invertible is $A$?

2.14.3 Space–time: imaging across time

So far $\mathbf{x}$ has held a static scene. Add time as another axis of $\mathbf{x}$, a moving scene captured over an exposure, and the picture is unchanged: it is still $\mathbf{y}=A\mathbf{x}$, now over space and time. The previous chapter already noted that the exposure is an integral over time; here that integral is just more rows and columns of $A$. A moving point smears along its trajectory, and motion blur is a linear operator whose kernel is the path the point traced during the exposure.

The trouble with ordinary motion blur is that this operator depends on the scene: a fast object blurs differently from a slow one, and you cannot deconvolve away a blur whose kernel you do not know and which differs across the frame. Motion-invariant photography turns this into an engineering opportunity. Sweep the camera along a carefully chosen parabolic trajectory during the exposure, and the blur point-spread function comes out the same for every object speed — the parabolic sweep is designed so that whatever an object's velocity, it spends matched time at matched positions, yielding one velocity-independent blur (Figure 2.14.4). A single deconvolution then sharpens objects moving at any speed.

fig-linsys-motion-invariant
Figure 2.14.4. Motion-invariant photography. Left: in a normal exposure, objects moving at different speeds (the diagonal traces) leave different-length, velocity-dependent blurs — no single deconvolution can sharpen all of them. Right: sweeping the camera along a parabolic trajectory during the exposure makes the blur point-spread function essentially the same for every speed, so one deconvolution deblurs the whole frame. Engineering the operator — the parabolic sweep — turns an otherwise scene-dependent $A$ into a single invertible kernel. After Levin et al. Levin et al. 2008 (motion-invariant).

The move is the same one coded aperture made in space: engineer the operator so that it inverts cleanly, rather than accepting whatever blur the scene hands you and hoping to undo it Levin et al. 2008 (motion-invariant). Motion-invariant photography is the temporal sibling of coded aperture and wavefront coding, and it gets its full treatment alongside them in 16 Computational optics and coded imaging and Motion blur, temporal sampling, and resampling. For now it makes the broader point: once imaging is a linear operator, you can design the operator — in space, in time, in both — to make the inversion work.

2.14.4 When linearity breaks down

A caveat before we move on, because the clean equation $\mathbf{y}=A\mathbf{x}$ is an idealization with real edges. Three departures matter.

First, clipping. A photosite well holds only so many electrons and an encoded pixel only so many code values, so the moment a measurement saturates — a blown highlight, a crushed black — the response stops being linear: past the limit, doubling the light no longer doubles the number, it returns the same ceiling (or floor). Clipping is a hard nonlinearity bolted onto the linear model, which is exactly why saturated pixels poison a deconvolution or an exposure merge and have to be detected and handled specially (→ Blind deblurring, HDR merging). It is worth distinguishing from the gamma nonlinearity of the encoding: gamma is invertible, so we simply undo it and work in linear light, whereas clipping destroys information outright and no inverse brings it back.

That gamma nonlinearity is different from clipping because it is invertible, and it comes with a useful algebraic convenience. Gamma encoding is a deliberate, invertible power law $V = L^{1/\gamma}$ applied to linear light $L$ (→ Color technology); it breaks linearity on the stored code values, but you can always decode it, $L = V^{\gamma}$, and work in linear light. Better still, because it is a pure power law, the two linear operations you reach for most often have exact equivalents directly on the encoded values, so you need not decode at all. Scaling the scene by an exposure factor of $2^{EV}$ becomes a multiply on the encoded value, $V \mapsto 2^{EV/\gamma}\,V$ — the exposure adjustment is simply the stop divided by gamma; and a white-balance gain $g_c$ on linear channel $c$ becomes a per-channel multiply $V_c \mapsto g_c^{1/\gamma}\,V_c$. (Both are exact for an ideal power law; for sRGB's piecewise curve, with its small linear segment near black, they hold to a close approximation everywhere but the deepest shadows.) The other encoding nonlinearity, quantization — rounding each value to one of a finite set of code levels (8, 10, or 12 bits) — is technically nonlinear too, but it is the mildest departure of all: its error is bounded by half a code step and is, to good approximation, uniform and signal-independent, so the standard and accurate move is simply to fold it into the noise term $\mathbf{n}$ as one more additive source (a uniform error of variance $\Delta^2/12$ for a code step $\Delta$). At any sane bit depth that contribution is dwarfed by photon and read noise — which is exactly why quantization rarely earns a separate treatment: modeled as noise, it disappears into the noise. It matters only where it compounds — repeated round-trips through 8 bits, or aggressive tone curves that stretch a handful of shadow codes into visible banding, the regime where dithering earns its keep.

Second, not everything we want is a linear function of the scene. The model $\mathbf{y}=A\mathbf{x}$ recovers the image $\mathbf{x}$ — radiance on a grid — but much of computational photography is after something else entirely: the depth of each pixel, the motion in the frame, the material of a surface, the identity of a face. These are in general not linear read-outs of the light. Depth from defocus or stereo, for instance, enters through a ratio of blurs or a disparity search — a nonlinear estimation, not a matrix inverse — even though the image formation that produced the measurements was perfectly linear. The linear-operator picture governs how light becomes pixels; it does not promise that the thing you actually care about is linearly encoded in them. This is a recurring note of Limitations of the medium: a photograph is a flat projection, and the quantities that projection discards — depth above all — must be inferred, not inverted.

Third, and most important, a linear forward model does not make the solution linear. Even when $\mathbf{y}=A\mathbf{x}+\mathbf{n}$ holds exactly, recovering $\mathbf{x}$ almost never reduces to multiplying by a matrix: $A$ is rarely cleanly invertible, so we lean on priors and inductive biases about what real images look like — and any such prior (a sparsity penalty, a clamp to valid pixel ranges, a learned denoiser, a whole neural network) turns the map from measurement to estimate into a thoroughly nonlinear function of the data. Linear physics, nonlinear inference. The forward direction is the tidy linear operator of this chapter; the backward direction — nonlinear almost everywhere it is interesting — is the subject of the next, Imaging as an inverse problem.

2.14.5 Where this is going: invertibility

Designing the operator is half the story; the other half is undoing it. Every chapter after this one is, in some sense, organized by a single question: how invertible is $A$? Given the measurement $\mathbf{y}=A\mathbf{x}+\mathbf{n}$, how well can we recover the thing we actually want from $\mathbf{x}$ — a sharp image, a depth map, a refocused photo, more? A pinhole's $A$ is trivially invertible but throws light away; a lens off its focal plane blurs in a way that is hard to undo; a coded aperture is designed to be invertible. Invertibility is the axis along which the whole book's systems line up.

There are two complementary ways to make $A$ carry more recoverable information, and they correspond to the book's two later parts on the subject:

The tool for reasoning about all of this is a change of basis that diagonalizes $A$ — and for the convolutional operators that imaging keeps producing (blur, defocus, motion), that basis is the Fourier basis: convolution becomes per-frequency multiplication, and the conditioning of the system becomes legible as which frequencies $A$ preserves and which it crushes toward zero. A blur that zeroes a frequency has destroyed it for good; a code that keeps every frequency above the noise can be inverted. This is exactly the 4-D-frequency analysis that Levin et al. apply to whole families of computational cameras Levin et al. 2009 (4D frequency / lattice-focal), and it is the machinery we develop next, in Linearity, Fourier, Aliasing and deblurring. We close this chapter where the next one opens: imaging is a linear operator, and the question for the rest of the book is how to design it and how to invert it.


Recap: big lessons of this chapter

(L2.50) — a camera is a giant linear operator $\mathbf{y}=A\mathbf{x}+\mathbf{n}$

Strip away the glass and an imaging system is one linear map: it takes the scene $\mathbf{x}$ — written either as a flat billboard at a fixed depth or, more generally, as ray space (the light field) — and returns the image $\mathbf{y}=A\mathbf{x}+\mathbf{n}$, a linear projection of the scene plus sensor noise. The matrix $A$ is the camera: pinhole, lens, stereo, coded aperture, the motion-invariant sweep — they differ only in their rows. And because $A$ is a design rather than a fact of nature, building an optical system is choosing $A$: the whole of computational optics is engineering the operator — in space, in time, in ray space — together with the reconstruction that inverts it, to pull better images and extra information out of the light. Everything after this chapter is organized by one question about that operator: how invertible is $A$?