Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

(Bug?) How to get an estimated_nsr (without having original Image) for Wiener deconvolution?

Asked by Gianfry on 25 Jan 2013

I am using Wiener deconvolution to restore an image which is blurred and noisy. The problem is: I don't have the original image (of course...) and the Matlab documentation uses it to estimate the NSR.

http://www.mathworks.it/it/help/images/ref/deconvwnr.html

Example:

    I = im2double(imread('cameraman.tif'));  % I DONT have this image!
    estimated_nsr = noise_var / var(I(:));
    wnr3 = deconvwnr(blurred_noisy, PSF, estimated_nsr);

But of course I don't have the original image I (Otherwise I wouldn't use deconwnr...) I think this is bug in the documentation of Matlab.

I have the noise_variance param but not the original image.

Knowing the noise_variance how can I get a good estimated_nsr ?

0 Comments

Gianfry

Products

No products are associated with this question.

2 Answers

Answer by Image Analyst on 25 Jan 2013

I is the original image - you read it in from cameraman.tif. So you do have the original image - I don't know why you consider that a bug in the documentation. deconvwnr() assumes the original (input) image is the "noisy" image. If you have the PSF and an estimate of the nsr parameter, then send it it. Otherwise, make a guess. Use trial and error.

5 Comments

Gianfry on 26 Jan 2013

The bug is in the documentation because: If you are using deconvwnr() it means that you only have the blurred_noisy image and you need to recover the latent image.

So the documentation shouldn't write:

    estimated_nsr = noise_var / var(I(:));

Because most likely you can't have I(:) !

Image Analyst on 26 Jan 2013

You don't have noise_var either - they just guessed at it, so it's kind of a trial and error process. I can see your point that perhaps they should have used

estimated_nsr = noise_var / var(blurred_noisy(:));

instead, because normally blurred_noisy is what you have. You can send them an email and let them know.

Gianfry on 27 Jan 2013

Ok I will send en email

Image Analyst
Answer by Youssef KHMOU on 27 Jan 2013
Edited by Youssef KHMOU on 27 Jan 2013

Hi,

i am not sure if understand the issue here , but suppose we are testing to obtain the optimal value of the "nsr" :

Lets first talk about SNR : Signal-to-Noise Ratio

SNR=20*log10(Ampiltude²(I)/Amplitude²(noise))

for image processing i think the code is slightly different :

-------------------------------------------------------------------------------

function y=SNR(IMAGE)

maxs=max(IMAGE(:));

mins=min(IMAGE(:));

stdr=std(IMAGE(:));

y=20*log10((maxs-mins)/stdr);

------------------------------------------------------------------------------

An example :

-----------------------------------------------------------------------------

I=im2double(imread('liftingbody.png'));

snr1=snr(I)

J=imnoise(I,'Gaussian');

snr2=snr(J)

-----------------------------------------------------------------------------

so snr1=18.1124 and snr2=16.0656 means that at LOW SNR there is more noise.

so why dont you take the NSR=inv(SNR) and test it with deconvwnr function like :

-------------------------------------------------------------

function y=NSR(IMAGE)

maxs=max(IMAGE(:));

mins=min(IMAGE(:));

stdr=std(IMAGE(:));

y=inv(20*log10((maxs-mins)/stdr));

1 Comment

Youssef KHMOU on 27 Jan 2013

if that method does not give good results, we can try other approaches based on SNR .

Youssef  KHMOU

Contact us