Last active
March 29, 2020 15:02
-
-
Save Saafke/c88852cc9bbb8efb8f77ae89ce457a30 to your computer and use it in GitHub Desktop.
Matlab script for the Connected Component Labelling blog.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% Code created by Xavier Weber | |
% Create an image -- like the one in the GIF. | |
im = zeros(5,5); | |
im(1:1,5:5) = 255; | |
im(2:2,2:2) = 255; | |
im(3:3,1:1) = 255; | |
im(3:3,4:5) = 255; | |
im(4:4,4:4) = 255; | |
im(5:5,4:4) = 255; | |
im(5:5,2:4) = 255; | |
% Count the blobs | |
[nBlobs, im] = countBlobs(im); | |
% Give each blob a unique color | |
im = label2rgb(im); | |
%Show it | |
imshow(im, 'InitialMagnification', 5000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment