# deconvreg

Deblur image using regularized filter

## Syntax

```J = deconvreg(I, PSF)J = deconvreg(I, PSF, NOISEPOWER)J = deconvreg(I, PSF, NOISEPOWER, LRANGE)J = deconvreg(I, PSF, NOISEPOWER, LRANGE, REGOP) [J, LAGRA] = deconvreg(I, PSF,...)```

## Description

`J = deconvreg(I, PSF)` deconvolves image `I` using the regularized filter algorithm, returning deblurred image J. The assumption is that the image `I` was created by convolving a true image with a point-spread function PSF and possibly by adding noise. The algorithm is a constrained optimum in the sense of least square error between the estimated and the true images under requirement of preserving image smoothness.

`I` can be a N-dimensional array.

`J = deconvreg(I, PSF, NOISEPOWER)` where `NOISEPOWER` is the additive noise power. The default value is 0.

`J = deconvreg(I, PSF, NOISEPOWER, LRANGE)` where `LRANGE` is a vector specifying range where the search for the optimal solution is performed. The algorithm finds an optimal Lagrange multiplier `LAGRA` within the `LRANGE` range. If `LRANGE` is a scalar, the algorithm assumes that `LAGRA` is given and equal to `LRANGE`; the `NP` value is then ignored. The default range is between [1e-9 and 1e9].

```J = deconvreg(I, PSF, NOISEPOWER, LRANGE, REGOP) ``` where `REGOP` is the regularization operator to constrain the deconvolution. The default regularization operator is the Laplacian operator, to retain the image smoothness. The `REGOP` array dimensions must not exceed the image dimensions; any nonsingleton dimensions must correspond to the nonsingleton dimensions of `PSF`.

`[J, LAGRA] = deconvreg(I, PSF,...)` outputs the value of the Lagrange multiplier `LAGRA` in addition to the restored image `J`.

 Note   The output image `J` could exhibit ringing introduced by the discrete Fourier transform used in the algorithm. To reduce the ringing, process the image with the `edgetaper` function prior to calling the `deconvreg` function. For example, ```I = edgetaper(I,PSF)```.

## Class Support

`I` can be of class `uint8`, `uint16`, `int16`, `single`, or `double`. Other inputs have to be of class `double`. `J` has the same class as `I`.

## Examples

```I = checkerboard(8); PSF = fspecial('gaussian',7,10); V = .01; BlurredNoisy = imnoise(imfilter(I,PSF),'gaussian',0,V); NOISEPOWER = V*prod(size(I)); [J LAGRA] = deconvreg(BlurredNoisy,PSF,NOISEPOWER); subplot(221); imshow(BlurredNoisy); title('A = Blurred and Noisy'); subplot(222); imshow(J); title('[J LAGRA] = deconvreg(A,PSF,NP)'); subplot(223); imshow(deconvreg(BlurredNoisy,PSF,[],LAGRA/10)); title('deconvreg(A,PSF,[],0.1*LAGRA)'); subplot(224); imshow(deconvreg(BlurredNoisy,PSF,[],LAGRA*10)); title('deconvreg(A,PSF,[],10*LAGRA)');```