Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

function Vect=feature_extraction_GAIC

% html conjugate gradient


global img_name GAMA
Nfa=20;
Np=3;
Niter=20;
%%%%% lecture image
img=double(imread(img_name));
[L,C]=size(img);
Xc=(1:C)';
Yc=(1:L)';
Vect=10*ones(Nfa*Nfa,1);
stepPH=C/(Nfa-1);
stepPV=L/(Nfa-1);

Mf_params_H=zeros(Nfa,4);
for i=1:Nfa % MFs centers in H direction
centers_H=stepPH*(i-1);
Mf_params_H(i,:)=[centers_H-stepPH centers_H
centers_H centers_H+stepPH];
end
Mf_params_V=zeros(Nfa,4);
for i=1:Nfa % MFs centers in V direction
centers_V=stepPV*(i-1);
Mf_params_V(i,:)=[centers_V-stepPV centers_V
centers_V centers_V+stepPV];
end
%%% evaluation des A et b
for j=1:size(Mf_params_H,1) % calcul
de Xi H (X):,Nbr

Mf_H(j,:)=trapmf(Xc,Mf_params_H(j,:));
end
for j=1:size(Mf_params_V,1) % calcul
de Xi V (V)

Mf_V(j,:)=trapmf(Yc,Mf_params_V(j,:));
end
Er=0;
G_X_E_old=0;
XI_Er=0;
for Ni=1:Niter
for i=1:L
for j=1:C
Mf_VxH=Mf_V(:,i)*(Mf_H(:,j))';
Mf_VxH_col=Mf_VxH(:);

Xi_VxH_col=Mf_VxH_col/sum(Mf_VxH_col);
e(i,j)=img(i,j)-
Vect'*Xi_VxH_col;
XI_Er=XI_Er+Xi_VxH_col*e(i,j);
Er=Er+e(i,j)^2;
end

end
G_X_E=GAMA*XI_Er;
Vect=Vect-(G_X_E_old+G_X_E)/2 ;
Error=sqrt(Er)/(L*C)
G_X_E_old=G_X_E;
pause
end

You might also like