# Documentation

### This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English version of the page.

To view all translated materials including this page, select Japan from the country navigator on the bottom of this page.

# deconvlucy

Deblur image using Lucy-Richardson method

## Syntax

```J = deconvlucy(I, PSF) J = deconvlucy(I, PSF, NUMIT) J = deconvlucy(I, PSF, NUMIT, DAMPAR) J = deconvlucy(I, PSF, NUMIT, DAMPAR, WEIGHT) J = deconvlucy(I, PSF, NUMIT, DAMPAR, WEIGHT, READOUT) J = deconvlucy(I, PSF, NUMIT, DAMPAR, WEIGHT, READOUT, SUBSMPL) ```

## Description

`J = deconvlucy(I, PSF)` restores image `I` that was degraded by convolution with a point-spread function `PSF` and possibly by additive noise. The algorithm is based on maximizing the likelihood of the resulting image `J`'`s` being an instance of the original image `I` under Poisson statistics.

`I` can be a N-dimensional array.

To improve the restoration, `deconvlucy` supports several optional parameters. Use `[]` as a placeholder if you do not specify an intermediate parameter.

`J = deconvlucy(I, PSF, NUMIT)` specifies the number of iterations the `deconvlucy` function performs. If this value is not specified, the default is 10.

`J = deconvlucy(I, PSF, NUMIT, DAMPAR)` specifies the threshold deviation of the resulting image from the image `I` (in terms of the standard deviation of Poisson noise) below which damping occurs. Iterations are suppressed for pixels that deviate beyond the `DAMPAR` value from their original value. This suppresses the noise generation in such pixels, preserving necessary image details elsewhere. The default value is 0 (no damping).

```J = deconvlucy(I, PSF, NUMIT, DAMPAR, WEIGHT)``` specifies the weight to be assigned to each pixel to reflect its recording quality in the camera. A bad pixel is excluded from the solution by assigning it zero weight value. Instead of giving a weight of unity for good pixels, you can adjust their weight according to the amount of flat-field correction. The default is a unit array of the same size as input image `I`.

```J = deconvlucy(I, PSF, NUMIT, DAMPAR, WEIGHT, READOUT)``` specifies a value corresponding to the additive noise (e.g., background, foreground noise) and the variance of the readout camera noise. `READOUT` has to be in the units of the image. The default value is 0.

```J = deconvlucy(I, PSF, NUMIT, DAMPAR, WEIGHT, READOUT, SUBSMPL)```, where `SUBSMPL` denotes subsampling and is used when the `PSF` is given on a grid that is `SUBSMPL` times finer than the image. The default value is 1.

### Note

The output image `J` could exhibit ringing introduced by the discrete Fourier transform used in the algorithm. To reduce the ringing, use `I = edgetaper(I,PSF)` before calling `deconvlucy`.

## Resuming Deconvolution

If `I` is a cell array, it can contain a single numerical array (the blurred image) or it can be the output from a previous run of `deconvlucy`.

When you pass a cell array to `deconvlucy` as input, it returns a 1-by-4 cell array `J`, where

`J{1}` contains `I`, the original image.

`J{2}` contains the result of the last iteration.

`J{3}` contains the result of the next-to-last iteration.

`J{4}` is an array generated by the iterative algorithm.

## Class Support

`I` can be `uint8`, `uint16`, `int16`, `double`, or `single`. `PSF` can be `uint8`, `uint16`, `int16`, `double`, or `single`. Note, however, that `deconvlucy` converts the PSF to `double` without normalization. `DAMPAR` and `READOUT` must have the same class as the input image. Other inputs have to be `double`. The output image `J` (or the first array of the output cell) has the same class as the input image `I`.

## Examples

collapse all

Create a sample image and blur it.

```I = checkerboard(8); PSF = fspecial('gaussian',7,10); V = .0001; BlurredNoisy = imnoise(imfilter(I,PSF),'gaussian',0,V);```

Create a weight array and call deconvlucy using several optional parameters.

```WT = zeros(size(I)); WT(5:end-4,5:end-4) = 1; J1 = deconvlucy(BlurredNoisy,PSF); J2 = deconvlucy(BlurredNoisy,PSF,20,sqrt(V)); J3 = deconvlucy(BlurredNoisy,PSF,20,sqrt(V),WT);```

Display the results.

```subplot(221);imshow(BlurredNoisy); title('A = Blurred and Noisy'); subplot(222);imshow(J1); title('deconvlucy(A,PSF)'); subplot(223);imshow(J2); title('deconvlucy(A,PSF,NI,DP)'); subplot(224);imshow(J3); title('deconvlucy(A,PSF,NI,DP,WT)');```

## References

[1] Biggs, D.S.C. “Acceleration of Iterative Image Restoration Algorithms.” Applied Optics. Vol. 36. Number 8, 1997, pp. 1766–1775.

[2] Hanisch, R.J., R.L. White, and R.L. Gilliland. “Deconvolution of Hubble Space Telescope Images and Spectra.” Deconvolution of Images and Spectra (P.A. Jansson, ed.). Boston, MA: Academic Press, 1997, pp. 310–356.