Message Boards Message Boards

Measure relative lengths of objects

Below is a processed image of objects that look like lines and are differentiated using the MorphologicalComponents function. I want to measure the relative lengths of the objects and to do this I have used the 'best fit ellipse':

variable = ComponentMeasurements [ MorphologicalComponents [ binarizedImage ],  "Length"];

My question is; does the above method measure the best fit ellipse for each object (line) or does it do it for groups of lines in the image instead? Secondly, is it possible to draw the best fit ellipses too?  

Many thanks for your help in advance.
POSTED BY: M Edwards
5 years ago

ComponentMeasurements measures each component independently.

An example with an image from the documentation:

 With[{segmentation = MorphologicalComponents[image]}, 
  Graphics[{Red, Thick, 
    Rotate[Circle @@ #[[{1, 2}]], #[[3]]] & /@ 
     ComponentMeasurements[segmentation, {"Centroid", "SemiAxes", "Orientation"}][[All, 2]]}]


POSTED BY: Giulio Alessandrini
4 years ago

Group Abstract Group Abstract