Skip to content

Richardson-Lucy

Fact Value
Also called Lucy-Richardson deconvolution, Richardson-Lucy deconvolution, RL deconvolution
Status Implemented and tested
Family Restoration and reconstruction
Engine Browser
Type Nonlinear, iterative, multiplicative iterative deconvolution
Output Image
Operator shown as iterative (exact)
Support radius global
Code web/src/core/filters/restoration/iterative.ts, richardsonLucyFilter
Operator code web/src/core/filters/restoration/iterative.ts, iterate
Channels RGB, Brightness only

Overview

Richardson-Lucy deconvolution undoes a known blur step by step. It blurs the current estimate, compares it with the image as a ratio, and multiplies the estimate by the ratio spread back with the blur. Values stay positive and the total brightness is kept, which suits astronomy and microscopy images with photon noise.

Three panels: blurred disks with noise, the Richardson-Lucy result after 5 iterations, and after 50 iterations with sharper edges and some speckle. Three panels: blurred disks with noise, the Richardson-Lucy result after 5 iterations, and after 50 iterations with sharper edges and some speckle.
Richardson-Lucy on a Gaussian blur with sigma 2 and noise of sigma 2, after 5 and 50 iterations.

How it works

  1. Start with the blurred image as the estimate.
  2. Blur the estimate and divide the image by it.
  3. Blur the ratio with the PSF turned by a half turn, and multiply the estimate by it.
  4. Repeat for the chosen number of iterations.

Mathematical foundation

\[ f_{k+1} = f_k \cdot \left( h' \circledast \frac{g}{h \circledast f_k} \right),\quad k = 0, \ldots, K - 1,\ K = 20 \]

The formula shows the default parameter values.

where

  • \(g\): The blurred image extended with the border mode
  • \(f_k\): The estimate after k steps
  • \(K\): The number of steps
  • \(h, h'\): The PSF and the PSF turned by a half turn

Each step blurs the estimate f_k with the PSF h and compares it with the image g as a ratio. It blurs the ratio with h', the PSF turned by a half turn, and multiplies the estimate by the result. Richardson and Lucy derived the update from Bayes' rule. It is the maximum likelihood estimate for Poisson noise when it converges. Values stay positive, and with a normalized PSF the total brightness stays the same. Values of h * f_k below 1e-12 count as 1e-12, so the ratio stays finite. The first estimate is the image itself. The PSF is the kernel of the Gaussian filter cut at 4 sigma, of the motion blur filter, or of the disk averaging filter.

Richardson and Lucy derived the update from Bayes' rule. It is the expectation maximization algorithm for an image with Poisson noise, so its limit is the maximum likelihood estimate. Each factor is positive, so a positive start stays positive. With a PSF that adds up to 1 the total brightness is kept. Stopping after a few iterations keeps the noise down, since later iterations fit the noise too.

Kernel or operator

The Inspector shows the update rule and the number of iterations. The Iteration viewer in the Learn panel shows the estimate after a few iterations and the residual at every iteration.

Algorithm

  1. Extend the image with the border mode by half its size, at most 256 pixels, on each side.
  2. Start with the estimate f equal to the extended image g.
  3. Blur f with h through the FFT and divide g by the result.
  4. Blur the ratio with h' and multiply f by it.
  5. Repeat for the chosen number of iterations.
  6. Crop the last estimate to the image.

Parameters

Parameter Default Values Meaning
Blur psf Gaussian Gaussian, Motion, Defocus The point spread function, the picture a single bright point turns into.
Sigma sigma 2 0.3 to 10 px The standard deviation of the Gaussian blur. The PSF ends at 4 sigma.
Motion length length 9 1 to 51 px The length of the straight motion, for motion blur.
Motion angle angle 0 0 to 180 deg The direction of the motion, counterclockwise from the x axis, as for motion blur.
Defocus radius radius 3 0.5 to 15 px The radius of the defocus disk.
Iterations iterations 20 1 to 200 How many update steps to run.
Border mode border Reflect Reflect 101 (default), Reflect, Replicate, Constant (zero), Wrap How pixels outside the image are filled when the window reaches past the edge.
Channels channelScope RGB RGB, Brightness only Which part of the color image the filter changes.

Implementation

richardsonLucyFilter in web/src/core/filters/restoration/iterative.ts runs iterate. Values of the blurred estimate below 1e-12 count as 1e-12, so the ratio stays finite. The image is extended with the border mode by half its size, at most 256 pixels, on each side, and every convolution runs through the FFT of the extended grid. The filter needs the whole image, so it always runs on the whole image, and a selection is cut out of the result. It is slow, so its preview runs on request.

Worked example

Iterations 1 5 10 20 50 100
PSNR (dB) 26.13 27.13 27.57 27.94 28.36 28.46

The PSNR against the clean disks for the image of the figure, 25.27 dB before the filter. The value rises while the iterations restore detail. When it falls again, the iterations have started to raise the noise, so stopping early acts as regularization.

Complexity

  • Time: \(O(K N log N)\)
  • Memory: \(O(N)\)

N is the number of pixels of the extended image and K the number of iterations. Each iteration takes four FFTs.

Artifacts and limitations

Limitations

  • Slow, since it needs many iterations.
  • Too many iterations raise the noise. Stopping early acts as regularization.

Artifacts

  • Ringing near strong edges after many iterations.
  • Speckles in flat areas when the image is noisy.

Tests

The reference runs the same iteration with numpy.fft on the plane extended with numpy.pad. Before the cases are written, the script checks that 30 iterations bring a blurred plane closer to the original in the center of the image. Unit tests check that the result stays non-negative.

References

  • Richardson, W. H. Bayesian-based iterative method of image restoration. Journal of the Optical Society of America 62(1), 55 to 59, 1972. DOI 10.1364/JOSA.62.000055.
  • Lucy, L. B. An iterative technique for the rectification of observed distributions. The Astronomical Journal 79, 745, 1974. DOI 10.1086/111605.