1

To get the center of mass of a grey scale picture I would like to use ComponentMeasurements with IntensityCentroid. However the points evaluated by the following script do not match with the expectations.

This is the "bubbles.png" test-Image i used:

bubbles.png

i = Import["bubbles.png"];
m1 = ComponentMeasurements[i, "IntensityCentroid"] /. Rule[_, x_] -> x;
points = Graphics[{PointSize[0.01], Red, Point[m1]}];
Print[Show[i, points, ImageSize -> 350]]

The output looks like this:

bubbles_output.png

Here I would have expected to get the center of the bubbles.

If I use "Centroid" instead of "IntensityCentroid" the output matches my expectation, but again I actually would like to have a brightness weighted result.

Thank you very much in advance!

Edit p.s. : Using the coordinate transformation (or however one might call it) from HERE did not work for me. I even got negative coordinates!?

P.B.
  • 81
  • 5

0 Answers0