Étape 7: Le Code
img1=imread('Lines.jpg') ;
imshow(img1)
img1=rgb2gray(img1) ;
imshow(img1)
img2=im2bw(img1,graythresh(img1)) ;
imshow(img2)
img2 = ~ img2 ;
imshow(img2)
B = bwboundaries(img2) ;
imshow(img2)
texte (10,10, strcat ('\color {vert} objets trouvés: ", num2str(length(B)))
Attends
pour k = 1:length(B)
Boundary = B {k} ;
Plot(Boundary(:,2), boundary(:,1), 'g', 'LineWidth', 0,2)
fin