Stap 7: De 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)
tekst (10,10, strcat ('\color {groen} objecten gevonden:', num2str(length(B)))
Wacht even
voor k = 1:length(B)
grens = B {k};
plot(Boundary(:,2), boundary(:,1), 'g', 'LineWidth', 0.2)
einde