Salut tout le monde j'aimerais vous demander une explication de quelques fonctions écrites en Matlab.Le code permet de détecter l'iris d'un oeil avec l'opérateur intégro différentiel mais je ne voit pas qu'est ce que chaque fonction fait et comment ???

fonction lineint :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
%function to calculate the normalised line integral around a circular contour
%A polygon of large number of sides approximates a circle and hence is used
%here to calculate the line integral by summation
%INPUTS:
%1.I:Image to be processed
%2.C(x,y):Centre coordinates of the circumcircle
%Coordinate system :
%origin of coordinates is at the top left corner
%positive x axis points vertically down
%and positive y axis horizontally and to the right
%3.n:number of sides
%4.r:radius of circumcircle
%5.part:To indicate wheter search is for iris or pupil
%if the search is for the pupil,the function uses the entire circle(polygon) for computing L
%for the iris only the lateral portions are used to mitigate the effect of occlusions 
%that might occur at the top and/or at the bottom
%OUTPUT:
%L:the line integral divided by circumference
function [L]=lineint(I,C,r,n,part)
theta=(2*pi)/n;% angle subtended at the centre by the sides
%orient one of the radii to lie along the y axis
%positive angle is ccw
%Author:Anirudh S.K.
%Department of Computer Science and Engineering
%Indian Institute of Techology,Madras
rows=size(I,1);
cols=size(I,2);
angle=theta:theta:2*pi;
x=C(1)-r*sin(angle);
y=C(2)+r*cos(angle);
if (any(x>=rows)|any(y>=cols)|any(x<=1)|any(y<=1))
    L=0;
    return
    %This process returns L=0 for any circle that does not fit inside the image
end
%lines 34 to 42 compute the whole line integral
if (strcmp(part,'pupil')==1)
          s=0;
          for i=1:n
          val=I(round(x(i)),round(y(i)));
          s=s+val;
          end
 
          L=s/n;
      end
%lines 44 onwards compute the lateral line integral(to prevent occlusion affecting the results,the pixel average is taken only along the lateral portions)
if(strcmp(part,'iris')==1)
          s=0;
          for i=1:round((n/8))
          val=I(round(x(i)),round(y(i)));
          s=s+val;
          end
 
          for i=(round(3*n/8))+1:round((5*n/8))
          val=I(round(x(i)),round(y(i)));
          s=s+val;
          end
 
          for i=round((7*n/8))+1:(n)
          val=I(round(x(i)),round(y(i)));
          s=s+val;
          end
 
          L=(2*s)/n;
end
fonction partiald :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
%function to find the partial derivative
%calculates the partial derivative of the normailzed line integral
%holding the centre coordinates constant
%and then smooths it by a gaussian of appropriate sigma 
%%rmin and rmax are the minimum and maximum values of radii expected
%function also returns the maximum value of blur and the corresponding radius
%It also returns the finite differnce vector blur
%INPUTS:
%I;input image
%C:centre coordinates
%rmin,rmax:minimum and maximum radius values
%n:number of sides of the polygon(for lineint)
%part:specifies whether it is searching for the iris or pupil
%sigma:standard deviation of the gaussian
%OUTPUTS:
%blur:the finite differences vector
%r:radius at maximum value of 'blur'
%b:maximum value of 'blur'
%Author:Anirudh S.K.
%Department of Computer Science and Engineering
%Indian Institute of Techology,Madras
function [b,r,blur]=partiald(I,C,rmin,rmax,sigma,n,part);
R=rmin:rmax;
count=size(R,2);
for k=1:count
[L(k)]=lineint(I,C,R(k),n,part);%computing the normalized line integral for each radius
if L(k)==0%if L(k)==0(this case occurs iff the radius takes the circle out of the image)
    %In this case,L is deleted as shown below and no more radii are taken for computation
    %(for that particular centre point).This is accomplished using the break statement
     L(k)=[];
    break;
end
end
D=diff(L);
D=[0 D];
%append one element at the beginning to make it an n vector
%Partial derivative at rmin is assumed to be zero
if strcmp(sigma,'inf')==1%the limiting case of the gaussian with sigma infinity(pls remember to change the code)strcmp syntax is different
f=ones(1,7)/7;
else
f=fspecial('gaussian',[1,5],sigma);%generates a 5 member 1-D gaussian
end
blur=convn(D,f,'same');%Smooths the D vecor by 1-D convolution 
%'same' indicates that size(blur) equals size(D)
blur=abs(blur);
[b,i]=max(blur);
r=R(i);
b=blur(i);
%calculates the blurred partial derivative