www.pudn.com > duge.rar > RMSE.m, change:2015-06-01,size:390b


function [ value ] = RMSE(I,J) 
%% 均方根误差,越小融合图像与理想图像越接近 
 [M,N,color1]=size(I); 
 [M,N,color2]=size(J); 
 if color1==3||color2==3 
     I=rgb2gray(I); 
     J=rgb2gray(J); 
 end 
 I=double(I); 
 J=double(J); 
%   total=sum(sum(abs(J-I).^2)); 
total=0; 
 for i=1:M 
     for j=1:N 
         total=total+(I(i,j)-J(i,j))^2; 
     end 
 end 
 value=sqrt(total/(M*N)); 
 
end