BookNotesSlidesP-sets Syllabusdraft · v0.2.49.1
◀▲⌂▶
💬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 3 big lessons ↓

6.1 Introduction to forward and inverse linear methods⧉

A blurred edge spreads a sharp transition across several pixels. If we know how that spreading happened, can we recover the edge? A short row of samples is enough to show both the calculation and its limits.

The forward problem predicts a measurement from a scene and a camera model. The inverse problem estimates the scene from the measurement. We will use a known linear model; learning an unknown blur or geometry is an additional estimation problem. Deblurring, denoising, demosaicking, and super-resolution differ in what was measured and what assumptions recovery needs.

We compare a blur, an idealized corner camera, and a sampling grid. A blur attenuates detail and may erase some patterns entirely. A corner camera records a weak indirect signal. A coarse sampling grid cannot distinguish arbitrary fine patterns. These examples separate noise sensitivity from non-uniqueness.

fig-recovery-degradations
Figure 6.1.1. The same scene, reaching us imperfect in three different ways. From one photograph: blurred (the information scrambled, since a blur averages neighboring pixels together), blurred with a little sensor noise on top (the deblurring case of the sections that follow), and sampled on a coarse grid (incomplete: only the center pixel of each 3×3 block survives, the rest dropped). Each is a different way the forward map discards or corrupts information, and each needs a different inverse to undo it.
💡 Big lesson (L6.1) — a linear operator is a weighted sum, so it is a matrix

An operation $F$ is linear when $F(a x+b x')=aF(x)+bF(x')$. For finite sampled signals, each output is a weighted sum of inputs with weights independent of the data. Stacking those weights into rows gives $y=Ax$. The matrix describes the operation; code can apply its weights without allocating the matrix.

6.1.1 A one-dimensional blur, forward⧉

Strip the image down to a single row of pixels, a one-dimensional signal $x = (x_1, x_2, \dots, x_n)$. Think of it as one scanline of a photo, or a flat 1-D world. Now blur it in the gentlest possible way: replace every sample by the average of itself and its two immediate neighbors. This is the box blur of radius one,

$$ y_i = \tfrac{1}{3}\,(x_{i-1} + x_i + x_{i+1}). $$

Each output sample is a little local average, so sharp features soften and fine wiggles wash out, which is exactly what optical blur does to a real photo (the full two-dimensional story is Chapter 6.2, Convolution).

Now write the same operation as a single matrix multiply. Stack the outputs into a vector $y$, collect the averaging weights into a matrix $A$ with one row per output sample, and the blur becomes

$$ y = A\,x. $$

For a five-sample signal, with the edges handled by repeating the end pixel, the matrix is small enough to print in full:

$$ \begin{pmatrix} y_1\\ y_2\\ y_3\\ y_4\\ y_5 \end{pmatrix} = \frac{1}{3}\begin{pmatrix} 2 & 1 & 0 & 0 & 0\\ 1 & 1 & 1 & 0 & 0\\ 0 & 1 & 1 & 1 & 0\\ 0 & 0 & 1 & 1 & 1\\ 0 & 0 & 0 & 1 & 2 \end{pmatrix}\begin{pmatrix} x_1\\ x_2\\ x_3\\ x_4\\ x_5 \end{pmatrix}. $$

Row three gives $y_3=(x_2+x_3+x_4)/3$. The repeated interior weights make a narrow band, while the first and last rows encode the chosen boundary rule. Other cameras need not have this banded structure.

This is the forward model: hand it a scene $x$, and it returns the measurement $y$. Computing it is trivial, a few multiplies and adds per sample, or in code a single loop:

Algorithm 6.1.1
# forward: 1-D box blur of radius 1, edges replicate
for i in range(n):
    y[i] = (x[clamp(i-1, 0, n-1)] + x[i] + x[clamp(i+1, 0, n-1)]) / 3
fig-forward-blur-1d
Figure 6.1.2. A box blur, forward, in one and two dimensions. On the left is the input, as a one-dimensional signal (top) and its two-dimensional twin (below); in the middle the banded operator $A$; on the right the blurred outputs. The 1-D and 2-D always match: pick a synthetic pattern (edge, impulse, ramp, bars) and every column of the image is that same signal, or pick a landscape photo and the 1-D signal is a scanline row you drag on the image. The same radius $r$ blurs both. Hover an output sample to light up its row of $A$ and the taps it averages; click an input sample to light up its column, the set of outputs it feeds; click a 2-D output pixel to see the $(2r+1)^2$ window it averages. Widening $r$ thickens the band and smooths the result further. The point of the figure is that a blur simply is this banded matrix, in 1-D and in 2-D alike.

6.1.2 Running the blur backward: the idealized case⧉

Now the interesting direction. Suppose someone hands you only the blurred signal $y$ and tells you it came from a box blur. Can you recover the sharp original $x$? This is deblurring, and the answer is that it is nothing but linear algebra. You have a linear system, $y = A x$, in which $A$ and $y$ are known and $x$ is the unknown, and solving a linear system is exactly what linear algebra is for. When $A$ is invertible you simply write

$$ x = A^{-1} y, $$

which in code is one call to a linear-system solver:

Algorithm 6.1.2
# inverse: recover the sharp signal by solving the linear system y = A x
x_hat = solve(A, y)     # solve the system without explicitly forming the inverse

This five-sample matrix is invertible. With exact measurements and arithmetic, solving recovers the original. That is a property of this matrix, including its size and boundary rule; a different box-blur matrix can be singular.

Write the two matrices side by side and they look nothing alike. The forward blur $A$ is the banded local average from before; its inverse is a full matrix, in which every recovered sample draws on all five measurements:

$$ A = \frac{1}{3}\begin{pmatrix} 2 & 1 & 0 & 0 & 0\\ 1 & 1 & 1 & 0 & 0\\ 0 & 1 & 1 & 1 & 0\\ 0 & 0 & 1 & 1 & 1\\ 0 & 0 & 0 & 1 & 2 \end{pmatrix}, \qquad A^{-1} = \begin{pmatrix} 2 & -1 & -1 & 2 & -1\\ -1 & 2 & 2 & -4 & 2\\ -1 & 2 & -1 & 2 & -1\\ 2 & -4 & 2 & 2 & -1\\ -1 & 2 & -1 & -1 & 2 \end{pmatrix}. $$

Undoing a local average is inherently non-local: $A^{-1}$ reaches across the whole signal, with alternating signs and larger weights. That growth is the first hint of the trouble the next section runs into, where those larger weights multiply not only the signal but any noise riding on it.

💡 Big lesson (L6.2) — undoing a local operation is not itself local

The forward blur reads three neighboring samples, but its inverse uses measurements across the signal. Local operators can have nonlocal inverses, as deblurring and gradient integration illustrate. Special operators, such as pointwise scaling and shifts, are exceptions. Chapter 6.9, Efficient linear solvers describes how to solve large systems without storing their inverses.

fig-deblur-1d-clean
Figure 6.1.3. Deblurring in one dimension, the idealized noise-free case, laid out as the mirror of the forward figure. The blurred measurement $y=Ax$ is the input on the left; the dense inverse operator $A^{-1}$ sits in the middle; the recovered $\hat x = A^{-1}y$ on the right, genuinely solved from the measurement, lands exactly on the original $x$ because there is no noise. Where the forward operator $A$ was a local band, its inverse is dense and oscillating: every recovered sample pulls on all the measurements. Selection and scanline are shared with the forward figure. The clean case works; the next figure adds noise and breaks it.

6.1.3 The catch: noise and ill-conditioning⧉

If it were always this easy the rest of the part would be short. Unfortunately, a real measurement is never exactly $Ax$; the sensor adds a little random noise (see Chapter 2.8, Noise, signal-to-noise ratio and dynamic range), so what you actually hold is

$$ y = A x + n. $$

Invert that and you get

$$ \hat x = A^{-1} y = x + A^{-1} n, $$

The error is the measurement noise transformed by the inverse. A pattern strongly attenuated by the forward operator needs a large inverse gain, which also amplifies noise in that direction. A pattern mapped exactly to zero cannot be recovered uniquely. Blur width alone does not determine the difficulty: the kernel, sampling, and boundary rule all matter.

fig-deblur-1d-noise
Figure 6.1.4. Deblurring in one dimension, and why it is fragile. The same layout as the previous figure, but the measurement now carries a little noise, $y = Ax + n$. The naive recovery $\hat x = A^{-1}y$ on the right erupts into large oscillations that swamp the signal, and the recovered image dissolves into checkerboard noise (watch the PSNR fall): the dense inverse multiplies the noise sitting in $y$ by huge factors. Raise the noise or widen the blur to make it worse; the regularized-inverse toggle trades a little bias for a stable answer, the subject of later chapters. Selection and scanline are shared with the two figures above.

A practical reconstruction balances agreement with the measurement against assumptions about the scene. Regularization suppresses unstable components at the cost of bias. Chapter 6.7, Image formation as a linear system develops that tradeoff; Chapter 6.9, Efficient linear solvers addresses the computation. An accurate solver cannot repair an incorrect forward model.

6.1.4 A corner camera: reading the edge of a shadow⧉

Let's look at a more surprising inverse imaging system. Consider standing in a room near the corner of a wall, where part of the scene is hidden from you around the edge (Figure 6.1.5). You cannot see the hidden region directly. But light from it spills onto the floor near the corner, and the wall's edge lays a soft penumbra there, a gradual band from shadow to light rather than a crisp line. That penumbra, almost too faint to notice, is a photograph of the hidden region in disguise, and it can be read out (Bouman et al., Turning Corners into Cameras, 2017).

fig-corner-cameras-teaser
Figure 6.1.5. The corner camera in action. (a) A camera watches the floor beside a wall's vertical edge; hidden objects A and B are invisible directly, but the edge lays a penumbra on the floor whose angular bands read A, then A+B, a cumulative sum of the hidden scene. (b) The hidden scene as the observer sweeps in a circle around the edge. (c) A single, almost featureless floor frame; (d) the same frame with its colors magnified, revealing the faint penumbra; (e) the reconstructed one-dimensional space-time video of the hidden region (angular position against time), where two people moving around the corner trace out colored diagonal streaks. Reproduced from Bouman et al., "Turning Corners into Cameras," ICCV 2017, with the authors' permission.
Video 6.1.1. Video: Turning Corners into Cameras, by Bouman, Ye, Yedidia, Durand, Wornell, Torralba & Freeman, ICCV 2017 (YouTube).

For a simple discrete model, suppose successive floor samples reveal one more angular bin of the hidden scene, with equal known weights and no background. Each measurement is then a cumulative sum. Its matrix $A$ is lower triangular, and $y=Ax$. This model illustrates the role of the occluding edge; the real measurement also depends on light transport, floor reflectance, background illumination, and noise.

Both matrices are as simple as the story. Written out for a five-angle scene, the forward operator (the cumulative sum) is a lower-triangular block of ones, and its inverse is the differencing matrix, with $1$ on the diagonal and $-1$ just below it:

$$ A = \begin{pmatrix} 1 & & & & \\ 1 & 1 & & & \\ 1 & 1 & 1 & & \\ 1 & 1 & 1 & 1 & \\ 1 & 1 & 1 & 1 & 1 \end{pmatrix}, \qquad A^{-1} = \begin{pmatrix} 1 & & & & \\ -1 & 1 & & & \\ & -1 & 1 & & \\ & & -1 & 1 & \\ & & & -1 & 1 \end{pmatrix}. $$

Each row of $A$ sums the hidden scene up to its angle; each row of $A^{-1}$ takes a single difference.

With a known zero baseline $y_0=0$, neighboring differences recover the angular-bin contributions in this ideal model:

$$ x_i = y_i - y_{i-1}. $$
Algorithm 6.1.3
# corner camera: the penumbra p is a cumulative sum of the hidden scene by angle;
# difference it to recover the scene
scene[0] = p[0]         # known zero baseline before the first bin
for i in range(1, n):
    scene[i] = p[i] - p[i-1]

The difference extracts what the next floor measurement adds. Bouman et al. use video variations in the penumbra to reconstruct one-dimensional angular information about moving hidden objects Bouman et al. 2017 (corner camera). The cumulative-sum example does not recover a complete hidden photograph from an arbitrary floor image. See Chapter 38.1, Accidental cameras for related occluder-based systems.

Differencing is simple to compute, but it does not remove noise. For independent measurement errors of variance $\sigma^2$, an interior difference has variance $2\sigma^2$. A faint change can remain difficult to detect against a bright background. Fine angular sampling also changes the integration weights; restoring radiance per unit angle requires accounting for those bin widths.

Imagine ordering the hidden scene into angular slivers behind the corner. As the observation point moves along the visible floor, the wall edge reveals another sliver. In the simplified model, one floor sample therefore contains the contributions already visible to the preceding sample plus one new contribution. Subtracting the neighboring measurements cancels the shared contributions and isolates the newly revealed sliver. This is why a cumulative-sum matrix and a difference operator appear in the model. Unequal transport weights, varying floor reflectance, background light, and noise make the real subtraction less clean, but the edge is doing useful optical coding before any computation begins.

6.1.5 A different challenge: sampling and aliasing⧉

So far the scene has arrived already discretized, a row of samples we could stack into a vector. But turning a continuous world into that row of numbers is a challenging step because it loses information. Reading a continuous signal at evenly spaced points is called sampling. Creating a thumbnail also involves sampling, now of a reconstructed discrete image. For fixed weights it is linear. Reducing the number of samples gives a matrix with fewer rows than columns, so arbitrary input values cannot be recovered uniquely.

Undersampling does something worse than lose information: it disguises it. A pattern that varies faster than the samples can follow does not simply vanish; it comes back as a slower pattern that was never in the scene. The moiré shimmer on a striped shirt on video, the picket fence that strobes past a train window, the wagon wheel that spins backward in an old film: all the same effect, called aliasing. In one dimension it is stark. Sample a fast sinusoid at too few points and the samples land exactly where a much slower sinusoid would put them, and nothing in the measurement tells the two apart (Figure 6.4.1). The fast signal has taken on the alias of a slow one. The same masquerade plays out in two dimensions on a real photograph, where a fine, regular texture folds into bold moiré bands (Figure 6.4.2).

An undersampled sinusoid and its alias produce identical samples. The measurement alone cannot tell them apart. A prior may favor one explanation, and additional shifted frames may distinguish them; neither changes the non-uniqueness of the single unconstrained measurement. The same distinction applies to any null space, including one created by blur.

Low-pass filtering before sampling suppresses frequencies the output grid cannot represent. It trades fine detail for fewer false patterns. Practical filters leave some residual aliasing, whereas the sampling theorem assumes an exactly band-limited signal. Chapter 6.4, Sampling, downsampling, and aliasing and Chapter 6.5, Resampling and upsampling develop the model and its implementation.

fig-aliasing
Figure 6.4.1 (reproduced). Aliasing in one dimension. A continuous sinusoid, sampled on a fixed coarse grid: below Nyquist the samples trace it faithfully, but past half the sample rate the same samples fall exactly on a slower sinusoid, its alias, and no measurement can tell the two apart. This is the interactive demo of Chapter 6.4, Sampling, downsampling, and aliasing, previewed here.
fig-aliasing-photo
Figure 6.4.2 (reproduced). The same masquerade in two dimensions on a real photograph. A facade's regular window grid is a high spatial frequency; sampled too coarsely without a pre-blur, it folds into the bold, slow moiré bands seen here, which are nowhere in the actual building. Developed fully in Chapter 6.4, Sampling, downsampling, and aliasing.
fig-aliasing-prefilter
Figure 6.1.6. Pre-filtering is the cure: blur before you sample. A building facade (its regular window grid is a high spatial frequency) is downsampled on a coarse grid. Sampled directly (pre-filter off), that grid folds into bold moiré that is not on the building. Turn the pre-filter on and a plain Gaussian blur first erases the detail finer than the grid can carry, so the sampled image is genuinely smooth there instead of inventing structure. Pick another photo or a zone plate; the checkbox toggles the pre-filter and the slider sets how coarsely we sample.

6.1.6 What the measurement determines⧉

Before choosing a reconstruction method, specify the forward operator, its boundary rule, the noise model, and any additional measurements. Then ask whether different inputs can produce the same output and whether small measurement errors can produce large reconstruction errors.

Chapter 6.7, Image formation as a linear system develops these questions for general operators. Chapter 6.9, Efficient linear solvers separates the recovery objective from the numerical method used to solve it.

💡 Big lesson (L6.3) — the forward model is easy; the inverse is the hard part

For a known linear model, predicting the measurement is $y=Ax$. Recovering $x$ requires checking uniqueness, noise sensitivity, and the model assumptions. If the measurement loses information, a solver alone cannot restore it; recovery needs additional data or assumptions about the scene.


Recap: big lessons of this chapter

💡 Big lesson (L6.1) — a linear operator is a weighted sum, so it is a matrix

An operation $F$ is linear when $F(a x+b x')=aF(x)+bF(x')$. For finite sampled signals, each output is a weighted sum of inputs with weights independent of the data. Stacking those weights into rows gives $y=Ax$. The matrix describes the operation; code can apply its weights without allocating the matrix.

💡 Big lesson (L6.2) — undoing a local operation is not itself local

The forward blur reads three neighboring samples, but its inverse uses measurements across the signal. Local operators can have nonlocal inverses, as deblurring and gradient integration illustrate. Special operators, such as pointwise scaling and shifts, are exceptions. Chapter 6.9, Efficient linear solvers describes how to solve large systems without storing their inverses.

💡 Big lesson (L6.3) — the forward model is easy; the inverse is the hard part

For a known linear model, predicting the measurement is $y=Ax$. Recovering $x$ requires checking uniqueness, noise sensitivity, and the model assumptions. If the measurement loses information, a solver alone cannot restore it; recovery needs additional data or assumptions about the scene.