Friday, March 18, 2016

Connectivity in MATLAB

Create a checker board pattern and count the number of objects using 4 and 8 connectivity.

MATLAB CODE:



I=checkerboard(20);
figure,imshow(I);
[l,num]=bwlabel(I);                       % check the number of objects using 4 and 8 connectivity
RGB=label2rgb(bwlabel(I));   % Display the objects using conversion label2rgb
figure,imshow(RGB)


Checkerboard Pattern

Connected Components
CONCLUSION:

A checkerboard pattern was created and the connected objects were found using 8 - connectivity. All the connected objects were displayed using an RGB representation as shown in Fig. 1

No comments:

Post a Comment