Signal-to-noise ratio color image

4 views (last 30 days)
jack higher
jack higher on 16 Dec 2015
Commented: jack higher on 18 Dec 2015
I get a matrix image (64*64*3) and want to compute signal-to-noise. The formula is SNR=20lg(S/N). N is the noise standard deviation that I can get. But I don't know how to compute S. Should I use R,G,B channel to compute SNR and get three values? Thank you
<<
>>
  1 Comment
Image Analyst
Image Analyst on 17 Dec 2015
How are you getting your noise image? Are you covering the lens and snapping a photo? Or showing it a uniform field and snapping a photo? Or both and estimating the noise as a function of intensity? Somehow you need to get a measure of the noise alone which means a photo of something uniform with no structure in the scene.

Sign in to comment.

Answers (2)

harjeet singh
harjeet singh on 16 Dec 2015
i hope you are using image in the format of uint8 so maximum value will be 255, in this case S=255.^2 you can use this code for psnr
image=imread('onion.png');
image=imresize(image,[64 64]);
figure(1)
imshow(image);
drawnow
image_n=imnoise(image,'salt & pepper',0.1);
figure(2)
imshow(image_n)
drawnow
I=double(image);
K=double(image_n);
[m n x]=size(I);
MSE=(I-K).^2;
MSE=sum(MSE(:))/(m*n*x)
PSNR=10*log10(255.^2/MSE)
  4 Comments
Image Analyst
Image Analyst on 17 Dec 2015
Jack, you didn't see my comment did you? From just some arbitrary image, we can't produce a noise image without making some assumptions. Maybe it doesn't even have noise because it's a computer graphics synthesized image. You can't just pull noise out of a hat from some arbitrary image. In case you don't know, the standard deviation of the image values is NOT noise, contrary to what many many novices incorrectly think. Please upload your image and noise image. Otherwise I'll just say the SNR is infinite because of the lack of any information on the noise.
jack higher
jack higher on 18 Dec 2015
You mean I must know the original image? I have uploaded my image from my camera.

Sign in to comment.


Image Analyst
Image Analyst on 18 Dec 2015
Don't you think you need some way of estimating the noise? Of course you do. How are you going to do that? Are you going to do some experiments to measure it? Or just guess? It looks like you've added an image of a "uniform" image. If you define that image to be uniform, then take the std dev and compute the mean divided by the standard deviation.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!