Calculate SNR pixel-by-pixel

7 views (last 30 days)
Med_Imager
Med_Imager on 9 Mar 2012
I am trying to figure out the Signal to Noise Ratio (SNR) in an image matrix (64x64x16). (called Image_Matrix_3D in the code)
The SNR = mean signal / stdev
However, I need to compute this pixel by pixel wise. so I need the mean signal in each pixel for each slice and the stdev in each pixel for each slice.
The code should look something like the following I think. However, it doesn't look entirely correct. Also I get the stdev to be zero.
for i=1:64
for j=1:64
for k=1:N
m(i,j,k) = mean(Image_Matrix_3D( i,j, k),[3]);
stdev(i,j,k)= std(m( i,j, k));
end
end
end
If anyone on Matlab Central is familiar with this type of analysis, can you please help?
Thanks!

Answers (1)

Walter Roberson
Walter Roberson on 9 Mar 2012
The standard deviation of a single value is always 0.
You need be applying mean() and std() to the same vector of values. "vector" is a key term here.
Hint:
pixelvector = squeeze(Image_Matrix_3D(i,j,:));
mean(pixelvector)
std(pixelvector)

Community Treasure Hunt

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

Start Hunting!