# Image Restoration

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.

Problems:

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

and

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?

-
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:

-
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 demonstrations.wolfram.com/ImageRestorationForDegradedImages – 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]]


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}]


-
How to recognition this image? – zokinp Jun 16 '13 at 19:08
imgur.com/EYP0B0z – zokinp Jun 16 '13 at 19:20