Signal-to-noise ratio color image

4 次查看(过去 30 天)
jack higher
jack higher 2015-12-16
评论: jack higher 2015-12-18
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 个评论
Image Analyst
Image Analyst 2015-12-17
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.

请先登录,再进行评论。

回答(2 个)

harjeet singh
harjeet singh 2015-12-16
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 个评论
Image Analyst
Image Analyst 2015-12-17
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 2015-12-18
You mean I must know the original image? I have uploaded my image from my camera.

请先登录,再进行评论。


Image Analyst
Image Analyst 2015-12-18
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.

类别

Help CenterFile Exchange 中查找有关 Image Processing Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by