⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 box_conting.m

📁 Code matlab pour l extraction de la signature de l iris.Nous avons appliquer la méthode de box cuont
💻 M
字号:
%----------------------------------Analyse fractal---------------------------------%
%__________________________________________________________________________________%
function box=Box_conting(L)

%-------------------------Lecture de l'image---------------------%

%___________Lecture du fichier test.txt__________%

fid = fopen('test.txt');
mydata = textscan(fid,'%s','delimiter','$');

mydata{:}
fclose(fid);
%_______Nombre d'images a traiter_______%
NBimage=size(mydata{:},1);

%_______________________________________%
for nb=1:NBimage

L=2;
x=imread(mydata{1}{nb});

%x=imread('Resultats4/022_1_2.bmp');

%---------------selection automatique d'un seuil-----------------%
% level = graythresh(x)
% BW = im2bw(x,level);
% BW = im2bw(x,level);
%______inter mode_______%
[n,m]=size(x);
h(1:256)=0;
    for i=1:n
        for j=1:m
            h(x(i,j)+1)=h(x(i,j)+1)+1;        
        end
    end
%     figure,plot(h)
k=length(h); 

%_____________Fonction de lissage_________________%
%_________________________________________________%

for lis=1:100
    h(1)=(h(1)+h(2))/3;
    h(k)=(h(k-1)+h(k))/3;

    for i=2:k-1
        h(i)=(h(i-1)+h(i)+h(i+1))/3;
        
    end
end

%__________________________________________________%
max2=max(h);
max1=h(1);
for i=2:size(h,2)
   if(h(i)>=max1)
      max1=h(i);
   end
   if(h(i)<max1)
         break;
       
   end
    
end
%s=(max2+max1)/2;
%_______________________________________________%
s=((find(h==max1))+(find(h==max2)))/2;
BW = im2bw(x,s/256);
%______imshow(BWAut)______%
% figure(4);
% 
% subplot(2,1,1);imshow(x);title('Image Origine');
% subplot(2,1,2);imshow(BW);title('Image binaris閑');


%----------------------------------------------------%

%BW(128:512,:)=0;
BW(129:520,512:520)=0;
% figure(5);
% imshow(BW)
[lin col]=size(BW);

%_____________________Box_conting____________________%
%___________La Taille de la boite est " L "__________%
for f=1:33

nbBoite=0;


limite_L=round((lin/L)-0.50);
limite_C=round((col/L)-0.50);

if(L<=lin)
c1=1; 

for i=1:limite_L
c2=1;  
    for j=1:limite_C
       
 
        S=0;
        for k=c1:c1+L-1
            for m=c2:c2+L-1
                              
               if(BW(k,m)==1)
                    S=1;
                end
            end

        end 

        if(S~=0)
                nbBoite=nbBoite+1;
         end   


         c2=c2+L;
    end
   c1=c1+L;
end
end

X(f)=log(nbBoite);
Y(f)=(log(1/L));
box(f)=nbBoite;
%_________La dimention fractal________%
DimF(f)=X(f)/Y(f);


L=L+1;
end
% figure(3);
% plot(Y,X);

figure(5);
plot(-Y,DimF);
P=polyfit(Y,DimF,1);

%P(1);
Dfractal(nb)=P(1);
save Dfractal Dfractal;

end
%----------------------------------------------------%


%----------------------------------------------------------------------------------%

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -