nivel = 30

Ia=imread('seta2.bmp');

Ia=imresize(Ia,0.1,'nearest'); 

Ib=(double(Ia(:,:,1))<nivel).*(double(Ia(:,:,2))<nivel).*(double(Ia(:,:,3))<nivel);



%Ib=~Ib;


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

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

Icentro_21 = bwmorph(Icentro_2,'shrink',inf);

I_final = double(Icentro_21)+double(Icentro_1);
[ponto1_y,ponto1_x] = find(Icentro_21);
[ponto2_y,ponto2_x] = find(Icentro_1);

subplot(3,2,1)

imshow(Ia)
subplot(3,2,2)

imshow(Ib)
subplot(3,2,3)
imshow(Icentro_1)

subplot(3,2,4)

imshow(Icentro_2)

subplot(3,2,5)
imshow(Icentro_21)

subplot(3,2,6)
imshow(I_final)

