% detecteur de point interer
%
clc;
clear all;
%
k=0.04;
SeuilR=0.00009;
imag_R=imread('Gchdc.bmp'); %%lecture de l'image guache
imag_L=imread('Drtdc.BMP'); %% lecture de limage droite
subplot(211)
imshow(imag_R(:,:,1)); %affichage de limage;
subplot(212)
imshow(imag_L(:,:,1));
%
[ x_r,y_r] = hariss (imag_R,k,SeuilR);
[ x_l,y_l] = hariss( imag_L,k,SeuilR);
% %Affichage des diff�rents coins apr�s filtrage gaussien sur les gradiants de l'image en niveau de gris.
figure(5)
imshow(imag_R(:,:,1));
hold on;
plot(y_r,x_r,'G.');
title('image rigth');
%
figure(4)
imshow(imag_L(:,:,1));
hold on;
plot(y_l,x_l,'r.');
title('image left');
% ***************************************************************************************
x0_r=139;%% point choisit de l'image gauche
y0_r=201 ;%% point choisir de l'image droite
%%
%%
imag_R=imag_R(:,:,1);
imag_L=imag_L(:,:,1);
x0_l=x0_r;% point de depart de recherche la correspandance dans l'image droite
y0_l=y0_r;% point de depart de recherche la correspandance dans limage droite
% cherche la correspondance
%%
% 1er etape on etablir une zone de recherche
%
% zone de recherche
zone_reche=21; %%c'est a dire une zone de taille 5*5
Xcentre_zone_Rche=(zone_reche-1)/2;
Ycentre_zone_Rche=Xcentre_zone_Rche;
% zone d'interer
%
[M,N]=size(imag_R(:,:,1));
zone_interet=7;%c'est a dire une zone de taille 3*3;
X_centre_In=(zone_interet-1)/2;
Y_centre_In=(zone_interet-1)/2;
%% VERIFICATION LA CONDITION
%%
% if ( (p_int_y1-pas_recher>0) && (p_int_y1+pas_recher<lig) && (p_int_x1-pas_recher>0) && (p_int_x1+pas_recher<col))
%% cadre de recherche
%%
k=0
cpt1=0;
for Rex=-Xcentre_zone_Rche:Xcentre_zone_Rche
for Rey=-Ycentre_zone_Rche:Ycentre_zone_Rche
%% cadre d'intere
%%
sd=0;
cpt=0;
for Ix=-X_centre_In:X_centre_In
for Iy=-Y_centre_In:Y_centre_In
if (x0_r-Xcentre_zone_Rche-X_centre_In>0 && y0_r-Ycentre_zone_Rche-Y_centre_In>0 && x0_r+Xcentre_zone_Rche+X_centre_In<M && y0_r+Ycentre_zone_Rche+Y_centre_In>0)
cpt=cpt+1;
cpt1=cpt1+1;
sd=sd+abs(imag_R(x0_r+Ix,y0_r+Iy))-(imag_L(x0_l+Ix+(Rex),y0_l+Iy+(Rey)));
% posit_r(1,cpt)=x0_r+Ix%%v�rification
% posit_r(2,cpt)=y0_r+Iy
%
posit_l{cpt1}(1,cpt)=x0_r+Ix+Rex;
posit_l{cpt1}(2,cpt)=y0_r+Iy+Rey;
end
end
end
k=k+1;
ind(k,1)=Rex;
ind(k,2)=Rey;
sd1(k)=sd;
end
end
[val,pos]=min(sd1)
% [lig,col]=find(sd1==val);
% max_pos_min=max(col);
x_point_intret=ind(pos,1)+x0_r;
y_point_intret=ind(pos,2)+y0_r;
%%
subplot(121)
imshow(imag_R(:,:,1));
hold on;
plot(x0_r,y0_r,'r*');
title('position initial');
subplot(122)
imshow(imag_L);
hold on;
plot(x_point_intret,y_point_intret,'G*');
title('image ligth');
评论0