({{, (RefLink[ImageDeconvolve, paclet:ref/ImageDeconvolve])[image,ker]
gives a deconvolution of image using kernel ker.}})

OpenersNotesSection(Spacer1)Details and Options

The deconvolution kernel is given as a numerical matrix or as an image and cannot be larger than image in any dimension.

The kernel represents the point spread function, which is assumed to model the blur present in the image.

(RefLink[ImageDeconvolve, paclet:ref/ImageDeconvolve])[image,ker] always gives an image of a real type of the same dimensions as image.

(RefLink[ImageDeconvolve, paclet:ref/ImageDeconvolve]) operates separately on each channel in image.

The deconvolution kernel must have a single channel or the same number of color channels as the image.

The following options can be specified:

Possible settings specifying spectral deconvolution methods are:

For spectral deconvolution methods, a regularization parameter p can be given with a setting (RefLink[Method, paclet:ref/Method])->{"method",p}. For non-negative deconvolution kernels in which the sum of all elements is equal to 1, the regularization parameter is typically in the range from 0 to 1.

With a setting (RefLink[Method, paclet:ref/Method])->{"method",{(Subscript[p, 1]),(Subscript[p, 2]),…}}, separate regularization parameters can be given for each color channel.

The following settings for the (RefLink[Method, paclet:ref/Method]) option specify iterative deconvolution methods:

The "SteepestDescent" and "RichardsonLucy" methods always return non-negative pixel values.

Iterative deconvolution methods typically provide better results than spectral methods but are computationally more expensive. By default, preconditioned versions of the iterative methods are used. Preconditioning can be disabled by setting (RefLink[Method, paclet:ref/Method])->{"method","Preconditioned"-> (RefLink[False, paclet:ref/False])}, resulting in slower convergence.

The classical Richardson–Lucy deconvolution method does not use preconditioning.

(RefLink[ImageDeconvolve, paclet:ref/ImageDeconvolve]) also supports an iterative "TotalVariation" method that effectively implements an iterative total variation regularization algorithm.

The following suboptions can be specified with a setting (RefLink[Method, paclet:ref/Method])->{"TotalVariation",subopt}:

Possible settings for "NoiseModel" are "Gaussian", "Laplacian", or "Poisson".

Note that (RefLink[ImageDeconvolve, paclet:ref/ImageDeconvolve]) and (RefLink[ImageConvolve, paclet:ref/ImageConvolve]) use different default settings for (RefLink[Padding, paclet:ref/Padding]).

(RefLink[ImageDeconvolve, paclet:ref/ImageDeconvolve]) works with (RefLink[Image3D, paclet:ref/Image3D]) objects.

OpenersPrimaryExamplesSection(Spacer1)Examples  (24)

OpenersExampleSection0(Spacer1)Basic Examples  (1)

Restore a blurred image:

ImageDeconvolve[,GaussianMatrix[10]]

OpenersExampleSection1(Spacer1)Scope  (5)

OpenersExampleSubsection0(Spacer1)Data  (3)

Remove blur from a grayscale image:

ImageDeconvolve[,GaussianMatrix[4]]

Remove Gaussian blur:

ImageDeconvolve[,GaussianMatrix[4]]

Deconvolve a 3D image:

ImageDeconvolve[, DiskMatrix[2,{4,4,4}]/56,Method->"TotalVariation"]

OpenersExampleSubsection1(Spacer1)Parameters  (2)

The point spread function can be given as an image:

ImageDeconvolve[,]

OpenersExampleSection2(Spacer1)Options  (7)

OpenersExampleSubsection2(Spacer1)Method  (6)

Deblur a Snellen chart:

ImageDeconvolve[,BoxMatrix[3]/49,Method->"TotalVariation"]

Comparison of spectral deconvolution methods:

ImageDeconvolve[,GaussianMatrix[5], Method->#]& /@ {"DampedLS","Tikhonov","TSVD","Wiener"}

Comparison of iterative deconvolution methods:

ImageDeconvolve[,GaussianMatrix[5], Method->{#, "Preconditioned"->False},MaxIterations-> 100]& /@ {"Hybrid","SteepestDescent","RichardsonLucy"}

Iterative methods with preconditioning:

ImageDeconvolve[,GaussianMatrix[5], Method->{#, "Preconditioned"-> True}]& /@ {"Hybrid","SteepestDescent","RichardsonLucy"}

Total variation method with explicit regularization parameter:

ImageDeconvolve[,GaussianMatrix[4], Method->{"TotalVariation","Regularization"->10^-5},Padding->"Fixed"]

Total variation method with a specified noise model:

ImageDeconvolve[,,Method->{"TotalVariation","NoiseModel"->"Poisson"}]

OpenersExampleSubsection4(Spacer1)MaxIterations  (1)

By default iterative methods run 10 iterations:

img=;ker=GaussianMatrix[5];

ImageDeconvolve[img,ker,Method->{"SteepestDescent","Preconditioned"->False}, MaxIterations->10]

Specify maximum number of iterations:

ImageDeconvolve[img,ker,Method->{"SteepestDescent","Preconditioned"->False}, MaxIterations->50]

OpenersExampleSection3(Spacer1)Applications  (3)

Remove out-of-focus blur:

ImageDeconvolve[,DiskMatrix[7]/177, Method->"SteepestDescent"]

Recover license plate numbers from blurred images:

ImageDeconvolve[,GaussianMatrix[20],Method->{"DampedLS", 0.02}]

Guess an appropriate PSF for removing motion blur:

psfMotion[dim_?NumberQ, theta_?NumberQ]:=
Module[{PSF},
	PSF = ConstantArray[0.0, {dim,dim}];
	PSF[[Ceiling[dim / 2.0], All]] = 1.0 / dim;
	Return[ImageRotate[Image[PSF], theta  Degree]];
];
psf = psfMotion[14,0];
ImageDeconvolve[,psf,Method->"RichardsonLucy", MaxIterations->15]

OpenersExampleSection4(Spacer1)Properties & Relations  (3)

(RefLink[ListDeconvolve, paclet:ref/ListDeconvolve]) can be used to perform deconvolution on the result of (RefLink[ImageData, paclet:ref/ImageData]):

Image[ListDeconvolve[GaussianMatrix[4],ImageData[]]]

(RefLink[Sharpen, paclet:ref/Sharpen]) does not require a PSF, but it can only restore a small Gaussian blur:

Sharpen[,5]

(RefLink[ImageDeconvolve, paclet:ref/ImageDeconvolve]) is an approximate inverse of (RefLink[ImageConvolve, paclet:ref/ImageConvolve]):

blur=ImageConvolve[,GaussianMatrix[10],Padding->"Reversed"]

ImageDeconvolve[blur,GaussianMatrix[10]]

OpenersExampleSection5(Spacer1)Possible Issues  (5)

The PSF should always be normalized so that the total of the weights is 1:

i=;shape=;

ImageDeconvolve[i,shape]

Use a normalized PSF:

ImageDeconvolve[i,ImageMultiply[shape,1/ImageMeasurements[shape,"Total"]]]

If the PSF does not match the blur, deconvolution fails to enhance details and it may add artifacts:

ImageDeconvolve[,GaussianMatrix[3],Method->"TotalVariation"]

Preconditioned methods may introduce more artifacts than non-preconditioned:

ImageDeconvolve[,ConstantArray[1/20,{1,20}],Method->{"Hybrid","Preconditioned"->#}]&/@{True, False}

Preconditioned methods are sensitive to boundary conditions:

ImageDeconvolve[,,Method->{"SteepestDescent", "Preconditioned"->True}, Padding->#]&/@{"Reflected", "Periodic", 0}

Even a small amount of noise in a blurred image can reduce the quality of reconstruction:

ImageDeconvolve[ImageEffect[, {"GaussianNoise", 0.01}], GaussianMatrix[4]]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[ImageConvolve, paclet:ref/ImageConvolve])  ▪  (RefLink[ListConvolve, paclet:ref/ListConvolve])  ▪  (RefLink[ListDeconvolve, paclet:ref/ListDeconvolve])  ▪  (RefLink[ImageCorrelate, paclet:ref/ImageCorrelate])  ▪  (RefLink[Sharpen, paclet:ref/Sharpen])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Image Filtering & Neighborhood Processing, paclet:guide/ImageFilteringAndNeighborhoodProcessing])}, {▪(RefLinkPlain[Image Computation for Microscopy, paclet:guide/ImageComputationForMicroscopy])}, {▪(RefLinkPlain[Image Restoration, paclet:guide/ImageRestoration])}, {▪(RefLinkPlain[Image Processing & Analysis, paclet:guide/ImageProcessing])}, {▪(RefLinkPlain[3D Images, paclet:guide/3DImages])}, {▪(RefLinkPlain[Computational Photography, paclet:guide/ComputationalPhotography])}})}})