www.pudn.com > src.rar > psnr.m, change:2010-07-20,size:317b


 
a=imread('..\result\inpaintL.jpg'); 
b=imread('..\result\inpaintR.jpg'); 
 
a=rgb2gray(a); 
b=rgb2gray(b); 
 
sum=0; 
 
for y=1:size(a,1)  
    for x=1:size(a,2) 
        sum=sum+ double( b(y,x)-a(y,x) )^2; 
    end 
end 
 
framesize= size(a,1) *size(a,2) ; 
 
MSE=sum/framesize; 
 
PSNR=10* log10((255^2)/MSE);