www.pudn.com > Gabor_2dpca_pca.rar > testing.m


%  
% 测试,计算FRR和FAR 
% function [out_d,out_dt]=testing() 
 
% 计算类内距离 
%  
MM=3; 
Dist=[]; 
 for i=0:99     
    for j=1:MM    
     eval(['load Log_orth\im_' num2str(i) '_',num2str(j) ]); 
        temp1=im_weight;   
%         temp1=temp1(1:end); 
        clear im_weight; 
        for k=4:6 
           eval(['load Log_orth\im_' num2str(i) '_',num2str(k)]); 
           temp2=im_weight;   
%            temp2=temp2(1:end); 
           clear im_weight;   
           dista=0; 
%            dista=1-dot(temp1,temp2)/(norm(temp2)*norm(temp1)) 
           dista=norm(temp2-temp1); 
           Dist=[Dist dista]; 
        end 
         
    end 
 end 
 
%计算类间距离 
Dis=[]; 
 for i=0:98 
    for ii=i+1:99 
        for jj=1:MM 
            eval(['load Log_orth\im_' num2str(i) '_',num2str(jj) ]); 
            temp3=im_weight; 
%             temp3=temp3(1:end); 
            clear im_weight; 
            for jjj=4:6 
                eval(['load Log_orth\im_' num2str(ii) '_',num2str(jjj) ]); 
                temp4=im_weight;    
%                 temp4=temp4(1:end); 
                clear im_weight; 
%                 dis=1-dot(temp3,temp4)/(norm(temp3)*norm(temp4)) 
                dis=norm(temp4-temp3); 
                Dis=[Dis dis];  
                 
            end 
        end 
    end  
       
 end 
save   Gabor_15orth.mat Dis Dist 
 
  
  
%  out_d=Dis; 
%  out_dt=Dist; 
  
  
% FAR=[];GAR=[]; 
% W_P=[]; 
% B_P=[]; 
% D_max=max(Dis); 
% H_max=max(Dist); 
% DI_max=max(D_max,H_max); 
% Dis=Dis/DI_max; 
% Dist=Dist/DI_max; 
% Dis=Dis; 
% Dist=Dist; 
% nn=0.01; 
% for i=0:nn:1 
%     n=0;m=0; 
%   
%      
%     far=size(find(Disi),2)/size(Dist,2);% 计算错误拒绝率 
%     
%     
%    W_d=sum(Dist>i&Disti&Dis