function [ output_args ] = poincare-leek( input_args )
[row col]=size(Orient); %Orient is the directional field after averaged
for X=2:1:row-Poin_Block_Size-2
for Y=2:1:col-Poin_Block_Size-2
Counter = 0;
for i=1:1:Poin_Block_Size - 1
Counter = Counter + 1;
P(1,Counter) = Orient(Poin_Block_Size + X - 2 - i,Y - 1)...
- Orient(Poin_Block_Size + X - 1 - i,Y - 1);
end
for i=1:1:Poin_Block_Size - 1
Counter = Counter + 1;
P(1,Counter)=Orient(X - 1,Poin_Block_Size + Y - 1 - i)...
- Orient(X - 1,Poin_Block_Size + Y - 2 - i);
end
for i=1:1:Poin_Block_Size - 1
Counter = Counter + 1;
P(1,Counter)=Orient(Poin_Block_Size + X - 1 - i,Poin_Block_Size + Y - 2)...
- Orient(Poin_Block_Size + X - 2 - i,Poin_Block_Size + Y - 2);
end
for i=1:1:Poin_Block_Size - 1
Counter = Counter + 1;
P(1,Counter)=Orient(Poin_Block_Size + X - 2,Poin_Block_Size + Y - 2 - i)...
- Orient(Poin_Block_Size + X - 2,Poin_Block_Size + Y - 1 - i);
end
for counter=1:4*Poin_Block_Size-4
if (abs(P(1,counter))<pi/2)
P(1,counter)=P(1,counter);
else
if (P(1,counter)<=-pi/2)
P(1,counter)=pi+P(1,counter);
else
P(1,counter)=pi-P(1,counter);
end
end
end
Poin(X,Y)=sum(sum(P));
end
end
[rowPoin colPoin]=size(Poin);
for x=1:1:rowPoin
for y=1:1:colPoin
core=Poin(x,y);
if (core==pi)
x_part=(x-(size(Orient,1)*0.6))^2;
y_part=(y-(size(Orient,2)*0.5))^2;
distance=sqrt(x_part+y_part);
corePoint=1;
else
distance=100;
end
Final(x,y)=distance;
end
end
if (corePoint==1)
min_distance=min(min(Final));
for x=1:1:rowPoin
for y=1:1:colPoin
Poin_distance=Final(x,y);
if (Poin_distance==min_distance)
x_core1=x;
y_core1=y;
end
end
end
x_core=(x_core1*Average_Block_Size)+1;
x_core=fix(x_core+((Average_Block_Size+1)/2));
y_core=(y_core1*Average_Block_Size)+1;
y_core=fix(y_core+((Average_Block_Size+1)/2));