BW1=im2bw(p1);
BW3=im2bw(p3);
BW6=im2bw(p6);
se = strel('disk',5);
I_opened1 = imopen(BW1,se);
I_opened3 = imopen(BW3,se);
I_opened6 = imopen(BW6,se);
figure(1)
imshow(I_opened1)
figure(2)
imshow(I_opened3)
figure(3)
imshow(I_opened6)
% %% PUNTO 5
% % para bwlabel se elije no se nota la diferencia entre que conectividad elejir por esta razon elejimos conectividad 8
% [L1,NUM1]=bwlabel(I_opened1,8);
% [L3,NUM3]=bwlabel(I_opened3,8);
% [L6,NUM6]=bwlabel(I_opened6,8);
%
% NUM1 %Numero de objetos de la figura p1
% NUM3 %Numero de objetos de la figura p3
% NUM6 %Numero de objetos de la figura p6
%
% % bwconncomp trabaja por defecto con conectividad 8
% CC1=bwconncomp(I_opened1)
% CC3=bwconncomp(I_opened3)
% CC6=bwconncomp(I_opened6)
% %% PUNTO 6
% S1 = regionprops(I_opened1,'Centroid');
% S3 = regionprops(I_opened3,'Centroid');
% S6 = regionprops(I_opened6,'Centroid');
%
% centroids1 = cat(1, S1.Centroid);
% figure(4)
% imshow(I_opened1)
% hold on
% plot(centroids1(:,1), centroids1(:,2), 'g*')
% hold off
%
% centroids3 = cat(1, S3.Centroid);
% figure(5)
% imshow(I_opened3)
% hold on
% plot(centroids3(:,1), centroids3(:,2), 'b*')
% hold off
%
% centroids6 = cat(1, S6.Centroid);
% figure(6)
% imshow(I_opened6)
% hold on
% plot(centroids6(:,1), centroids6(:,2), 'r*')
% hold off
%% PUNTO 7
[filename,pathname] = uigetfile('*.png','Selecciona imagen para abrir');
P1=imread(filename);
BW=im2bw(P1);
se = strel('disk',7);
I_opened = imopen(BW,se);
figure(7)
imshow(I_opened)
S = regionprops(I_opened,'Eccentricity');
ec = cat(1, S.Eccentricity)
[L,NUM]=bwlabel(I_opened,8);
while(i<=5)
for i=1:NUM
tipo1=1;
if abs(ec(i+1)-ec(1))<0.07 & abs(ec(i+1)-ec(1))>0
tipo1=tipo1+1;
end
end
end