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

# Thresholding

In a binary image 0 is black and 1 is white. A gray scale image can represented by an array of numbers between 0 and 1. In practice, however, gray scale images are tables of integers. The integers normally run from 0 (black) to 255 (white).

These numbers together form the gray scale function of the image. An example is on the right. The gray scale function of the image on the left.

The image on the left is accompanied by its gray scale function. Higher means lighter and lower means darker.

Now recall one of the main principles of our approach:

Every image is represented as a combination of binary images.

Thresholding is the following procedure that creates binary images from the gray scale image. We call these images frames:

```Given a number, threshold, T between 0 and 255,
create a T-th frame by replacing all the pixels
with gray level lower than or equal to T with black (0),
the rest with white (1).
```

Observe that thresholds correspond to upper and lower level sets.

Thresholding (with a particular values of T) is the simplest binarization method, i.e., converting a gray scale image to a binary image.

As you raise the threshold, the number of black pixels increases, as in the images above.

Another illustration of thresholding is here . Even though thresholding is the least sophisticated tool of image analysis, often it is sufficient in practice, see Image analysis examples.

Pixcavator allows one to threshold images with sliders. To experiment with the concepts, download the free Pixcavator Student Edition.

The methods of finding the best threshold are the subject of an enormous amount of research. We do not deal with this issue. Instead we threshold the image for each possible value of T and accept the resulting sequence of binary images as a representation of the original. For more on how we use thresholding see Grayscale Images.

Color Images can also be thresholded...

Thresholding creates a filtration which can be rigorously studied with topology by representing the binary images as cubical complexes (right).