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:
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:
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!?


IntensityCentroidexactly as you wrote it resulted in this output, which is probably what you wanted, but not what you got. – MarcoB May 25 '16 at 17:45Print[Show[i, points, ImageSize -> 350]]? Try dropping thePrint; do you not get the same result? – m_goldberg May 26 '16 at 13:48