

clear all
clc
tic
I=imread('seta.bmp');
% imshow(I)
I2=rgb2gray(I);
I3=im2bw(I2);

I3=imresize(I3,0.2,'nearest');
toc
% imshow(I3)
% imshow(~I3)
% pause
% imshow(I3)
I3=~I3;
% pause
% imshow(I3)




% I4 = bwmorph(I3,'skel',inf);
% imshow(I4)
% 
% pause
% I5 = bwmorph(I4,'spur',1);

% I6 = double(I4)-double(I5);

% imshow(I6)
I3 = imrotate(I3,5,'nearest');

Icentro_1 = bwmorph(I3,'shrink',inf);

% imshow(Icentro_1)

Icentro_2 = bwmorph(I3,'erode',2);

% imshow(Icentro_2)
% pause
Icentro_21 = bwmorph(Icentro_2,'shrink',inf);


% imshow(Icentro_21)
% pause
I_final=double(Icentro_21)+double(Icentro_1);

% imshow(I_final)

[ponto1_y,ponto1_x] = find(Icentro_21)
[ponto2_y,ponto2_x] = find(Icentro_1)
direcao = 180/pi*atan2(ponto1_y-ponto2_y,ponto2_x-ponto1_x)

