Deconvolving a real photograph
Blur a real photograph with a 9×9 averaging kernel, add small noise, and recover it with Richardson-Lucy:
recovered = richardson_lucy(np.clip(noisy, 0, 1), psf, num_iter=50)
print(err(noisy), err(recovered)) # 0.1157 -> 0.0815
Deconvolution reduced the error by 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. 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. The naive FFT inverse reaches a relative error of ≈ 1.4 — far worse than the blurred image it started from.