Image Deblurring
Image deblurring reverses camera shake and defocus by estimating the blur kernel, then deconvolving it to restore edges the shake smeared away.
Why Does This Exist?
Hands shake and lenses miss focus. The resulting blur is not missing information but mixed information: each pixel holds a weighted blend of its neighbourhood along the shake path. Naive sharpening amplifies the mix into halos and ringing without unmixing anything.
Deblurring estimates the mixing kernel, then inverts the blend. Classical Wiener deconvolution does this analytically given the kernel; blind methods estimate kernel and image together; modern networks learn the inversion directly from shaken-sharp pairs. The task map is image-to-image tasks, and the noise-side sibling is image denoising.
Think of It Like This
Unmixing paint streaks by retracing the brush
A wet painting gets dragged sideways, streaking every colour into its neighbour. An observer who measures the drag direction and length can push each streak back along its path, roughly restoring the original dabs. Without the drag measurement, pushing blindly smears further.
The kernel is the drag measurement. Blind deblurring is guessing the drag from the streaks themselves, possible because sharp edges leave recognisable signatures under smearing. It fails when the drag varied across the canvas, spatially varying shake no single kernel describes.
How It Actually Works
Model blur as convolution with kernel plus noise: . A uniform shake kernel spreads each pixel evenly, entries summing to . Non-blind deconvolution inverts a known with regularisation against noise blowup; blind methods alternate between estimating from strong edges and given ; end-to-end networks regress sharp images directly, often multi-scale, coarse-to-fine:
Kernel normalisation matters: entries must sum to one so brightness is preserved through the blur model. Multi-scale networks deblur thumbnails first where kernels look small, then refine upward.
Worked example
Uniform kernel: entries of sum to , preserving brightness exactly. A headlight pixel of value on black background spreads to pixels of each. Deblurring collects those contributions back: restored, minus noise the regulariser leaves behind. Misestimate the kernel size as and the inversion rings, collecting neighbours that belong to other sources.
Code
Uniform kernel check plus the unmixing sum, the two invariants of blur modelling.
import numpy as np
def uniform_kernel(size: int = 5) -> np.ndarray: """Normalized box blur kernel preserving brightness.""" return np.full((size, size), 1.0 / (size * size))
k = uniform_kernel(5)print(round(float(k.sum()), 2)) # -> 1.0 brightness preservedprint(round(float(25 * 0.036), 2)) # -> 0.9 headlight gathered backWatch Out For
Ringing from kernel size errors
Wrong kernel size turns every edge into ripples: energy collected from too wide an area oscillates around high-contrast boundaries. Ringing is the visual signature of kernel mismatch, not of weak networks.
Estimate size from calibration or edge profiles before deconvolving. When unsure, multi-scale blind methods degrade more gracefully than fixed-kernel inverses.
Spatially varying shake under one global kernel
Real handshake rotates, varying blur across the frame. A single kernel fits the centre and smears the corners, or vice versa, and no global setting fixes both.
Use patch-wise or dense kernel fields for real shake. Global kernels suit defocus and uniform motion only.
The Quick Version
- Blur mixes neighbourhoods through a kernel; deblurring estimates and inverts the mix.
- A uniform kernel holds per entry, summing to .
- Our headlight spreads to pixels of and gathers back to .
- Blind methods alternate kernel and image estimates; networks learn the inversion directly.
- Kernel size errors ring, and rotating shake needs spatially varying kernels.