Deconvolving a real photograph
Notebook 13 takes a real 256×256 crop of the photograph, blurs it with a known 9×9 averaging kernel, adds small reproducible noise, and recovers it with Richardson–Lucy:
recovered_20 = richardson_lucy(noisy, psf, num_iter=20, clip=False)
# interior relative error: 18.9% -> 13.1%
Twenty iterations cut the interior error from 18.9% to 13.1%, about 30%. Two lessons:
First, you must ignore the border. Deconvolution creates strong artifacts at the edges, where the algorithm has no information about what lies outside the image. The notebook leaves out a 20-pixel border before measuring. Measure over the full image and border artifacts dominate — it looks like the method failed. It did not.
Second, why not just invert the blur directly? Because blurring destroys high-frequency detail, so inverting it divides by numbers very close to zero and amplifies noise enormously. In the handbook’s version of this exercise the naive FFT inverse reaches a relative error of ≈ 1.4 — far worse than the blurred image it started from.