Blur as a multiplication
A blurred image is the sharp image convolved with a kernel , the point spread function, plus some noise . By the convolution theorem, the Fourier transform turns the convolution into a product of spectra:
A Gaussian blur with pixels has the transfer function : it keeps the low frequencies and damps the high ones. Horizontal motion blur, a box of pixels along , has a transfer function with ripples that pass close to zero near . Here the kernel is known; estimating it from the blurred image as well is called blind deconvolution.
The inverse filter
If the blur is a multiplication, dividing by undoes it:
Without noise this is exact. With noise, the second term is the problem. Noise such as sensor noise or rounding is spread evenly over all frequencies, while becomes tiny at high frequencies: at the Nyquist frequency for . Dividing multiplies the noise there by a billion. Where is smaller than , the recorded coefficient is mostly noise; the information about at that frequency is lost and no filter can bring it back. Even rounding the blurred image to 8 bits is enough to destroy the result.
Taming the noise
The truncated inverse (pseudo-inverse) only divides where and sets all other frequencies to zero. It gives up on frequencies that are too weak to recover, so the result stays somewhat blurred, and the abrupt cut-off causes ringing next to edges, like an ideal low-pass filter.
Regularization trades fidelity to the data against the size of the result. Minimizing gives, frequency by frequency,
Where , as before; where , goes smoothly to zero instead of exploding. The largest gain is . This is the Wiener filter for a constant noise-to-signal ratio ; the full Wiener filter uses the ratio of the noise power to the signal power at each frequency, which is optimal in the mean-squared-error sense. More noise calls for a larger .
The blur in this demo wraps around the image borders, so that the model holds exactly. In real photos, the content beyond the border is unknown; this mismatch causes ringing at the borders unless the image is padded or its borders are tapered first.
Try this
- Start with the inverse filter and no noise: the restoration is perfect, even though in the plot climbs to .
- Set : the degraded image looks exactly the same, but the restoration is destroyed.
- Turn the noise off again and round to 8 bits instead: rounding alone is enough noise.
- Switch to the truncated inverse and try : stable, but look for ringing in the error image.
- Choose the Wiener filter and find the with the best PSNR. Increase the noise and find it again: it moves up.
- Try horizontal motion blur with and the Wiener filter: the dashed curve dips where passes close to zero, and those frequencies stay missing as vertical stripes in the error image.
- Raise to 4: at the Nyquist frequency is now about , and far more of the spectrum is out of reach.