Opposite approach of Labeling Objects !!!BWLABEL !!!

Hey,
Through the understanding of functionality of BWLABEL, I came to know that labeling of object is top to bottom approach. Image Analyst answered a question regarding the understanding of how of bwlabel works. Here is the link of that
Now I want opposite approach for labeling of objects, I want that bwlabel goes column by column to to label objects instead of going row by row.
Regards

Answers (1)

Well, one simple solution: rotate your image 90 degrees, use bwlabel, rotate the label matrix 90 degrees the other way.
labelmatrix = rot90(bwlabel(rot90(myimage, 1)), -1)
But I must say, why would the labeling order would matter?

3 Comments

Thank you for your help,but it doesn't quiet well for me,labeling image column by column helps me to calculate the centroids distance of objects place adjacent to one another. I have also uploaded an image to make my question more obvious. Labeling should be like the attach image.
Row by row labeling won't give that labeling either because some letters are taller than others. You're going to have to come up with some way to sort them based on their centroids or bounding box centers.
Yes, I believe you're going the wrong route trying to order the labeling returned by bwlabel. Particularly as your desired ordering is not very well defined (it seems to be left to right for the upper part of the image and then left to right again for the lower part).
At the end of the day, once you've got the centroids of the objects, it's fairly simple to find the closest objects to each others.

Sign in to comment.

Asked:

on 7 Jul 2015

Edited:

on 8 Jul 2015

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!