www.pudn.com > huiduzhifangtu.rar > leijiazhifangtufa.m, change:2007-11-17,size:730b


%累加直方图欧氏距离 
A0=imread('cancer11','bmp');  %读cancer第一组数据 
s=size(A0); 
B0=zeros(1,256); 
me_qd=0; 
p_qd=0; 
for m=1:s(1) 
    for n=1:s(2) 
        for h=1:256 
            if((A0(m,n)<(h-1))|(A0(m,n)==(h-1))) 
                B0(h)=B0(h)+1; 
            end 
        end 
    end 
end 
B0=B0/(s(1)*s(2));        %cancer灰度累加直方图数据 
 
 
A=imread('fatliver11','bmp');  %读fatliver第一组数据 
s=size(A); 
B=zeros(1,256); 
for m=1:s(1) 
    for n=1:s(2) 
        for h=1:256 
            if((A(m,n)<(h-1))|(A(m,n)==(h-1))) 
                B(h)=B(h)+1; 
            end 
        end 
    end 
end 
B=B/(s(1)*s(2));   %fatliver累加直方图数据 
 
for h=1:256 
    me_qd=me_qd+(B0(h)-B(h))^2; 
end 
me_qd=me_qd^(1/2)