The label value assigned to a blob by bwlabel or similar function is not random. Objects are labeled in order from left to right according to their leftmost pixel. For objects whose leftmost pixel fall on the same column, then the order is top to bottom.
It would be trivial to relabel your objects using a different rule as long as you can give a clear definition of that rule (perhaps you want to base the label on the location of the centroid?).
3 Comments
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/413062-to-arrange-count-numbers#comment_595469
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/413062-to-arrange-count-numbers#comment_595469
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/413062-to-arrange-count-numbers#comment_595516
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/413062-to-arrange-count-numbers#comment_595516
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/413062-to-arrange-count-numbers#comment_595536
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/413062-to-arrange-count-numbers#comment_595536
Sign in to comment.