This site is devoted to mathematics and its applications. Created and run by Peter Saveliev.

# Centroid

Centroid of an object (in either binary images or gray scale images) is the point around which the object is equally distributed. It is the center of mass of a lamina of the same shape as the object.

The object can be balanced on a single support if it located at the centroid.

The centroid of several objects and the whole image can also be computed.

The centroid is a point in the image and it is also a pair of numbers = coordinates of this point. But since we treat pixels as tiles (see Cell decomposition of images), this point does not have to be a pixel. The center of mass of a pixels lies in the middle of the pixel. The center of mass of two adjacent pixels, however, lies in the middle of the edge they share (or the vertex).

What does "centroid" have to do with the "center"? If the center for a given object makes sense in the first place (like circle, rectangle, star, anything with a central symmetry), then

```centroid = center.
```

The center of mass of an object takes into account the gray level within the image. So:

```centroid = center of mass in binary images;
centroid != center of mass in gray scale images, generally.
```

Exercise. Does the centroid of an object always fall within the boundary of the object? Answer: No (even though in this case it can't, in the literal sense, be "balanced on a single support if it located at the centroid").

It shown in Pixcavator's output table under "Location". To experiment with the concepts, download the free Pixcavator Student Edition.

To see how this can be applied, browse our numerous image analysis examples.

Exercise. Does the centroid of a lamina always fall within the area of a lamina? What about the center of mass?