1
$\begingroup$

I am trying to find the centers of gravity of my particles in a SEM image. I binarized the image (img) and with the input and help of previous suggestions on that topic (Creating graph out of particles images). enter image description here

I managed to compute the centroids and areas and so on.

im = img // ImagePad[#, -0] & // MorphologicalComponents[#, 0.5, CornerNeighbors -> False] & centroid = Values[Select[ComponentMeasurements[im, "Centroid"], #[[1]] > 0 &]]; 

Still I have no idea how to get the center of gravity, since the center of mass is sometimes outside the particles due to their shape. I still want to find the center "inside" the particles to calculate the distance of those center for all particles. Has anybody an idea how to do that?

As you can see the center of mass (red dots) is often outside the particles, thus I would like to get the center of gravity:

enter image description here

Thanks in advance for your input and help!

Edit:

here is the center what I am searching for drawn as a sketch:

enter image description here

$\endgroup$
6
  • 2
    $\begingroup$ Welcome to Mathematica StackExchange! I am a little bit confused by your question. What is the difference between center of gravity and center of mass? These two points usually coincide (unless you have more than one external object, providing a gravitational force, but I don't think this is applicable here). Can you please elaborate your definitions of both terms, or provide some concrete example of where you think the center of gravity should be? Note that there is nothing "wrong" with COG/COM being outside an object. $\endgroup$ Commented Apr 1, 2022 at 11:24
  • $\begingroup$ @Domen Thanks for your answer! Indeed for some particles the COM is outside since they show somehow a bean-like shape (comparable to the COM of a boomerang). Nevertheless I would like to find the geometric center, which is defined by the middle of the two diagonals of the two farthest and nearest points. I tried to draw it in paint to make it more clear and added it to the question since I think my description is somehow confusing :D $\endgroup$ Commented Apr 1, 2022 at 12:03
  • 2
    $\begingroup$ Great, your sketch is informative! However, your definition (middle of the two diagonals ...) is not really well-defined ... :-) Nevertheless, I think you should take a look at SkeletonTransform. Here is my quick example for one bean – I might write a complete answer later. $\endgroup$ Commented Apr 1, 2022 at 14:37
  • $\begingroup$ If you want the overall center of gravity for the entire image (and I agree that isn't at all well-defined), rather than the center of gravity for each "bean", I wonder given the large number of beans and no readily discernable pattern of orientation that it really matters if you use the center of gravity or the center of mass. Both entities much be very close. $\endgroup$ Commented Apr 1, 2022 at 16:23
  • $\begingroup$ Use RegionNearest to find a point in the region that is nearest to the center of mass of the region. If the center of mass is inside the region, you will get the center of mass. If the center of mass is outside the region, this would be on the boundary of the region. $\endgroup$ Commented Apr 1, 2022 at 16:26

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.