You are on page 1of 5

An Expanded Histogram Approach for Multilevel Image Thresholding

MK Quweider
CIS Department, University of Texas, Brownsville
Brownsville, Texas 78520, USA
Mahmoud.quweider@utb.edu

Abstract for each given gray level based on a measure of local


In this paper a new image thresholding technique is activity. The formed histogram is then passed to an optimal
proposed based on expanding the histogram of the image to partitioning on an interval algorithm that uses a cost
accommodate spatial-related information in the form of a function for its partitioning. For our cost function we define
variance map of every gray level present in the image. The a new entropy-based cost function that incorporates the
expanded histogram along with the variance levels are fed variance of pixels with respect to their neighbors. We
introduce the expanded histogram and the cost function
into a thresholding finding algorithm based on partitioning
models in section 2; section 3 presents the algorithm in
the interval (histogram) in an optimal way using dynamic
detail. Section 4 presents image simulation results along
programming with an entropy-based cost function.
with a comparative study with many current and popular
Compared with many existing methods, simulations on a methods. Conclusion and future work are given in section
range of images show good results. The effectiveness of the 5.
algorithm is shown even in the presence of low to moderate
additive Gaussian noise levels.
2. Image thresholding model
1. Introduction 2.1 Expanded histogram generation
Thresholdinng is common and popular technique for image
segmentation. Its popularity stems from its intuitive
interpretation, simplicity, ease of implementation, and low
computational cost. The technique has found numerous
applications in computer vision, image processing, expands
to 4 new
original

levels
Each

automatic inspection, and medical imaging diagnosis,


level
gray

among many others.

Many of the thresholding techniques produced over the past


fifty years are reviewed in the literature [1-4]. Most of these Figure 1. Original and expanded histogram
techniques try either to optimize an objective function, or to
have a desired property among the pixels of a common As shown in figure 1, the original histogram of the image is
region. Among these methods, the histogram based, entropy firs generate and then expanded into a one-dimensional
based, and error minimization based methods are the most histogram with 4-times the original size. Each gray level,
common ones [1-7]. To enhance the performance of image with its corresponding count, is broken into four gray
thresholding, many authors try to incorporate information levels. The original count of the gray level, say l, gets
related to the spatial adjacency or proximity of pixels to distributed into the new gray levels (4*l, 4*l +1, 4*l +2, 4*l
each others. Such measures enhance global thresholding by +3) based on a 2-dimensional variance image σ2(i,j). The
using local information to classify neighboring pixels or variance image is created based on the 8-connected
pixels with a common property as belonging to the same neighbors of a central pixel at (i,j). The 3x3neighborhood is
region or object. This information is most useful when shown in figure 2. The 4-times expansion factor is based on
dealing with images that have varying object to background experimental results and a compromise between
ratios or when dealing with textured regions. performance and computational complexity. Other factors
can be used as well. For example, we can double the size of
In this paper, we propose a new approach to image the original histogram, or we can devise an adaptive
thresholding by creating an expanded 1-D histogram that expansion mechanism of a gray level based on the total
incorporates local information in the form of local variance variance associated with that level as decided by the
of pixels of a given intensity or gray level value. The variance image. The expanded histogram is then used to
expanded histogram creates a set of four pseudo gray levels find the threshold value of interest. For this, we elected to

978-1-4244-5353-5/10/$26.00 ©2010 IEEE 109

Authorized licensed use limited to: Sethu Institute of Technology. Downloaded on July 06,2010 at 07:14:33 UTC from IEEE Xplore. Restrictions apply.
use a newly introduced optimal partitioning algorithm, the threshold that will divide the image into object and
described in [7] that intelligently searches the space of the background as dictated by the cost function, which is
histogram to find the threshold in an optimal way as we discussed next.
describe in the next section.
2.3 Cost function
2.2 Optimal partitioning on an interval
In this paper, we redefine the histogram-based entropy to
We can pose the problem of finding the optimal threshold incorporate spatial information about the image in the form
within the histogram as a problem of optimal partitioning of of a measure that reflects the activity of each gray level. To
the histogram, denoted here as R, into a set of two uniform do this, we use the following measure for entropy
regions R0 and R1 such that:
∪R
i = 0 ,1
i = R and R0 ∩ R1 = φ , using an appropriate cost
SpatialEnt ropy = SE ( H ) =
l = L −1

∑− p l log( p l / m l ) (2)
l =0
function. The optimal partitioning algorithm should find In the above equation, ml is a busyness or activity
this threshold based on the cost function. A partition here is weighting factor. The inclusion of this factor allows for
defined as a set of one or more contiguous gray levels inclusion of spatial information and makes thresholding less
(block) from the histogram that are similar with respect to dependent on the size of objects or background present in
the cost function. A cost function, C(Ri), is associated with the image. Several approaches can be used to define this
each region or partition with the overall cost over the factor; in this paper, we define ml as a measure that uses a
histogram R denoted as C(R) being the sum of the costs of local neighborhood around a central pixel as shown in
the partitions. This can be expressed as follows: figure 2.
M −1
C ( R) = ∑ C ( Ri ) (1)
i =0

Jackson, Scargle and others [7-12], have recently developed


a dynamic programming technique that solves this problem
in O (L2) where L is the length of the histogram to be
partitioned. Associated with each partition is a cost
function. The algorithm searches the exponentially large
space of partitions of L data points in time O (L2). The cost
function required by the algorithm must be additive with
the cost of the total signal being the sum of the costs of its Figure 2. 3x3 neighborhood for variance definition
subintervals or partitions. The algorithm is guaranteed to
find the exact global optimum, automatically determines the One important observation for our thresholding problem is
model order (the number of thresholds) and has a the fact that the cost function has the desired property of
convenient real-time mode. The algorithm is discussed in depending only on the sum of all the gray levels present in
detail in the references and we only give a summary of it an interval and the number of cells in that interval which is
within the context of our edge detection model: called sufficient statistic.

Step 0: Decide the cost function C 3. Algorithm


Step 1: Set optimal (-1) =0; set n=0
Step 2: Given optimal (j) for j=0, 1, …, n Based on the new expanded histogram model, dynamic
• Compute optimal (n+1) as given in [7], for j=0, partitioning of an interval and the choice of the entropy-
1,…, n+1 based cost function, we introduce the thresholding
• Keep track of j, where maximum occurred as algorithm as given in figure 3. The algorithm created the
lastChange(n+1) original histogram and the 2-D variance image in the
• Set n = n+1 preprocessing stage. The expanded histogram is created
• If n=L Stop with information from the variance image. The entropy cost
Step 3: Extract the threshold location as: function is defined based on the expanded histogram. The
Th = Th 0 = lastChange ( L −1 ) two objects are used as inputs for the optimal partitioning,
which produced the optimal threshold value. This value is
As we can see from the third step, the threshold location is then used to quantize the original image into two levels as
traced back in reverse order. The change point is essentially follows:

978-1-4244-5353-5/10/$26.00 ©2010 IEEE 110

Authorized licensed use limited to: Sethu Institute of Technology. Downloaded on July 06,2010 at 07:14:33 UTC from IEEE Xplore. Restrictions apply.
⎧ q0 0 ≤ I(i,j) < T0 [10-11]. Deciding the prior is usually done in ad hoc
Q 2 (i , j ) = ⎨ (3)
⎩ 1 0 I(i,j) < 4 L − 1
q T ≤ fashion depending on the application at hand.
Note that the output (two-level) image uses the expanded
gray levels to create the binary image. Some of these gray 4. Simulation results
levels will split as object and background even though they
have come from the same original gray level l. In this section, and due to space limitation, we present the
thresholding results only for the case of two quantization
levels (i.e. binarization). In testing the effectiveness of our
algorithm, we have obtained excellent results for images of
low and high details. The results of testing our algorithm on
the Lena image and the F-16 images are shown in figure 4.
We have also compared our algorithm with five popular
and current techniques [1-3] as shown in figure 6. Close
inspection of the resulting images show that our algorithm
does a good job in reproducing most of the details around
700

600

500

400

300

the edges. Our algorithm has shown robustness to different


200

100

0 50 100 150 200 250

levels and types of noise as well. Figure 5 (a-c) shows a


corrupted Lena image with Gaussian noise of zero mean
and standard deviation of 10, 20, and 40 respectively; the
output images are shown in parts (d-f). Again, in evaluating
the images subjectively, we can see that the algorithm
succeeds in producing an acceptable binary version of the
image under both levels of noise. Some of the noise
artifacts can easily be eliminated using post processing
operations including morphological and point ones. The
complexity of the algorithm is O ((4L)2) and is similar to
that presented in [11] with two additions: the expansion of
the histogram by factor 4; and the cincorporation of the
Figure 3. Complete algorithm flow diagram
spatial information through the spatially-based cost
function.
Following are the general steps for the algorithm

1. Create the original histogram and the variance image. 5. Conclusion


2. Generate the expanded histogram with each gray level
splitting to four gray levels according to the variance We presented a new thresholding algorithm based on
image. dynamically partitioning an expanded version of the image
3. Feed the expanded histogram with the entropy cost histogram. The algorithm incorporates the image spatial
function to the optimal partitioning dynamic information when generating the expanded histogram and
programming algorithm in creating an entropy-based cost function that has a local
4. The produced change point is treated as the threshold variance weighting factor. Experimental results show that
value. the produced thresholded images are very good, especially
5. Produce thresholded image using the expanded gray when compared with many current existing methods. The
levels. algorithm is also robust under low to moderate levels of
additive Gaussian noise (and is expected to do produce
Since the original optimal partitioning algorithm is similar results under other noise types such as the salt and
designed to produce many change points (thresholds), we pepper one). We are currently working on some related
have used a third parameter called the prior to force only issues such as applying the algorithm to multi-level
one threshold value. The prior, as was originally designed, thresholding techniques, and to other cost functions that can
implicitly determines the number of classes that we feel an incorporate spatial information of the image. An exhaustive
image has a priori. Large values give smaller number of study of the overall computational complexity of the
threshold for the output image. Generally, having an algorithm is also under way.
adjustable prior is very good to have since it allows the
optimal partitioning algorithm to be flexibly used for multi- 6. References
level thresholding and quantization application as we did in

978-1-4244-5353-5/10/$26.00 ©2010 IEEE 111

Authorized licensed use limited to: Sethu Institute of Technology. Downloaded on July 06,2010 at 07:14:33 UTC from IEEE Xplore. Restrictions apply.
[1]. P. K. Sahoo, S. Soltani, and A. K. C. Wong, “A survey of Bayesian blocks: a new method to analyze structure in
thresholding techniques,” Comput. Vis. Graph. Image photon counting data,” The Astrophysical Journal, vol. 504,
Process., vol. 41, pp. 233–260, 1988. pp. 405-418, 1998.
[2]. N. R. Pal and S. K. Pal, “A review on image segmentation [9]. R. Vidal, “Optimal partition of an interval,” Applied
techniques,” Pattern Recognit., vol. 26, pp. 1277–1294, Sep. Simulated Annealing, Springer-Verlag, New York, pp. 291-
1993. 314, 1993.
[3]. M. Sezgin and B. Sankur, “Survey over image thresholding [10]. J. Scargle and M.K. Quweider, “Edge Detection Using
techniques and quantitative performance evaluation,” J. Dynamic Optimal Partitioning,” IEEE ICASSP-2006, vol. 2,
Electron. Imaging, vol. 13, pp. 146–168, 2004. pp. 705-708, 2006.
[4]. C. Chang, Y. Du, J. Wang, S. Guo, and P. Thouin, “Survey [11]. M.K. Quweider, J.D. Scargle and B. Jackson, “Grey level
and comparative analysis of entropy and relative entropy reduction for segmentation, thresholding and binarisation of
thresholding techniques,” IEE Proc. Vision, Image and images based on optimal partitioning on an interval,” IET
Signal, vol. 153, pp. 837-850, 2006. Image Process, vol. 1, pp. 103–111, 2007.
[5]. C. E. Shannon, “A mathematical theory of communication,” [12]. R. Bellman, Dynamic Programming, Princeton, University
Bell Syst. Tech. J., vol. 27, pp. 379–423, 1948 Press, Princeton, 1957.
[6]. A. Brink, “Using spatial information as an aid to maximum
entropy image threshold selection,” Pattern Recognition
Letters, vol. 17(1), pp. 29-36, 1996.
[7]. B. Jackson, J. Scargle, et. al. “An algorithm for optimal
partitioning of data on an interval,” IEEE Signal Processing
Letters, vol. 12, pp. 105-108, 2005.
[8]. J. Scargle, “Studies in astronomical time series analysis. V.

a. Original Lena b. Original F-16

c. Thresholded Lena d. Thresholded F-16


Figure 4. (a)-(b) Original images. (c)-(d) Results of thresholding using described method

a b c

978-1-4244-5353-5/10/$26.00 ©2010 IEEE 112

Authorized licensed use limited to: Sethu Institute of Technology. Downloaded on July 06,2010 at 07:14:33 UTC from IEEE Xplore. Restrictions apply.
d e f

Figure 5. (a)-(c) Original Lena image corrupted by noise of 10, 20, and 40 standard deviation respectively. (d)- (f)
Thresholded Lena Image with a 3x3 Gaussian smoothing preprocessing step.

Original Image

a. Otsu method b. Kittler and Illingworth c. Reddi et al.

d. Kapur et al. e. Papamarkos et al. f. Quweider

Figure 6. (a) Original Lena Image. (b)-(f) Results of thresholding the image using the indicated method.

978-1-4244-5353-5/10/$26.00 ©2010 IEEE 113

Authorized licensed use limited to: Sethu Institute of Technology. Downloaded on July 06,2010 at 07:14:33 UTC from IEEE Xplore. Restrictions apply.

You might also like