How to compute P.S.N.R value for the below set of images?

I would request anybody to provide me with code to compute the PSNR value for the below pair of images. I want to compare output1.png with o.png, o2.png with output2.png? Please help?

 Respuesta aceptada

If you have the image processing toolbox you can use the function:
peaksnr = psnr(A,ref)
where A is your output1 and ref is o.

5 comentarios

Sandeep V
Sandeep V el 12 de Mayo de 2015
Editada: Image Analyst el 13 de Mayo de 2015
A=imread('output1.png');
>> B=imread('o.png');
>> peaksnr = psnr(A,B);
??? Undefined function or method 'psnr' for input arguments of type 'uint8'.
I am using MATLAB R2010a version.
Can you please suggest what the problem is?
A=<540x960x3 uint8>
B=<540x960x3 uint8>
Thomas Koelen
Thomas Koelen el 12 de Mayo de 2015
Editada: Thomas Koelen el 12 de Mayo de 2015
Can you run this:
v = ver;
any(strcmp('Image Processing Toolbox', {v.Name}))
and post results? What version of matlab do you have?
Edit: just read that you have 2010a, I don't think peaksnr is present in that build.
I suggest you try one of the following:
or you could code it yourself:
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.
Thanks it is working and I am getting psnr as 28.241
Does this suggest that the second image(output1.png) is better than the first image(o.png)?
Of course not. psnr is a measure of how close two images are to each other, not an overall assessment of which image is "better".
OK then what does this 28.241 suggest? Can you please explain?

Iniciar sesión para comentar.

Más respuestas (0)

Preguntada:

el 12 de Mayo de 2015

Comentada:

el 13 de Mayo de 2015

Community Treasure Hunt

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

Start Hunting!

Translated by