Main Content

deconvlucy

Deblur image using Lucy-Richardson method

Description

example

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

To improve the restoration,deconvlucysupports several optional parameters, described below. Use[]as a placeholder if you do not specify an intermediate parameter.

example

J= deconvlucy(I,psf,iter)specifies the number of iterations,iter.

J= deconvlucy(I,psf,iter,dampar)controls noise amplification by suppressing iterations for pixels that deviate a small amount compared to the noise, specified by the damping thresholddampar. By default, no damping occurs.

J= deconvlucy(I,psf,iter,dampar,weight)specifies which pixels in the input imageIare considered in the restoration. The value of an element in theweight数组决定多少pixel at the corresponding position in the input image is considered. For example, to exclude a pixel from consideration, assign it a value of0in theweightarray. You can adjust the weight value assigned to each pixel according to the amount of flat-field correction.

J= deconvlucy(I,psf,iter,dampar,weight,readout)specifies the additive noise (such as background or foreground noise) and variance of the read-out camera noise,readout.

J= deconvlucy(I,psf,iter,dampar,weight,readout,subsample)uses subsampling when the PSF is given on a grid that issubsampletimes finer than the image.

Examples

collapse all

Read and display a pristine image that does not have blur or noise. This example optionally crops the image to a size of 256-by-256 with the top-left (x,y) coordinate at (2,50).

我= imread ('board.tif'); I = imcrop(I,[2 50 255 255]); imshow(I) title('Original Image')

Figure contains an axes object. The axes object with title Original Image contains an object of type image.

Create a PSF that represents a Gaussian blur with standard deviation 5 and filter of size 5-by-5.

PSF = fspecial('gaussian',5,5);

Simulate blur in the image.

blurred = imfilter(I,PSF,'symmetric','conv');

Add simulated zero-mean Gaussian noise.

V = 0.002; blurred_noisy = imnoise(blurred,'gaussian',0,V); imshow(blurred_noisy) title('Blurred and Noisy Image')

Figure contains an axes object. The axes object with title Blurred and Noisy Image contains an object of type image.

Usedeconvlucyto restore the blurred and noisy image. Specify the PSF used to create the blur and decrease the number of iterations to 5.

luc1 = deconvlucy(blurred_noisy,PSF,5); imshow(luc1) title('Restored Image')

Figure contains an axes object. The axes object with title Restored Image contains an object of type image.

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 calldeconvlucyusing 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)');

Figure contains 4 axes objects. Axes object 1 with title A = Blurred and Noisy contains an object of type image. Axes object 2 with title deconvlucy(A,PSF) contains an object of type image. Axes object 3 with title deconvlucy(A,PSF,NI,DP) contains an object of type image. Axes object 4 with title deconvlucy(A,PSF,NI,DP,WT) contains an object of type image.

Input Arguments

collapse all

Blurry image, specified as a numeric array of any dimension. You can also specify the image as a cell array to enable interrupted iterations. For more information, seeTips.

Data Types:single|double|int16|uint8|uint16

PSF, specified as a numeric array.

Data Types:single|double|int16|uint8|uint16

Number of iterations, specified as a positive integer.

Data Types:double

Threshold for damping, specified as a numeric scalar. Damping occurs for pixels whose deviation between iterations is less than the threshold.damparhas the same data type asI.

Weight value of each pixel, specified as a numeric array with values in the range [0, 1].weight相同的大小吗s the input image,I. By default, all elements inweighthave the value1, so all pixels are considered equally in the restoration.

Data Types:double

Noise, specified as a numeric scalar or numeric array. The value ofreadoutcorresponds to the additive noise (such as noise from the foreground and background) and the variance of the read-out camera noise.readouthas the same data type asI.

Subsampling, specified as a positive scalar.

Data Types:double

Output Arguments

collapse all

Deblurred image, returned as a numeric array or a 1-by-4 cell array.J(orJ{1}whenJis a cell array) has the same data type asI. For more information about returningJas a cell array for interrupted iterations, seeTips.

Tips

  • You can usedeconvlucyto perform a deconvolution that starts where a previous deconvolution stopped. To use this feature, pass the input imageIas a cell array,{I}. When you do, thedeconvlucyfunction returns the output imageJas a cell array, which you can then pass as the input array into the nextdeconvlucycall. The output cell arrayJcontains four elements:

    J{1}containsI, 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.

  • The output imageJcould exhibit ringing introduced by the discrete Fourier transform used in the algorithm. To reduce the ringing, useI = edgetaper(I,psf)before callingdeconvlucy.

  • deconvlucyconverts the PSF todoublewithout normalization.

  • deconvlucymay return values in the output image that are beyond the range of the input image.

References

[1] D.S.C. Biggs and M. Andrews,Acceleration of iterative image restoration algorithms, Applied Optics, Vol. 36, No. 8, 1997.

[2] R.J. Hanisch, R.L. White, and R.L. Gilliland,Deconvolutions of Hubble Space Telescope Images and Spectra, Deconvolution of Images and Spectra, Ed. P.A. Jansson, 2nd ed., Academic Press, CA, 1997.

Version History

Introduced before R2006a