Code covered by the BSD License
Abhinava Kundu (view profile)
27 Jun 2012
PSNR of two images
Watch this File
Calculates the Peak-to-peak signal to noise ratio of two images X and Y.
Not a good example of good programming!
You can do exactly the same with:
X = double(X);
Y = double(Y);
m = sum((X(:)-Y(:)).^2) / prod(size(X));
psnr = 10*log10(255*255/m);
However, instead of assuming the peak is 255, you should use max(X(:)) as the peak.