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

1 view (last 30 days)
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)

Guillaume
Guillaume on 7 Jul 2015
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
Image Analyst
Image Analyst on 7 Jul 2015
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.
Guillaume
Guillaume on 8 Jul 2015
Edited: Guillaume on 8 Jul 2015
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.

Categories

Find more on Interactive Control and Callbacks in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!