Signal-to-noise ratio color image

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 Commento

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.

Accedi per commentare.

Risposte (2)

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 Commenti

Thank you for your answer.But I still can't compute S.More details:image is get from a digital still camera and is a truecolor image and in the format of uint8.
upload the image
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.
You mean I must know the original image? I have uploaded my image from my camera.

Accedi per commentare.

Image Analyst
Image Analyst il 18 Dic 2015

0 voti

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.

Richiesto:

il 16 Dic 2015

Commentato:

il 18 Dic 2015

Community Treasure Hunt

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

Start Hunting!

Translated by