Back top previously visited page (this function is disabled)Back to homepage (P)Back to previous page (E)Jump to next page (V)Display terms (this function is disabled)List of terms (this function is disabled)Print this page (this function is disabled)Jump to sitemap (D)Search in current page (this function is disabled)Help (S)

Building Spatial Databases – Theory / Thresholding

Learners guide


Thresholding is the one of the segmentation methods. In this case some threshold values are given, which define the interval boundaries. In this unit these methods will be outlined.


To fill in the self test successfully.


Thresholding is a way of greyscale image segmentation. A few threshold values are given, which define intervals. A special case for thresholding is a two-level thresholding, a binarization where a single threshold value is given, and therefore pixels are sorted into two classes. These have been investigated in the previous chapters.

Though many strategies exist for defining threshold values, it depends on our goal which measurement is a good threshold value. Usually our goal is to define a threshold value where objects are differentiated from the background. Since we have sorted them into two classes, thresholding is not always optimal, although a good threshold does it with the best approximation.

Otsu thresholding

Figure 76. An image histogram has two peaks. A good segmentation creates two classes according to it.

Let us look at Figure 76 displaying the histogram of an image. It is clear that the standard distribution groups around two intensity values, namely the histogram has two peaks. Our goal is to segmentize the image in a way that each peak will contain a segmentation class.

According to Otsu, we receive good classification when the standard deviation is biggest between the two classes. In order to do so, the empirical anticipatable value and the variance value of each pixel of the image have to be calculated.

The variance and anticipatable value of each class with t threshold value is:

The variance within a class is equal to the weighted sum of the variance values of the classes.

The variance between classes is defined as:

Which is:

The optimal variance value is the value that separates the classes in the best way. Since the whole variance is equal to the sum of two variance values, there are two optimal ways to find the variance: one of them is by minimizing the variance value within a class, the other one is maximizing it within a class. If we choose the maximizing method, for each t threshold value, q1(t+1), μ1 (t+1), μ2(t+1) values can be calculated by using q1(t), μ1(t), μ2(t):

In this way, the algorithm can be calculated: calculate P, μ and σ, with interval of t=0 to t=255 for q1 (t), μ1 (t), μ2 (t), and then calculate the σb2 value, finally select toptimal as argmax((σb2).

The result of the Otsu thresholding is described in the figure. The Otsu threshold method can be generalized, namely a multi-level thresholding can be created with the same strategy.

Figure 77. From left to right: Original greyscale image. New image with Otsu thresholding. An image with lighter background, applied by Otsu thresholding. With a predefined threshold value, the first image is well processed, and failed to process on the lighter image.

We will not discuss thresholding problems, as this topic is discussed in other chapters like data mining methods, classification methods, where segmentation algorithms will be thoroughly discussed.

Back to table of contents (J)

Új Széchenyi terv
A projekt az Európai Unió támogatásával, az Európai Szociális Alap társfinanszirozásával valósul meg.

A Társadalominformatika: moduláris tananyagok, interdiszciplináris tartalom- és tudásmenedzsment rendszerek fejlesztése az Európai Unió támogatásával, az Európai Szociális Alap társfinanszírozásával, az ELTE TÁMOP 4.1.2.A/1-11/1-2011-0056 projekt keretében valósult meg.
Generated with ELTESCORM framework