# Image-Processing/IntensityCentroid [closed]

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

## closed as off-topic by MarcoB, user9660, Öskå, dr.blochwave, EdmundMay 31 '16 at 9:06

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question cannot be answered without additional information. Questions on problems in code must describe the specific problem and include valid code to reproduce it. Any data used for programming examples should be embedded in the question or code to generate the (fake) data must be included." – MarcoB, Community, Öskå, dr.blochwave, Edmund
If this question can be reworded to fit the rules in the help center, please edit the question.

• I cannot reproduce the behavior you showed. Running your code with IntensityCentroid exactly 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:45
• Thanks for replying! I was using Mathematica 8 before and had the opportunity to try it in Mathematica 10 now. However, in the new MM version it does work indeed! – P.B. May 25 '16 at 18:45
• Why do you write Print[Show[i, points, ImageSize -> 350]]? Try dropping the Print; do you not get the same result? – m_goldberg May 26 '16 at 13:48