8.8 Sharpening⧉
PS2 implements box/Gaussian blur, gradients, sharpening, and the bilateral filter. → Chapter 1.5, Problem sets (appendix).
Sharpening increases contrast around edges and texture. The common unsharp mask extracts a blur residual and adds some of it to the image. It enhances detail that survived capture; it does not invert the imaging process. Chapter 16.2, Non-blind deconvolution treats reconstruction from a blur model.
8.8.1 Linear sharpening⧉
The linear core of sharpening was built in Chapter 6.2, Convolution: blur the image to get its slow, smooth part, subtract that to isolate the fine detail the blur threw away, then add the detail back amplified. That is the unsharp mask,
with $k$ setting the strength: flat regions have near-zero detail and are left alone, while edges and texture gain contrast. Push $k$ too high and it over-sharpens.
Because each step is linear, the whole operation collapses to a single convolution, $I_\text{out} = I * \big(\delta + k(\delta - g)\big)$: a positive spike at the center ringed by a negative surround. Chapter 6.2, Convolution traces that center-positive, surround-negative signature across the unsharp mask, the Laplacian, and the difference of Gaussians, and shows why they are one family.
The blur radius selects the scale of detail being enhanced, while $k$ selects its strength. A larger radius makes wider halos. Judge sharpening after resizing for the intended output, since changing image size changes the meaning of a radius in pixels.
8.8.2 Why it's called "unsharp mask"⧉
The name is a darkroom relic; it explains the otherwise puzzling word unsharp in a sharpening tool. Before digital, photographers sharpened a negative by sandwiching it with a slightly blurred, low-contrast positive copy (an "unsharp mask") held a hair out of focus against the original. The positive mask opposes the negative’s broad density variations while leaving the finer transitions relatively stronger. Optical densities add in the sandwich, so this is an analogy to residual enhancement in a density-like domain, rather than literal subtraction of linear pixel values. The blurred copy is the “unsharp” mask, and its name survived the move to digital processing. The effect can be simulated in density (Figure 8.8.3).

8.8.3 Sharpen in gamma, linear, or log?⧉
There is another choice in that formula that most people never make consciously: in what space do you compute the subtraction? The unsharp mask is a weighted difference (original minus a blur) and a blur is an average. We already know from tone mapping and from color that an average depends on the space you take it in: the mean of two pixels is not the same number in gamma-encoded values, in linear scene radiance, and in log. So the same unsharp mask, with the same radius and strength, gives three different results depending on whether you apply it to the encoded values in a rendered file, to the linear light those values decode to, or to the log of that light.
The encoding changes both the blur and the residual. A linear unsharp mask gives equal and opposite numerical overshoots around an ideal step before clipping; they need not look equally strong after display encoding. In log luminance the changes are multiplicative after exponentiation. No domain makes sharpening an exact physical reconstruction. State the encoding, keep intermediate headroom, and inspect both sides of strong edges.

8.8.4 Non-linear sharpening⧉
Linear unsharp masking is the standard sharpen, and it has two failure modes that motivate everything left in this chapter.
First, it amplifies noise. In a flat region (a clear sky, a smooth wall) there is no real detail, so $\text{in} - \text{blur}$ is mostly noise. Boost it and you boost the noise, turning a clean sky grainy. Second, it haloes at strong edges. Near a high-contrast boundary the detail image swings strongly positive on the bright side and negative on the dark side; amplify that and you get a bright fringe along one side of the edge and a dark fringe along the other, the tell-tale "halo" of an over-sharpened photo. Both failures appear on a real photo as the gain $k$ is pushed up (Figure 8.8.5): a scanline across a strong edge shows the boosted detail overshooting into a bright/dark ring, while the smooth background turns gritty.
Linear sharpening uses the same gain on noise, texture, and strong boundaries. Adaptive variants reduce the gain where the residual is small or where an edge would overshoot [@ramponi-1998; @polesel-etal-2000]. A threshold is only a heuristic: faint texture can fall below it, and large noise can exceed it. Luminance-oriented sharpening limits color fringes, while a local output bound can limit overshoot.
A simple residual gate can be written as pseudocode:
b = blur(I, radius) d = I - b detail = sign(d) * max(abs(d) - threshold, 0) out = I + amount * detail # Optional: bound out by local input extrema to limit overshoot.
This soft threshold avoids a jump at the threshold, but removes some weak detail along with noise. A local bound is another nonlinear choice and can flatten peaks.
The fastest way to feel both the linear failure and its non-linear fixes is to drive them, watching a scanline through the image (Figure 8.8.6).

Content-dependent weights make a filter nonlinear. This differs from a fixed convolution, but does not necessarily break translation equivariance: translating the input can still translate the output. Chapter 10.1, Bilateral filtering develops one such neighborhood rule.
Learned enhancement can also synthesize plausible texture where the measurements are ambiguous. A sharper-looking result does not establish that the detail was recorded; see Chapter 14.1, What can super-resolution actually do?.
The Detail panel of Chapter 8.13, A raw developer in the browser is this chapter's shrink-then-sharpen in a single pass, with the luminance/chroma split and the edge mask as written here.
An unsharp mask amplifies whatever high-frequency residual it receives. That residual can be a real texture, sensor noise, ringing from compression, or a demosaicking artifact. A threshold can suppress small residuals, but a faint real texture may be small too. A local strength map can reduce the boost in smooth regions and preserve stronger detail elsewhere. Inspect both a smooth patch and an edge when tuning it: an image can look crisper overall while acquiring conspicuous noise or halos in particular regions.