Effacer les filtres
Effacer les filtres

Calculation SNR of image

7 vues (au cours des 30 derniers jours)
itai
itai le 3 Mar 2014
Commenté : Image Analyst le 4 Mar 2014
Hello everyone,
I need to calculate SNR in edge target image (half black and half white). How can i do this? I thought to take black part of the image and white part of the image, to calculate the standard deviation of the black part and calculate the mean of the white part, dividing the average in variance gives the SNR, is this calculation correct?
thank you.

Réponse acceptée

Image Analyst
Image Analyst le 3 Mar 2014
It looks like you're going to assume the black part is "no signal" and that it's all noise. Actually if the noise goes above and below your signal, then you do have a signal in the dark part. Maybe you can just assume it's the mean. And you assume that the white part is signal plus the same amount of noise. Why don't calculate the stddev of both white and dark parts separately and see if they're the same? If it's additive, then it should be the same. Anyway, each pixel has an SNR. So you can calculate the mean divided by the stddev (not variance) for each pixel. You can average over all pixels in the light and dark regions if you want to get the average SNR in those regions. To average across white and black regions collectively doesn't really make sense.
  4 commentaires
itai
itai le 4 Mar 2014
Hi,
First, the results of the black part and the white part are different. Secondly, you told me to calculate the SNR of each pixel, how can i do this? there is one value to the pixel.
Thank's, Itai
Image Analyst
Image Analyst le 4 Mar 2014
Try this:
clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
imtool close all; % Close all imtool figures if you have the Image Processing Toolbox.
clear; % Erase all existing variables. Or clearvars if you want.
workspace; % Make sure the workspace panel is showing.
format long g;
format compact;
fontSize = 25;
brightImage = 200*ones(150, 800, 'uint8');
darkImage = 20*ones(150, 800, 'uint8');
grayImage = [brightImage;darkImage];
% Display the original gray scale image.
subplot(3, 1, 1);
imshow(grayImage, []);
title('Original Noise-Free Grayscale Image', 'FontSize', fontSize);
% Enlarge figure to full screen.
set(gcf, 'Units', 'Normalized', 'OuterPosition', [0 0 1 1]);
% Give a name to the title bar.
set(gcf, 'Name', 'Demo by ImageAnalyst', 'NumberTitle', 'Off')
noisyImage = imnoise(grayImage, 'gaussian');
% Display the image.
subplot(3, 1, 2);
imshow(noisyImage, []);
title('Noisy Image', 'FontSize', fontSize);
% Get the standard deviation of the bright and dark areas
% We'll define this as the noise.
noisyBright = double(noisyImage(1:150, :));
stdNoiseBright = std(noisyBright(:))
noisyDark = double(noisyImage(151:300, :));
stdNoiseDark = std(noisyDark(:))
% Get the SNR image
snrImage = zeros(size(noisyImage)); % Initialize
snrImage(1:150, :) = noisyImage(1:150, :) / stdNoiseBright;
snrImage(151:300, :) = noisyImage(1:150, :) / stdNoiseDark;
% Display the image.
subplot(3, 1, 3);
imshow(snrImage, []);
title('SNR Image', 'FontSize', fontSize);

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by