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?

 採用された回答

Thomas Koelen
Thomas Koelen 2015 年 5 月 12 日

0 投票

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 件のコメント

Sandeep V
Sandeep V 2015 年 5 月 12 日
編集済み: Image Analyst 2015 年 5 月 13 日
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 2015 年 5 月 12 日
編集済み: Thomas Koelen 2015 年 5 月 12 日
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.
Sandeep V
Sandeep V 2015 年 5 月 13 日
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)?
Image Analyst
Image Analyst 2015 年 5 月 13 日
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".
Sandeep V
Sandeep V 2015 年 5 月 13 日
OK then what does this 28.241 suggest? Can you please explain?

サインインしてコメントする。

その他の回答 (0 件)

質問済み:

2015 年 5 月 12 日

コメント済み:

2015 年 5 月 13 日

Community Treasure Hunt

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

Start Hunting!

Translated by