Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to degrade the image, and then execute the restoration, such as a lena.jpg.

I tried this:

lena = ExampleData[{"TestImage", "Lena"}];
lena1 = GaussianFilter[lena, 5] 

With these get stained image lena1.jpg. This image is then used for recognition in the following step:

 ImageDeconvolve[lena1, GaussianMatrix[5.10]]

only parameter 5.10 gives better picture then lena1.jpg

Then this I have three pictures "lena.jpg"-original image, "lena1.jpg"-degraded image and Image after ImageDeconvolve - restored image.


1) I do not know which settings (filters) to apply during restoration pictures.


2) Which function to use during degradation and restoration?

Can someone write a concrete example of an image degradation and restoration with so obtained images included?

share|improve this question
Hi, welcome to Mma.SE, please change to a nicer name for better identification. – mm.Jang Jun 11 '13 at 15:18
Can you please post lena.jpg somewhere, like on imgur, and then link to the picture here? Alternatively, did you know about ExampleData[{"TestImage", "Lena"}]? – J. M. Jun 11 '13 at 15:21
BTW, you should use (* and *) for comment in Mathematica. – mm.Jang Jun 11 '13 at 15:27
Please could you provide complete examples (what is the "stained" image?) and valid code (rather than this odd markup)? Thanks. – Oleksandr R. Jun 11 '13 at 18:39
Does "degradation" always mean that a GaussianFilter has been applied? I wouldn't think so, but the restoration depends a lot on what type of degradation you have. – Jens Jun 11 '13 at 23:42

If you are asking about what value you need to set in the ImageDeconvolve[lena1.jpg, GaussianMatrix[value]] command, I'm not sure it can be calculated in an analytical way. In my experience it is best to create a table (list) of deconvoluted images with different GaussianMatrix values and then visually determine the best value. You could probably automate this with contrast calculation but I'm sceptical of the results. For example:

lena = ExampleData[{"TestImage", "Lena"}];
lena1 = GaussianFilter[lena, 5];
t = Table[ImageDeconvolve[lena1, GaussianMatrix[n]], {n, 1, 10}];
contrast[image_] := Total[Table[(i - j)^2, {i, 256}, {j, 256}] * 
ImageCooccurrence[image, 256] / 255^2, 2]; (* from: ref/ImageCooccurrence *)
ListLinePlot[contrast /@ t, Mesh -> All]

Resulting plot: contrast_plot

share|improve this answer
I'm new to all this. There is but one example of the current knowledge tungsten Mathematica not able to fully interpret. Here's the link – zokinp Jun 16 '13 at 18:53

The deconvolution kernel should be an estimate of the point spread function degrading the image. In your case this is known to be GaussianMatrix[5] as that is what you used to blur the image.

lena = ImagePad[ExampleData[{"TestImage", "Lena"}], -100];
lena1 = GaussianFilter[lena, 5];
ImageDeconvolve[lena1, GaussianMatrix[5]]

enter image description here

To suppress the high spatial frequency artefacts it is probably better to adjust the regularization parameter than to change the kernel:

ImageDeconvolve[lena1, GaussianMatrix[5], Method -> {"DampedLS", 0.002}]

enter image description here

share|improve this answer
How to recognition this image? – zokinp Jun 16 '13 at 19:08 – zokinp Jun 16 '13 at 19:20

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.