Message Boards Message Boards


Measure relative lengths of objects

Posted 10 years ago
1 Reply
6 Total Likes
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

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]]}]


Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract