This page is a part of CVprimer.com, a wiki devoted to computer vision. It focuses on low level computer vision, digital image analysis, and applications. It is designed as an online textbook but the exposition is informal. It geared towards software developers, especially beginners, and CS students. The wiki contains mathematics, algorithms, code examples, source code, compiled software, and some discussion. If you have any questions or suggestions, please contact me directly.

# Centroid

Centroid of an object (in either binary images or gray scale images) is the center of mass of a lamina of the same shape as the object.

The centroid is a point in the image and it is also a pair of numbers = coordinates of this point.

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?

The centroid of each object appears in the output table of Pixcavator. Download the free Pixcavator Student Edition here.