Finding object for which centroids are in a horizontal line.
Show older comments
I have an binary image with different objects in different positions. I want to find the sum of the length of the objects which are placed in a same line and CONSECUTIVE. In my image the required objects are 1,2,3 and 4. Here we cant add the length of the object 5 though its in the same line because its not successive. Is it possible to do that by using regionprops? Thank you

5 Comments
Walter Roberson
on 17 Mar 2016
Why is object 5 not "sucessive" ? You have an object above the line and between objects 2 and 3, so why does that object not break the line?
rupam baruah
on 18 Mar 2016
Edited: rupam baruah
on 18 Mar 2016
rupam baruah
on 18 Mar 2016
Walter Roberson
on 18 Mar 2016
Edited: Walter Roberson
on 18 Mar 2016
I do not understand what you mean by "consecutive". The order that objects are returned is not under your control and should be treated as being random, so you should be applying any sorting measures you want based upon the properties returned rather than upon the order that regionprops returns the objects. (The order is not actually random, but the order will not always make immediate sense visually.)
Possibly what you want is to look for objects whose centroid all have the same y coordinate (to within a tolerance) ?
rupam baruah
on 20 Mar 2016
Accepted Answer
More Answers (0)
Categories
Find more on Computer Vision Toolbox 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!