function [indices,TabInd, I,J]=computePPV(sk,x,y) [I,J,V] = find(sk==1); indices = zeros(2,2); %TabInd = zeros(2,1); TabInd = zeros(2); % modif [indices(1,:), TabInd(1)]=f(I,J,x(1),y(1)); [indices(2,:), TabInd(2)]=f(I,J,x(2),y(2)); end function [ind, KI]= f(I,J,x,y) KI=0; ind=zeros(1,2); D1 = 100000000; %Ds = 100000000; for k= 1:length(I) A = [J(k) I(k)]; % modif : permut J(K) et I(K) %A = [I(k) J(k)]; B = [x y]; Ds = distance(A,B);%sqrt((J(k)- x).^2+(I(k)- y).^2); D = min(D1,Ds); if D~=D1 ind(1,1)=I(k); ind(1,2)=J(k); D1 = D; KI = k; end end end function d=distance(A,B) %distance entre deux point A et b d =sqrt( (A(1)- B(1)).^2 + (A(2)- B(2)).^2 ); % euclidiant () %une distance de manathan serai a tester pour de meilleur resul % d = abs(A(1)- B(1)) + abs(A(2)- B(2)); end