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

# Roundness

### From Mathematics Is A Science

Suppose we want to count nuts and bolts in this image separately. Suppose we have detected and captured these objects. We can find their areas. However, since some of these objects have about the same size in terms of the area, we have to look at their shapes. We want to be able to evaluate shapes of objects and the most elementary way to do it is to compare the area and the perimeter.

We compute the *roundness* of the object (please don't call it compactness).

Roundness = 4π*area/perimeter^{2}

The roundness will tell circles from squares and squares from elongated rectangles, as follows.

Roundness of circle = 1 Roundness of square = .785 Roundness of 1:5 rectangle = .436

The results are independent of resolution. This allows us to evaluate shape separately from size.

In binary images, objects appear as collection of pixels. The result is that **objects are never entirely round**.

The image is an example of computation of roundness with Pixcavator. For convenience we multiply roundness by 100.

For the image on the right we have the following data:

- 1. Large circle: Area = 9047, Roundness = 78
- 2. Large square: Area = 4891, Roundness = 79
- 3. Large square: Area = 4802, Roundness = 79
- 4. Large square: Area = 4761, Roundness = 79
- 5. Smaller square: Area = 2295, Roundness = 79
- 6. Small circle: Area = 1622, Roundness = 78
- 7. Rectangle: Area = 1050, Roundness = 43
- 8. Small square: Area = 840, Roundness = 81
- 9. Ellipse: Area = 647, Roundness = 39

In this image Pixcavator successfully distinguished between circles/squares and elongated objects.

For larger squares the roundness remains the same, while that of larger circles is higher. For example, **a circle of radius 200 has roundness 89**.

As before elongated objects are easily detectable. For example, the roundness of a 200×200 rectangle is 79 while that of 200×270 is 77.

Testing the program with objects of different sizes (up to 650x650) has confirmed the following conclusions:

- Large squares have roundness 79-80.
- Large circles have roundness 89-90.
- Elongated, rough edged, and non-convex objects have low roundness.
- Objects with just a few pixels have high roundness.

In the next, practical example we want to analyze and count these cells, first image. With size limit at 17, all cells are captured but also a lot of noise, second image. We can remove the noise manually, but it's not a good option if we have hundreds of images. A better option is to use the fact that cells are somewhat round. We set the roundness limit at 55 and the result is the last image. (Using the contrast will produce a similar result.)

Roundness is also known as *circularity*, while *compactness* is its reciprocal.

See also Lengths of curves.

**Exercise.** As the relative error of the computation of the perimeter may reach 8% (such as in Pixcavator and ImageJ), what about roundness?

**Exercise.** How can you use roundness to detect semicircles?

Roundness is shown in the Pixcavator's output table.

Some real life examples of applications of roundness are:

To experiment with the concepts, download the free Pixcavator Student Edition.