You are on page 1of 6

Image Thresholding by Histogram Segmentation Using

Discriminant Analysis
Agus Zainal Arifin1 and Akira Asano2
1 Graduate School of Engineering, Hiroshima University
Email : agusza@hiroshima-u.ac.jp
2 Division of Mathematical and Information Sciences,
Faculty of Integrated Arts and Sciences, Hiroshima University
Email : asano@mis.hiroshima-u.ac.jp

Abstract
Image segmentation is often used to distinguish the foreground from the background. This
paper proposes a novel method of image thresholding using the optimal histogram segmentation by the
cluster organization based on the similarity between adjacent clusters. Since this method is not based on
the minimization of a function, the problem of selecting the threshold at the local minima is avoided. This
approach overcomes the local minima that affect most of the conventional methods by maximizing the
between-class and minimizing within-class objects.
Agglomerative clustering is used in this method so as to merge two adjacent clusters in the
histogram. The distance measurement using discriminant analysis is adapted from the criterion function
defined by Otsu. It directly approaches the feasibility of evaluating the goodness of every pair and
automatically grouping the closest pair. The most similar pair is selected, which is the most homogeneous
one. In addition, this pair should be the closest pair in the sense of means distance. All steps are repeated
iteratively until achieving two clusters.
It is straightforward to extend the method to multi-level thresholding problem by stopping the
grouping as the expected segment number is achieved. Results obtained from automatic thresholding of
the experimental images are showing the validity of the method.

1. Introduction
Image segmentation is very essential to image processing and pattern recognition. It leads to
the high quality of the final result of analysis. Image segmentation is a process of dividing an image into
different regions. One of the special kinds of segmentation is thresholding, which attempts to classify
image pixels into one of the two categories (e.g. foreground and background). At the end of such
thresholding, each object of the image, represented by a set of pixels, is isolated from the rest of the scene.
In this case, the aim is to find a critical value or threshold.
The most straightforward approach is to pick up a fixed grayscale value as the threshold and
classify each grayscale by checking whether it lies above or below this value. In general, the threshold

should be located at the obvious and deep valley of the histogram. Especially for a well-defined image, its
histogram has a deep valley between two peaks. Therefore, the optimum threshold value can be found in
the valley region [5]. One extremely simple way to find a suitable threshold is to find each of the modes
(local maxima) and then find the valley (minimum) between them [1].
Theoretically, the optimal threshold value can be determined according to the Bayes rule if we
know the pixel distribution of both classes [1]. What we have in practice, however, is not two separate
distributions, but a mixture of both distributions as shown in the histogram. Therefore it needs some
assumptions about the forms of both distributions to simplify the problem.
There have been some techniques proposed in order to approximate it. One of them
approximates in the least square sense by a sum of Gaussian distribution, which is estimated from the
histogram. We can find a set of parameters to fit the image histogram to the probability models by
minimizing the Mean Square Error between the actual probability density function and the model. An
iterative selection method is used based on the one of nonlinear optimizations [2]. As Such a method,
however, uses as iterative computation, the final solution heavily depends on the initial value.
Many thresholding techniques used the criterion-based concept to select the most suitable gray
scale as the threshold value. One of the oldest methods is Otsus thresholding method that utilizes
discriminant analysis to find the maximum separability of classes [3]. For every possibility of threshold
value, Otsu (1979) evaluated the goodness of this value if used as the threshold. This evaluation includes
the heterogeneity of both classes and the homogeneity of every class.
Kittler and Illingworth (1986) also used criterion-based concept by obtaining the minimum
error threshold between Gaussian distribution used in background and foreground [4]. Criterion-based
methods are effective and efficient for determining a threshold value. However the more the number of
threshold values, become the computation complexity increases exponentially. In addition, the methods
work very well for bimodal or nearly bimodal histogram [5]. For unimodal and multimodal histogram,
however, the separation between both classes is not clear.
In this paper, we proposed a novel method that splitting the image histogram based on the
measurement of similarity between sub clusters of gray levels. As the proposed method is not based on
the minimization of a function, we can avoid the problem of selecting threshold value at local minima [4].

2. Proposed Method
The multi-level thresholding problem is closely related with the clustering problem, which
segmented the image into several classes [6]. The proposed method uses an iterative cluster unification to
develop a dendrogram iteratively until two groups of gray levels are obtained. Initially, it assumed that
each gray level is assigned to a different cluster. If there are K gray levels used in the image, then we can
assume there are K classes, C1, C2, CK, which gray level Tk is contained in Ck, and satisfy T1 <T2 <
<TK. For convenience to describe the parameters, we add T0=0.

Similarity is measured between two adjacent clusters in the histogram to know the closeness
between both cluster distributions. The distance measurement between cluster A and B, DistAB is using
discriminant analysis adapted from the criterion function defined by Otsu. The smaller value of the
distance, the better pair to merge. Therefore, the closest pair is determined as the pair that can be merged.
Since thresholding algorithm can be generalized to deal with the multi-level threshold problem, we can
assume the initial problem as the multi-level threshold problem. Initial parameter values for 1 k K
can be computed as follows :
K

Pn =Pr{Cn}is a priori probability of class n. Note that

P
k =1

= 1.

Pr{z|Cn} is the probability density function of gray level z in class n. The pixel intensity value z is in
the range [0, L1]

The proposed thresholding algorithm is


1.

Begin with K clusters, each consisting of one gray level

Mean value of cluster k, mk = Tk

Pk = h(Tk), where h(z) is the probability density function of z

2.

Repeat step 3-4 a total of K2 times

3.

Compute the distance

Dist k1k2 =

Dist k1k2

between adjacent clusters denoted by k1 and k2 as follows:

Pk1 Pk2 [ mk1 mk2 ]2

(1)

k2 k

1 2

where

k2 k

1 2

M k1k2 =

denotes the total variance of clusters k1 and k2, if both clusters are merged.

Pk1 mk1 + Pk 2 mk2


Pk1 + Pk2

Pk = Pr{Ck } =

(2)

Tk

h( z ) ,

z =Tk -1 +1

(4)

mk =

2
k1k 2

Tk

Tk

zPr{z | C } = P zh( z ) ,
k

z =Tk -1 +1

[z - M ] h( z)
Tk 2

z =Tk1 1 +1

(3)

k z =Tk -1 +1

k1k2

(5)

where M k k denotes the new mean value of cluster k1 and k2, if both clusters are merged.
1 2
4.

Find the most similar clusters ki and kj, where i<j, by choosing the smallest value of the computed
distance. Merge cluster ki and kj to become cluster ki, and assign Tj with Tj+1 for any j>i, and remove
the last T.

At the final step, we will obtain two clusters, with the threshold value denoted by Ti.

3. Experimental Results
To evaluate the performance of the proposed method, we apply blood, rice, and fish images as
shown in Fig. 1(a), (b), and (c), respectively, to Otsus method and the proposed method. Blood and rice
images are the images provided by MATLAB Image Processing Toolbox Demo Program [7]. Each image
had the histogram distribution as shown in Fig. 2(a), (b), and (c), respectively.

(a)

(b)

(c)

Fig. 1. Original images: (a) blood; (b) rice grain; (c) fish.

(a)

(b)

(c)

Fig. 2. Histograms: (a) blood; (b) rice grain; (c) fish.

(a)

(b)

(c)

Fig. 3. Thresholded images using Otsus method: (a) blood; (b) rice grain; (c) fish.

(a)

(b)

(c)

Fig. 4. Thresholded images using the proposed method: (a) blood; (b) rice grain; (c) fish.

We applied the proposed method to three images having different type of histograms. Figures 3
and 4 show comparative results of histogram thresholding process of real images performed by Otsus
method and by the proposed one, respectively. Threshold values determined with respect to each image
are summarized in Table 1.
For the blood image, the thresholded images as shown in Fig. 3(a) and Fig. 4(a) are not so
different, however some cells in Fig. 4(a) appear more clearly than in Fig. 3(a). Since the threshold values
are very close to each other, the thresholded images by using both methods have minor differences.
However, for the rice grain image, Fig. 3(b) has lost some rice grains, which appear in Fig. 4(b). Unlike in
Fig. 3(c), the fish fin and tail are preserved in thresholded image produced by the proposed method, as
shown in Fig. 4(c).

Tabel 1
Threshold values determined using two threshold selection methods.
Tested images

Threshold selection Method


Otsus method

The proposed method

Blood image

109

91

Rice grain image

125

107

Fish image

103

22

From these experimental results, we conclude that the proposed thresholding method provides
better performance, that is the thresholded images corresponding to our intuition than that obtained by
widely used Otsus method, and is useful in the image thresholding.

4. Conclusions
In this paper, we have proposed a novel gray level thresholding algorithm using the cluster
analysis. The optimal threshold is determined based on the similarity between gray levels. Results
obtained from automatic thresholding of the experimental images are showing the validity of the method.
Since this method is not based on the minimization of a criterion function, the problem of selecting the
threshold at the local minima is avoided. It is straightforward to extend the method to multi-level
thresholding problem by stopping the grouping as the expected segment number is achieved.

Reference
[1]

R. C. Gonzalez and R. E. Woods, Digital Image Processing. Addison-Wesley Publishing Company,


1993.

[2]

Z. Chi, H. Yan, T. Pham, Fuzzy Algorithms: with applications to images processing and pattern
recognition. Word Scientific, 1996.

[3]

N. Otsu, A threshold selection method from gray-level histograms, IEEE Trans. Systems, Man,
and Cybernetics, vol. SMC- 9, no. 1, pp. 62-66, 1979.

[4]

J. Kittler and J. Illingworth, Minimum error thresholding, Pattern Recognition, vol. 19, pp. 41-47,
1986.

[5]

O. J. Tobias and R. Seara, Image segmentation by histogram thresholding using fuzzy sets, IEEE
Trans. On Image Processing, vol. 11, pp. 1457-1465, 2002.

[6]

S. H. Kwon, Threshold selection based on cluster analysis, Pattern Recognition Letters, vol. 25,
pp. 1045-1050, 2004.

[7]

The Math Works Inc, Image processing toolbox for use with Matlab, 2001.

You might also like