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?

  • $\begingroup$ Hi, welcome to Mma.SE, please change to a nicer name for better identification. $\endgroup$ – mmjang Jun 11 '13 at 15:18
  • $\begingroup$ 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"}]? $\endgroup$ – J. M.'s technical difficulties Jun 11 '13 at 15:21
  • $\begingroup$ BTW, you should use (* and *) for comment in Mathematica. $\endgroup$ – mmjang Jun 11 '13 at 15:27
  • $\begingroup$ Please could you provide complete examples (what is the "stained" image?) and valid code (rather than this odd markup)? Thanks. $\endgroup$ – Oleksandr R. Jun 11 '13 at 18:39
  • 2
    $\begingroup$ 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. $\endgroup$ – 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


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

  • $\begingroup$ How to recognition this image? $\endgroup$ – zokinp Jun 16 '13 at 19:08
  • $\begingroup$ imgur.com/EYP0B0z $\endgroup$ – zokinp Jun 16 '13 at 19:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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