Regularized Richardson-Lucy¶
| Fact | Value |
|---|---|
| Also called | Richardson-Lucy with total variation, RL-TV deconvolution |
| Status | Implemented and tested |
| Family | Restoration and reconstruction |
| Engine | Browser |
| Type | Nonlinear, iterative, regularized multiplicative iterative deconvolution |
| Output | Image |
| Operator shown as | iterative (exact) |
| Support radius | global |
| Code | web/src/core/filters/restoration/iterative.ts, regularizedRlFilter |
| Operator code | web/src/core/filters/restoration/iterative.ts, iterate |
| Channels | RGB, Brightness only |
Overview¶
Regularized Richardson-Lucy adds a total variation term to Richardson-Lucy deconvolution. Plain Richardson-Lucy raises noise into speckle after many iterations. The extra term lowers small bumps and fills small dips at each step, so flat areas stay flat while edges stay sharp.
How it works¶
- Start with the blurred image as the estimate.
- Take a Richardson-Lucy step.
- Divide it by 1 - lambda times the curvature of the estimate.
- Repeat for the chosen number of iterations.
Mathematical foundation¶
The formula shows the default parameter values.
where
- \(g\): The blurred image extended with the border mode
- \(f_k\): The estimate after k steps
- \(h, h'\): The PSF and the PSF turned by a half turn
- \(\lambda\): The weight of the total variation term
This is the update of Dey and colleagues. The Richardson-Lucy step is divided by 1 - lambda times the curvature div(grad f / |grad f|), which comes from a total variation penalty. Where the estimate has a bump, the curvature is negative and the bump is lowered. Flat areas and straight edges are left alone. The gradient uses forward differences and the divergence backward differences, with |grad f| computed as sqrt(f_x^2 + f_y^2 + 0.01^2), wrapping around the FFT grid. These discretization choices are this filter's own. The divergence of unit vectors lies between -4 and 4, so with lambda at most 0.1 the divisor stays above 0.6. The PSF is the kernel of the Gaussian filter cut at 4 sigma, of the motion blur filter, or of the disk averaging filter.
Total variation is the sum of |grad f| over the image. It is small for images made of flat areas with sharp edges, and large for noise. Dey and colleagues add it to the Poisson likelihood of Richardson-Lucy. Its gradient is minus the curvature div(grad f / |grad f|), and they put it in the divisor of the multiplicative update. This filter computes the curvature with forward and backward differences and sqrt(f_x^2 + f_y^2 + 0.01^2) for |grad f|, its own discretization.
Kernel or operator¶
The Inspector shows the update rule, lambda 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¶
- Extend the image with the border mode by half its size, at most 256 pixels, on each side.
- Start with the estimate f equal to the extended image g.
- Compute the curvature div(grad f / |grad f|) of the estimate.
- Take the Richardson-Lucy step and divide it by 1 - lambda times the curvature.
- Repeat for the chosen number of iterations.
- 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. |
Lambda lambda |
0.002 | 0 to 0.1 | The weight lambda of the total variation term. 0 gives plain Richardson-Lucy. |
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¶
regularizedRlFilter in web/src/core/filters/restoration/iterative.ts runs iterate with the curvature from tvCurvature. 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.14 | 27.22 | 27.79 | 28.42 | 29.53 | 30.74 |
The PSNR against the clean disks for the image of the figure, 25.27 dB before the filter, with lambda 0.002. 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.
Artifacts and limitations¶
Limitations
- Flattens fine texture into patches when lambda is high.
- As slow as Richardson-Lucy, plus the curvature at each step.
Artifacts
- Flat patches, a staircase look, in smooth gradients at high lambda.
Tests¶
The reference runs the same iteration and the same curvature, built with numpy.roll, on the plane extended with numpy.pad. The cases cover two PSFs and two values of lambda.
web/src/core/filters/filters.test.tsweb/src/core/filters/run.test.tsweb/src/core/filters/restoration/restoration.test.ts
References¶
- Dey, N., Blanc-Feraud, L., Zimmer, C., Roux, P., Kam, Z., Olivo-Marin, J.-C. and Zerubia, J. Richardson-Lucy algorithm with total variation regularization for 3D confocal microscope deconvolution. Microscopy Research and Technique 69(4), 260 to 266, 2006. DOI 10.1002/jemt.20294.