Impact-Site-Verification: dbe48ff9-4514-40fe-8cc0-70131430799e

Search This Blog

Labeling a Binary image using Connected component labeling algorithm

A labeled image is an Image which find the connected components and label each object who shares a common connecting pixel either in 4 level connectivity which is in x and y direction, or either have 8 level connectivity mean also including diagonal connecting pixels as well. We used "bwlabel" function from MATLAB Image Processing toolbox to achieve this task. Also tried to explain the process in visual representation of a Binary Image in smaller scale. For which we craeted our own Image of Logical Matrix including only zero and 1 and then apply "bwlabel" function on that image and see the results. 
We observed that if we do not pass any second argument to the bwlabel function then it will automatically assumes to find 8 level connectivity. So in our case we have one diagonal connecting Object and the total resulting objects were 2 in our case. 
But as we want to find out only 4 level connectivity and do not want diagonal objects to be connected or to be considered as one object so we have to pass a second argument to the function of bwlabel and after passing a second argument with number 4 the function correctly returns count of 3 and the labeled image holds the value of 3 objects properly labeled with number 1,2 and 3.

Join us on Telegram:


  1. This is a wonderful article, Given so much info in it, These type of articles keeps the users interest in the website, and keep on sharing more ... good luck.


  2. Thank you for sharing the article. The data that you provided in the blog is informative and effective.

    Tableau Training in Hyderabad


  3. I am really happy to say it’s an interesting post to read . I learn new information from your article , you are doing a great job . Keep it up

    Devops Training in Hyderabad

    Hadoop Training in Hyderabad

    Python Training in Hyderabad

    Tableau Training in Hyderabad

    Selenium Training in Hyderabad