Group Abstract Group Abstract

Message Boards Message Boards

Measure relative lengths of objects

GROUPS:
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
Answer
1 year ago

ComponentMeasurements measures each component independently.

An example with an image from the documentation:

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

best<em>fitellipses

POSTED BY: Giulio Alessandrini
Answer
5 months ago