calculating PSNR

I have two images original image and compressed image,please tell how to calculate mean square error and psnr

 채택된 답변

Image Analyst
Image Analyst 2012년 3월 21일

0 개 추천

Did you see the formula at http://en.wikipedia.org/wiki/PSNR? Of course you can just subtract the images and use the sum() function instead of the loops, which I know you know how to do. Just make sure you use .^2 instead of ^2 because you want an element-by-element squaring. Give it a try - it's just one line of code.

댓글 수: 3

kash
kash 2012년 3월 21일
[M N] = size(origImg);
error = origImg - compImg;
MSE = sum(sum(error .* error)) / (M * N);
is it corect Mr.Analyst
Image Analyst
Image Analyst 2012년 3월 21일
Looks like it should be as long as origImg & compImg are floating point images and not uint8 or uint16. I was thinking of something like
MSE = mean2((single(image1) - single(image2)).^2);
kash
kash 2012년 3월 22일
Thanks MR.Analyst

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Wayne King
Wayne King 2012년 3월 21일

0 개 추천

The Wavelet Toolbox has a function for this, measerr()
>>doc measerr

댓글 수: 2

kash
kash 2012년 3월 21일
Wayne i am getting page not found,am using 2010a
Wayne King
Wayne King 2012년 3월 21일
introduced in R2010b

댓글을 달려면 로그인하십시오.

질문:

2012년 3월 21일

Community Treasure Hunt

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

Start Hunting!

Translated by