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


function [ value ] = offset( I,J ) 
%% ƫָ  
%OFFSET Summary of this function goes here 
%   JΪںͼ 
 [M,N,color1]=size(I); 
 [M,N,color2]=size(J); 
 if color1==3||color2==3 
     I=rgb2gray(I); 
     J=rgb2gray(J); 
 end 
%   total=0; 
%  for i=1:M 
%      for j=1:N 
%          total=total+abs(I(i,j)-J(i,j))/I(i,j); 
%      end 
%  end 
total=sum(sum(abs(double(I)-double(J))./double(J))); 
 value=total/(M*N); 
end