Signal-to-noise ratio color image
3 ビュー (過去 30 日間)
古いコメントを表示
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
<<
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/152678/image.bmp)
>>
1 件のコメント
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
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
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.
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 Center および File Exchange で Image Processing Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!