Efficient Solution of Otsu Multilevel Image Thresholding: A Comparative Study

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 21

See discussions, stats, and author profiles for this publication at: https://www.researchgate.

net/publication/327455440

Efficient Solution of Otsu Multilevel Image Thresholding: A Comparative


Study

Article  in  Expert Systems with Applications · February 2019


DOI: 10.1016/j.eswa.2018.09.008

CITATIONS READS

36 2,492

2 authors, including:

Mahmoud Elbayoumi
Fayoum University
11 PUBLICATIONS   50 CITATIONS   

SEE PROFILE

Some of the authors of this publication are also working on these related projects:

Multithreaded Binary Decision diagrams View project

Smart Grid, Renewable Energy and Distributed Generation View project

All content following this page was uploaded by Mahmoud Elbayoumi on 23 September 2018.

The user has requested enhancement of the downloaded file.


Efficient Solution of Otsu Multilevel Image Thresholding: A Comparative Study

Mohamed H. Merzban 1,∗, Mahmoud Elbayoumi1

Abstract

Multi-level thresholding of a gray image is one of the basic operations in computer vision, with applications in
image enhancement and segmentation. Various criteria for the selection of threshold level values were proposed.
One of these criterion is the Otsu criterion that uses maximization of between-class variance approach. Although
applying multi-level thresholding to an image is a straightforward operation, computation of the threshold levels with
Otsu criterion is a computationally expensive process. In this paper, we revisit a dynamic programming algorithm
that provides exact and efficient solution to the problem and compare it with modern meta-heuristic algorithms. We
provide a rigorous proof for the correctness of the algorithm. The algorithm computational cost is linear in the number
of threshold levels. We compare the algorithm with state of the art algorithms and verify its superior performance.
The experiments show that we could gain speedup up to 2.45×.
Keywords: Computer vision, image segmentation, multilevel thresholding, Otsu Criterion.

1. Introduction

Image thresholding has been widely used as a basic operation in various areas of computer vision . It is usually
utilized as a simple and efficient segmentation algorithm (Dora et al., 2017; Djerou et al., 2012). Although binary
thresholding is the most widely used approach, adaptive multi-level thresholding can offer more flexible segmentation
5 In adaptive multilevel thresholding, The image gray levels histogram is computed, then the gray levels are classi-
fied into two or more clusters based on one or more thresholds (Huang et al., 2011) respectively. There are two major
approaches to image thresholding (Huang et al., 2011): parametric approach (Chini et al., 2017) and non-parametric
approach (Yin, 1999). In parametric approach, a statistical model is used to fit the gray level distribution of an image.
In nonparametric approach, the optimal thresholds are selected by a certain criterion given that the number of thresh-
10 olds is known. In other words, the number of thresholds is pre-determined or determined by an optimization technique
(Muangkote et al., 2017). There are many criteria used to determine the optimal threshold values. For example, Otsu’s
between-class variance (Otsu, 1979), Kapur entropy (Kapur et al., 1985), Tsallis entropy (Rajinikanth et al., 2018) and
Renyi entropy (Sarkar et al., 2016) are some of the commonly used criteria for multilevel thresholding. Entropy-based
approaches maximize the entropy (which may have different definitions) to measure the homogeneity of the classes.
∗ Corresponding author
Email addresses: mhm00@fayoum.edu.eg (Mohamed H. Merzban ), mam09@fayoum.edu.eg (Mahmoud Elbayoumi )
1 Electrical Engineering Department, Faculty of Engineering, Fayoum University, Fayoum, Egypt, 63514

Preprint submitted to Elsevier July 4, 2018


15 In Otsu’s approach, The optimal threshold values are those that maximize the variance between clusters. For
L gray level and K thresholds the complexity of naive exhaustive search is O(LK ) (Yin, 1999). In other words,
the computational time grows exponentially with the number of thresholds. Therefore, a careful implementation
of the optimization algorithm is crucial to obtain the optimal solution in adequate time. In (Liao et al., 2001), the
authors reduced the computational cost by precomputation of some common terms in the algorithm. An exact and
20 deterministic solution to the problem was proposed in (Luessi et al., 2006) which has linear running time in the number
of thresholds.
Enormous amount of recent research investigates the utilization of meta-heuristic techniques to mitigate this seem-
ingly hard optimization problem. For example, bio-inspired approaches are used to optimize the targeted criteria
using genetic algorithm (GA) (Cao et al., 2008), particle swarm optimization (PSO) (Li et al., 2017), ant colony
25 optimization (ACO) (Tao et al., 2007), wind driven optimization (WDO) (Nagaraj et al., 2018), honey bee mating op-
timization (HBMO) (Jiang et al., 2016), cuckoo search (CS) (Suresh & Lal, 2016) and electromagnetism optimization
(EMO)(Oliva et al., 2014), harmony search (HS) (Suresh & Sakthi, 2018), differential evolution (DE)(Muangkote
et al., 2017), artificial bee colony (ABC) (Bhandari et al., 2015), firefly algorithm (FFA)(Brajevic & Tuba, 2014),
bacterial foraging optimization (Dehshibi et al., 2017), social spiders optimization (Ouadfel & Taleb-Ahmed, 2016) ,
30 flower pollination algorithm (Wang et al., 2015), artificial bee colony (ABC) (Horng & Jiang, 2010), hybrid differen-
tial evolution (Mlakar et al., 2016).
Those techniques improve the computation time for practical values of K thresholds in different applications (i.e.,
biomedical (Staal et al., 2004) and satellite imaging (Zhao et al., 2016)). However, they are only used for offline
processing of the images. They are computationally expensive to be used in real time with frame-rate. For real-time
35 image processing, iterative thresholding techniques are proposed (Mala & Sridevi, 2016). However, they are based on
greedy approaches whose solution quality gets deteriorated as the number of threshold levels increases.
In (Liao et al., 2001), the computational cost was reduced by precomputing common terms in the optimization
criterion. An exact solution for the problem of multilevel threshold selection according to Otsu’s criteria was proposed
in (Luessi et al., 2006) employing the concepts of dynamic programming. In this technique, The problem is divided
40 into subproblems and each subproblem is solved recursively. The solution is obtained by combining solutions of those
subproblems. The technique was extended to other entropy-based approaches in (Luessi et al., 2009).
The contribution of this paper is to revisit the exact solution provided by the algorithm in (Luessi et al., 2006) for
the calculation of the multilevel threshold levels according to Otsu’s criterion. We propose a modified Otsu criterion
whose solution is the same as the original Otsu criterion. The optimization problem is reformulated in a recursive
45 manner as a sequence of steps. We provide a rigorous proof for the algorithm. We conducted many experiments on
different publicly available datasets to compare the accuracy of state of the art algorithms to the revisited algorithm,
and to assess the running time advantage of the revisited algorithm over many modern algorithms.
This paper is organized as follows: Otsu’s formulation for the multilevel thresholding problem is introduced in
Section 2. In Section 3, the mathematical foundations of the exact solution algorithm and its proof of correctness
2
50 are presented. In Section 4, the revisited algorithm is outlined with complexity analysis and an illustrative exam-
ple. Results are presented in Section 5. Finally, The Discussion and Conclusion are provided in Section 6 and 7
respectively.

2. Adaptive Multilevel Image Thresholding employing Otsu Criterion

For an image represented in L gray levels 0, 1, . . . , L−1, we could construct the image histogram H = { f0 , f1 , . . . , fL−1 },
where fi is the occurrence frequency of gray level i in the image. Let N = i=0
PL−1
55 fi be the total number of pixels in the
image. The ith gray level occurrence probability is given by:

fi
pi = (1)
N
pi = 1. Otsu’s method segments the image into K + 1 clusters
PL−1
It can be easily be shown that pi ≥ 0 and i=0

{C0 , C1 , . . . , C K } using K thresholds selected from the set T = {(t1 , t2 , . . . , tK )|0 < t1 < t2 < . . . < tK < L} where Ck
is the set of gray levels {tk , tk + 1, . . . , tk+1 − 1}. We define t0 = 0 and tK+1 = L. For each cluster Ck , the cumulative
60 probability wk and mean gray level µk are given by:

X
wk = pi (2)
i∈Ck
X i ∗ pi
µk = , k ∈ {0, 1, . . . , K} (3)
i∈Ck
wk

The whole image mean intensity µT and the between-class variance σ2B are given by

K
X L−1
X
µT = wk ∗ µk = i ∗ pi (4)
k=0 i=0

and

K
X K
X
σ2B = wk ∗ (µk − µT )2 = wk ∗ µ2k − µ2T (5)
k=0 k=0

In Otsu’s approach, threshold levels for a given number of clusters are selected based on maximizing the separation
between cluster means (Huang et al., 2011). Therefore, the optimal thresholds can be determined by maximizing the
65 between-class variance as:

(t1∗ , . . . , tK∗ ) = arg max {σ2B (t1 , t2 , . . . , tK )} (6)


(t1 ,t2 ,...,tK )∈T

3
3. Modified Otsu Criterion

In this section, a modified formulation of Otsu’s criterion is presented such that its global optimum solution is
the same as the original Otsu’s criterion. Secondly, the proposed modified Otsu’s criterion is reformulated into a
recurrence form. Finally, a proof-of-correctness is provided for the proposed recurrence form.
70 First, µ2T in Eq. (5) is a constant term for a given image. Accordingly it could be eliminated without changing the
solution of Eq. (6). In addition the first term in Eq. (5) is simplified as follows:

K K P
X X 1 i∈Ck i ∗ fi 2
wk ∗ µ2k = wk ( )
k=0 k=0
N wk
K
Ptk+1 −1 2
1 X ( i=tk i ∗ fi )
= ∗ Ptk+1 −1 (7)
N k=0 fi
i=tk

Similarly, 1/N is constant term for a given image and hence it could be eliminated from Eq. (7). Let’s define the
modified between-class variance as:

K
X
σ2BM = Q(tk , tk+1 ) (8)
k=0

Where Q is defined as:

Ptk+1 −1 2
( i=tk i ∗ fi )
Q(tk , tk+1 ) = Ptk+1 −1 (9)
i=tk fi
75 Accordingly, the optimal threshold values are obtained by optimizing the modified between-class variance as
follows

(t1∗ , . . . , tK∗ ) = arg max {σ2B (t1 , t2 , . . . , tK )}


(t1 ,t2 ,...,tK )∈T

= arg max {σ2BM (t0 , t1 , . . . , tK )} (10)


(t1 ,t2 ,...,tK )∈T

Now, we define a recursive formulation to the objective function σ2BM . Define the function P(k, t) as:





 Q(0, t) ∀0 ≤ t ≤ L − K


k=1




P(k, t) = 

(11)

max P(k − 1, s) + Q(s, t) ∀k − 1 ≤ t ≤ L − K + k − 1






 k−1≤s<t

k>1


Now, we redefine the optimization criterion in Eq. (8) to a recursive form. First we state the following Lemma:
4
Lemma 1. P(k, t) satisfies the following statement:
k
X
P(k, t) = max Q(t j−1 , t j ) ∀k ≤ t ≤ L − K + k − 1 (12)
∀1≤t1 <...<tk−1
j=1

where t0 = 0 and tk = t.

80 Proof. by induction we have a base case at k = 2

• Base case (k = 2 )
2
X
max Q(t j−1 , t j ) = max Q(0, t1 ) + Q(t1 , t) = max Q(0, t1 ) + Q(t1 , t)
∀1≤t1 ∀1≤t1 ∀1≤t1
j=1

= max P(1, t1 ) + Q(t1 , t) = P(2, t)


∀1≤t1

• Induction step ( k > 2)

Assume that
k−1
X
P(k − 1, tk−1 ) = max Q(t j−1 , t j ) (13)
∀1≤t1 <...<tk−2
j=1

where t0 = 0.

For case k:

k
X k−1
X
max Q(t j−1 , t j ) = max Q(t j−1 , t j ) + Q(tk−1 , tk )
∀1≤t1 <...<tk−1 1≤t1 <...<tk−1
j=1 j=1
k−1
X
= max max Q(t j−1 , t j ) + Q(tk−1 , tk )
tk−1 1≤t1 <...<tk−2
j=1

Using the expression of P(k − 1, tk−1 ) from Eq. (13)


k
X
max Q(t j−1 , t j ) = max P(k − 1, tk−1 ) + Q(tk−1 , tk ) = P(k, tk )
1≤t1 <...<tk−1 tk−1
j=1

It is to be noted that:
K+1
X
P(K + 1, L) = max Q(t j−1 , t j ) (14)
∀1≤t1 <...<tK
j=1

85 Where tK+1 = L.
Now, we state the following theorem which formulates the optimization problem of Eq. (10) in a recursive manner.

5
Theorem 1. Let the thresholds t1∗ , t2∗ , . . . tK∗ be defined recursively by:

tK∗ = arg max{P(K, tK ) + Q(tK , L)} (15)


K≤tK <L


tK−1 = arg max {P(K − 1, tK−1 ) + Q(tK−1 , tK∗ )}
K−1≤tK−1 <tK∗

..
.

t1∗ = arg max{P(1, t1 ) + Q(t1 , t2∗ )}


1≤t1 <t2∗

The set of thresholds t1∗ , t2∗ , . . . tK∗ is a solution to the optimization problem of Eq. (10).

(t1∗ , . . . , tK∗ ) = arg max {σ2B (t1 , t2 , . . . , tK )}


(t1 ,t2 ,...,tK )∈T

Proof. Let σ∗2


BM be an optimal solution to the optimization problem of Eq. (8), then using Eq. (14) we can write:

K
X
σ∗2
BM = max Q(tk , tk+1 ) = P(K + 1, L) = max P(K, tK ) + Q(tK , L)
1≤t1 <t2 <...<tK K≤tK
k=0

Using the definition of tK∗ , we can write:

σ∗2
BM = P(K, tK ) + Q(tK , L)
∗ ∗

= max P(K − 1, tK−1 ) + Q(tK−1 , tK∗ ) + Q(tK∗ , L)


K−1≤tK−1

= P(K − 1, tK−1

) + Q(tK−1

, tK∗ ) + Q(tK∗ , L)

By continuing in the same fashion, we show that:

σ∗2
BM = max P(K − 1, tK−1 ) + Q(tK−1 , tK ) + Q(tK , L)
∗ ∗
K−1≤tK−1

= P(K − 1, tK−1

) + Q(tK−1

, tK∗ ) + Q(tK∗ , L)
..
.
K
X
= P(1, t1∗ ) + Q(tk∗ , tk+1

)
k=1
K
X
= Q(tk∗ , tk+1

)
k=0

90 This proves the theorem.

6
4. Iterative Multilevel Thresholding Algorithm

In this section, the algorithm in (Luessi et al., 2006) is outlined and its complexity analysis is conducted. Finally,
an illustrative example of the algorithm is presented.

95 4.1. The Revisited Algorithm


The revisited algorithm is outlined in Fig. 1. The algorithm calculates P(k, t)-functions defined recursively in Eq.
(11) for each k from 1 to K and for each gray level t from k to L − K + k − 1. The values of P(k, t) are saved in an array
P[k][t]. The algorithm initializes all elements of P array to −1 (line 2).
The calculation of P(1, t) is straightforward, while the calculation of P(k, t) for given k and t involves search for

100 a maximizer tk−1 for the maximization problem in Eq. (11), The maximizer is found by examining all s values. The
value of P(k − 1, t) was calculated previously and saved in the array P[k − 1][t]. The value of the optimal threshold

tk−1 is calculated for each t and saved in an array prev[k][t].
For the binary thresholding case (K = 1), the number of clusters is two and hence there is one threshold only (i.e.,
t1 ). Accordingly, the algorithm computes Q(0, t) for t from 1 to L − 1 (Eq. 11) and stores those value in the first row
105 of P array (lines 4-6). Note that in binary case there is only one threshold, and hence, there is not any meaningful
threshold before t1 . Therefore, prev[0][t] will not be used.
In multilevel thresholding case (K > 1) (lines 7-17), the algorithm iterates over k from 2 to K (line 7). For each k,
It computes P(k, t) function defined in Eq. (11) by iterating over every possible value for t from k to L − 1 (line 8). It

stores the maximum possible value for P(k, t) and its corresponding tk−1 (lines 11-14).
110 After finishing the nested loops (lines 7-17), the maximum of modified Otsu’s criterion (Eq. 8) is computed (lines
18-26). Finally the optimum threshold values are extracted from prev array (lines 27-31).

4.2. Complexity Analysis


Referring to Fig. 1, The time complexity of the first loop (lines 4-6) is O(L). In addition, the time complexity of the
main nested loops (lines 7-17) is computed with the following procedure. First, the outer k loop iterates for K −1 times
115 (line 7). The tk and tk−1 loops (line 8-9) iterate for O(L2 ). Accordingly, the time complexity is O(KL2 ). Moreover, the
time complexity of the calculation of modified Otsu’s criterion (lines 18-26) is O(L). Finally, the time complexity for
threshold values extraction from prev array (lines 27-31) is O(K). Therefore, the overall time complexity is dominated
by the nested loops (lines 7-17) which is O(KL2 ). The extra-memory needed to store P-functions and prev array is
O(KL).
120 The revisited algorithm time complexity is polynomial. This disproves the claims that determination of optimal
Otsu multilevel thresholds is of exponential time cost(Yin, 1999).

4.3. An Illustrative Example


The following example is used to demonstrate the algorithm. Let L = 12 (in typical gray images L = 256) and
K = 2, and fi is as depicted in Fig. 2.
7
1: Let P[K][L] and prev[K][L] be new arrays
2: P[k][t] ← −1, ∀k ∈ {0, 1, . . . , K − 1} and ∀tk ∈ {0, 1, . . . , L − 1} . // initialization
3: Prev[k][t] ← −1, ∀k ∈ {0, 1, . . . , K − 1} and ∀tk ∈ {0, 1, . . . , L − 1}
4: for ∀t1 ∈ {1, . . . , L − K} do . // Binary Case (K = 1)
5: P[0][t1 ] ← Q(0, t1 )
6: end for
. // Multilevel Case (K > 1)
7: for k ∈ {2, . . . , K} do
8: for tk ∈ {k, . . . , L − K + k − 1} do
9: for tk−1 ∈ {k − 1, . . . , tk − 1} do
10: nOb j = P[k − 2][tk−1 ] + Q(tk−1 , tk )
11: if nOb j > P[k − 1][tk ]) then
12: P[k − 1][tk ] = nOb j
13: prev[k − 1][tk ] = tk−1
14: end if
15: end for
16: end for
17: end for
18: Let σ∗BM ← −1
19: Let tK∗ ← 0
20: for tK ∈ {K, . . . , L − 1} do
21: nOb j = P[K − 1][tK ] + Q(tK , L)
22: if nOb j > σ∗BM then
23: σ∗BM = nOb j
24: tK∗ = tK
25: end if
26: end for
. // extracting optimal thresholds
27: Let T = {tK∗ }
28: for k ∈ {K − 1, . . . , 1} do
29: tk∗ = prev[k][tk+1

]
30: T = {tk∗ } ∪ T
31: end for
32: return T

Figure 1: Iterative DP Otsu’s Algorithm


8
(a) Initial step

(b) Iterative step

(c) Final step

Figure 2: Algorithm example (L = 12, K = 2).

125 4.3.1. Initialization (step 1)


The algorithm starts with initializing the first row of array P for all values from t1 = 1 . . . 10 (lines 4 - 6 in Fig. 1).
(0×6)2 (0×6+1×17)2
For example, P[0][1] = 6 = 6 and P[0][2] = 6+17 = 12.565. The remaining values of P[0] row are depicted
in Fig. 2a.

4.3.2. Iterative step (step 2)


130 In this step, the algorithm iteratively computes the maximum possible value for P[1][t1 ] for t1 = 2 . . . 11. For
t1 = 2, we only have one possible max, that is P[1][2] = P[0][1] + 1 × 172 /17 = 17. For t1 = 3, we have two possible
2 2
values, the first value P[0][1] + (1×17+2×30)
17+30 = 126.149 and the second value is P[0][2] + (2×30)
30 = 132.565. The second
value (maximum of both values) is stored in P[1][3] and the index 2 is stored in prev array. The algorithm continues
with t1 = 4 with three possible values for maximum. The remaining possible values for each value of t1 is depicted
135 in Fig. 2b. If K > 2, the algorithm repeats this step and stores the maximum value for P(k, tk ) and the index of the
previous tk−1 that contributes to this maximum.

9
4.3.3. Computing objective function (step 3)
Finally, in order to find the maximum value for the objective function, the algorithm iterates on the last row of P
matrix. First, it computes Q(t2 , L)∀t2 = 2 . . . L − 1 as depicted in Fig. 2c. Secondly, the maximum sum is determined
140 according to Eq. (15) as shown in Fig. 2c. Finally, in order to obtain the threshold values, the algorithm backtracks
using the prev array from last to first row. In this example, the threshold values are 3, 6.

5. Results

The revisited algorithm is implemented in C++ and compiled with g++ under -O3 option. The experiments
run under Ubuntu 17.04 with 12GB memory and 2.4GHz Intel core i3. The experiments are designed to assess the
145 performance of the algorithm as follows:

• Qualitatively by using selected images from different publicly available data sets and comparing the resulting
segmented images of the revisited algorithm against other techniques.

• Quantitatively by measuring time speedup gained from the revisited algorithm over other state-of-the-art multi-
level thresholding techniques. In addition, as the revisited algorithm is an exact approach, other algorithms are
150 benchmarked against it to evaluate their quality.

5.1. Comparison Approach

In order to show the versatility of the revisited algorithm, it is compared against state-of-the-art metaheuristic-
based multilevel thresholding algorithms. Metaheuristic algorithms are chosen to cover major applications that utilize
multilevel thresholding (i.e., satellite, medical, and general-purpose applications). In order to obtain a fair compar-
155 ison, metaheuristic-based algorithms are implemented with C++ and compiled with g++ under -O3 option. The
metaheuristic algorithms are as follows:

• Hybrid cooperative–comprehensive learning based PSO algorithm (HCOCLPSO) (Maitra & Chatterjee, 2008)
(this approach is applied in general-purpose thresholding domain).

• Dynamic-context cooperative quantum-behaved particle swarm optimization (CCQPSO)(Li et al., 2015) (this
160 approach is applied in bio-medical domain).

• Cuckoo search with Mantegna Method (CSM) (Agrawal et al., 2013).

• Cuckoo search with McCullen Method(CSCM)(Suresh & Lal, 2016) (this approach is applied in satellite imag-
ing domain).

• Modified Artificial bee colony (MABC) (Bhandari et al., 2015).

10
165 The setting parameters for the metaheuristics multilevel thresholding are depicted in Table [1]. We use the same
setting parameter used in (Maitra & Chatterjee, 2008; Li et al., 2015; Agrawal et al., 2013) and (Suresh & Lal, 2016)
in order to get a reasonable quality for the meta-heuristic algorithms.

Table 1: Setting parameters of the metaheuristic-based algorithms

Algorithm Parameter Value

number of Particles 20

max. particle velocity 6

max. inertia weight 0.9

HCOCLPSO inertia slope 2.5 × 10−4

stagnation limit 3

population replace 10

selection probability 0.2

αinit 1
CCQPSO
α f inal 0.5

CSM & CSCM alien discovery rate 0.25

5.2. Data sets

In order to demonstrate the applicability of the revisited algorithm to different domains, data sets are used to cover
170 major applications of multilevel thresholding:

• Berkeley Segmentation Data Set and Benchmarks 500 (BSDS500) (Arbelaez et al., 2011) (data set is used for
general purpose thresholding applications).

• USC-SIPI Image Database (Weber, 1997) (Ariel data subset is used to represent satellite data).

• Digital Retinal Images for Vessel Extraction (DRIVE) data set (Staal et al., 2004) (data set is used to represent
175 biomedical data).

The statistics of benchmarks are depicted in Table [2]. The first column contains the name of the benchmark.
The second column contains number of images in each benchmark set. Finally, the third column contains the size (in
pixels) of each image. The data sets contains various sizes from 256 × 256 to 2250 × 2250. All colored images are
converted to gray images before being processed with multilevel algorithms.

11
Table 2: Benchmarks statistics

Benchmark No. of Im- Size (pixels)


ages

BSDS500 500 481 × 321

39 512 × 512
Textures
25 1024 × 1024

12 512 × 512

Aerials 25 1024 × 1024

1 2250 × 2250
USC-SIPI
14 256 × 256

Misc. 26 512 × 512

4 1024 × 1024

59 256 × 256
Sequences
10 512 × 512

DRIVE 40 565 × 584

180 5.3. Qualitative Analysis

In order to qualitatively illustrate the robustness of the revisited technique, two different images from two different
data sets are segmented, one with low number of segments and the other with high segmentation value. First, we
choose an image from BSDS500 as depicted in Fig. 3. Fig 3a and Fig. 3b illustrate the original image and its
histogram respectively. The image is segmented with K = 15 with the revisited algorithm in Fig. 3c. Fig 3d-3h
185 illustrate the output of the chosen state-of-the art algorithms used for comparison.
Second, to qualitatively show the robustness in high-level thresholding values in different application (satellite
image segmentation), image from Ariel subset in USC-SIPI is used as depicted in Fig. 4. Fig 4a and Fig. 4b illustrate
the original image and its histogram respectively. The image is segmented with K = 63 with the revisited algorithm
in Fig. 4c. Fig 4d-4h illustrate the output of the chosen state-of-the art algorithms used for comparison.
190 By naked eye, it is noted that, in both cases (Fig. 3 and 4), the segmented images with the revisited iterative
dynamic programming algorithm (Itr-DP) preserve more details than all other segmented images from metaheuristics
approaches. Accordingly, the quality of solution is improved by Itr-DP algorithm and could be recognized even
visually.

12
(a) Original image (b) Original image histogram (c) Iterative DP segmented im- (d) HCOCLPSO segmented im-
age age

(e) CCQPSO segmented image (f) CSM segmented image (g) CSCM segmented image (h) MABC segmented image

Figure 3: Segmentation results for mountains image (K = 15).

5.4. Performance Analysis


195 Since the revisited algorithm always provides optimal results in terms of Otsu criterion. Its resulting threshold
level values are used as a reference to assess the optimality of other algorithms. We calculate the resulting thresholds
of each image in the datasets using various thresholding techniques. The average error eav from exact threshold level
values are calculated for each data set at low levels (No. of segments varies from 2 to 16) and high levels (No. of
segments varies from 20 to 64). The average error is defined as

v
u
K
t
1 X c ∗2
eav = (t − t )
K k=1 k k

200 Where tkc is the calculated threshold from the evaluated algorithm, and tk∗ is the optimal threshold level determined
using the revisited algorithm. For each approach, each experiment runs 1000 and eav is computed in each run and then
averaged over the 1000 experiments.
13
(a) Original image (b) Original image histogram (c) Iterative DP segmented image (d) HCOCLPSO segmented im-
age

(e) CCQPSO segmented image (f) CSM segmented image (g) CSCM segmented image (h) MABC segmented image

Figure 4: Segmentation results for Ariel image (K = 63).

In Fig. 5, the quality of the results using state of the art techniques is presented. For low level, CCQPSO has
smaller eav than CSCM (Fig. 5a). This behavior changed in high level (Fig. 5b) after 24 segments. On the other hand,
205 The average error is almost the same for HCOCLPSO and CSM (Fig. 5e and 5f) on DRIVE data set. meanwhile, they
are larger difference between both techniques for USC-SIPI data set. For USC-SIPI and BSDS500, HCOCLPSO and
MABC (Fig. 5a and 5d) have almost the same eav in high-level thresholding case. This is behavior is due to random
nature of metaheuristics.
In general, the average error increases with number of segments, this is because the search space become larger and
210 metaheuristic approaches stall on local optimal solution. Therefore, the solution of those approaches gets deteriorated
with increased segments number. This is not the case for the revisited algorithm as it always find the exact optimum.
The revisited algorithm (Itr-DP) has been assessed quantitatively for different data sets and different state-of-the-
art techniques as illustrated in Fig. 6. For each approach, each experiment runs 1000 and average run time is computed
over the 1000 experiments. Due to high range of data, we have used log scale on the veritical axis in Fig. 6. Fig 6a
215 and 6b depict the average runtime for data set BSDS500 for low-level and high-level thresholding respectively. For
low-level thresholding (number of segments varies from 2 to 16), CCQPSO was the only technique with close run time
to Itr-DP up to 9 segments. In addition, Itr-DP outperforms it at 8 segments case. After 9 segments Itr-DP is always
faster than all other techniques. The smallest speedup gained at 16 segments is 2.1× compared to CCQPSO. For

14
high-level thresholding (number of segments varies from 20 to 64 with an increment of 4), Itr-DP always outperforms
220 other techniques with smallest speed-up gain of 3× at 64 segments compared to the second best algorithm (CSCM).
In all cases, MABC has the largest run time.
Average runtime for USC-SIPI for low-level and high-level thresholding are depicted in Fig 6c and 6d. For low-
level thresholding in Fig. 6c, Itr-DP is superior to most of the other algorithms up to K = 7 and superior to all of
them after K = 7. In Fig 6d, Itr-DP is superior to all other techniques for high values of K. The speedup gain is
225 up to 2.3× with the best performance obtained from other techniques (CSCM). For high-level thresholding, Itr-DP
always outperforms other techniques with smallest speed-up gain of 2.51× at 64 segments compared to the second
best algorithm (CSCM).
Average runtime for DRIVE for low-level and high-level thresholding are depicted in Fig 6e and 6f. For low-level
thresholding in Fig. 6e, Itr-DP is superior to most of the other algorithms up to K = 7 and superior to all of them after
230 that. In Fig 6f, Itr-DP is superior to all other techniques for high values of K. The speedup gain is up to 2.45× with
the best performance obtained from other techniques at 64 segments.
The runtime trend is almost a straight line for Itr-DP with a small slope and small fluctuation. Meanwhile, there
are many fluctuation in the performance of other techniques. This is because the randomness behavior of the meta-
heuristic approaches in general. On the other hand, our technique is deterministic and obtain threshold level values in
235 determinstic number of steps.

15
(a) BSDS500 average error (low levels). (b) BSDS500 average error (high levels).

(c) USC-SIPI average error (low levels). (d) USC-SIPI average error (high levels).

(e) DRIVE average error (low levels). (f) DRIVE average error (high levels).

Figure 5: Optimal thresholds average error for different benchmarks.

16
(a) BSDS500 run time (low levels). (b) BSDS500 run time (high levels).

(c) USC-SIPI run time (low levels). (d) USC-SIPI run time (high levels).

(e) DRIVE run time (low levels). (f) DRIVE run time (high levels).

Figure 6: Running time for different benchmarks.

17
6. Discussion

The revisited algorithm is distinguished from the competing algorithms in many aspects. First, it computes the
exact optimum of Otsu’s criterion in polynomial time (i.e., O(KL2 )). In addition, based on the conducted experiments,
the revisited algorithm running time is superior to state of the art meta-heuristic approaches in most cases. In other
240 words, the average speedup gained from the revisited algorithm was up to 2.45× in many cases. In the worst cases, the
revisited algorithm performance is very close to the best performance obtained from other state of the art techniques
while obtaining optimum results. Moreover, unlike meta-heuristic-based multilevel thresholding approaches, the
performance of the revisited algorithm is consistent. In other words, the performance does not depend on the statistics
of the image under test. Furthermore, unlike meta-heuristic-based multilevel thresholding approaches, the revisited
245 algorithm does not need any parameter selection and tuning in order to avoid stagnation and premature convergence. In
addition, unlike meta-heuristic-based multilevel thresholding approaches, the revisited algorithm is not application-
dependent. In other words, when one meta-heuristic-based algorithm is able to find the global optimum for one
application, it does not necessarily mean that it would be the best approach to find the global optimum for another
application. However, the revisited algorithm guarantee obtaining the optimal threshold values regardless of the data
250 set.
This work is distinguished from other approaches based on dynamic programming as follows: first, in (Luessi
et al., 2006),(Liao et al., 2001) and (Luessi et al., 2009) authors assumed the correctness of their recursive formula.
However, we provided a rigorous proof for the recursive Otsu’s formula. In addition, we proposed a modified Otsu’s
criterion in order to remove unnecessary calculations. Meanwhile, (Luessi et al., 2006) and (Luessi et al., 2009) used
255 a simple version of modified Otsu’s criterion which have some redundant calculations. Furthermore, unlike other
dynamic programming approaches, we conducted our experiments on various datasets from many applications and
compared our approach with state of the art meta-heuristics approaches.

7. Conclusion

In this paper, we have revisited an exact, scalable and polynomial time algorithm for multilevel thresholding
260 based on Otsu’s approach. First, an equivalent modified formulation of Otsu’s criterion was developed. Second,
a recursive reformulation of the modified Otsu criterion was proposed. Third, a dynamic programming technique
was utilized to efficiently reduce the computation time by iteratively resuing the solutions of the sub-problems of the
recursive modified Otsu’s problem. In addition, we provided a proof of correctness for the revisited algorithm. We
have compared the revisited algorithm to the state of the art techniques on different data sets from different domains.
265 The experiments showed that 2.45× speedup gained with the revisited algorithm compared to the best performance
obtained from other state of the art techniques while obtaining an exact solution.

18
References

Agrawal, S., Panda, R., Bhuyan, S., & Panigrahi, B. K. (2013). Tsallis entropy based optimal multilevel thresholding using cuckoo search algorithm.
Swarm and Evolutionary Computation, 11, 16–30.
270 Arbelaez, P., Maire, M., Fowlkes, C., & Malik, J. (2011). Contour Detection and Hierarchical Image Segmentation. IEEE Trans. Pattern Anal.
Mach. Intell., 33, 898–916.
Bhandari, A. K., Kumar, A., & Singh, G. K. (2015). Modified artificial bee colony based computationally efficient multilevel thresholding for
satellite image segmentation using Kapur’s, Otsu and Tsallis functions. Expert Systems with Applications, 42, 1573–1601.
Brajevic, I., & Tuba, M. (2014). Cuckoo search and firefly algorithm applied to multilevel image thresholding. In Cuckoo search and firefly
275 algorithm (pp. 115–139). Springer.
Cao, L., Bao, P., & Shi, Z. (2008). The strongest schema learning GA and its application to multilevel thresholding. Image and Vision Computing,
26, 716–724.
Chini, M., Hostache, R., Giustarini, L., & Matgen, P. (2017). A hierarchical split-based approach for parametric thresholding of sar images: Flood
inundation as a test case. IEEE Transactions on Geoscience and Remote Sensing, 55, 6975–6988.
280 Dehshibi, M. M., Sourizaei, M., Fazlali, M., Talaee, O., Samadyar, H., & Shanbehzadeh, J. (2017). A hybrid bio-inspired learning algorithm for
image segmentation using multilevel thresholding. Multimedia Tools and Applications, 76, 15951–15986.
Djerou, L., Khelil, N., Dehimi, N. E. H., & Batouche, M. (2012). A Multilevel Thresholding Method Based on Multiobjective Optimization for
Non-Supervised Image Segmentation. In Multidisciplinary Computational Intelligence Techniques: Applications in Business, Engineering, and
Medicine (pp. 182–201). IGI Global.
285 Dora, L., Agrawal, S., Panda, R., & Abraham, A. (2017). State-of-the-art methods for brain tissue segmentation: A review. IEEE reviews in
biomedical engineering, 10, 235–249.
Horng, M.-H., & Jiang, T.-W. (2010). Multilevel image thresholding selection using the artificial bee colony algorithm. In International Conference
on Artificial Intelligence and Computational Intelligence (pp. 318–325). Springer.
Huang, D.-Y., Lin, T.-W., & Hu, W.-C. (2011). Automatic multilevel thresholding based on two-stage Otsu’s method with cluster determination by
290 valley estimation. International journal of innovative computing, information and control, 7, 5631–5644.
Jiang, Y., Yeh, W.-C., Hao, Z., & Yang, Z. (2016). A cooperative honey bee mating algorithm and its application in multi-threshold image
segmentation. Information Sciences, 369, 171–183.
Kapur, J. N., Sahoo, P. K., & Wong, A. K. C. (1985). A new method for gray-level picture thresholding using the entropy of the histogram.
Computer vision, graphics, and image processing, 29, 273–285.
295 Li, Y., Bai, X., Jiao, L., & Xue, Y. (2017). Partitioned-cooperative quantum-behaved particle swarm optimization based on multilevel thresholding
applied to medical image segmentation. Applied Soft Computing, 56, 345–356.
Li, Y., Jiao, L., Shang, R., & Stolkin, R. (2015). Dynamic-context cooperative quantum-behaved particle swarm optimization based on multilevel
thresholding applied to medical image segmentation. Information Sciences, 294, 408–422.
Liao, P.-S., Chen, T.-S., Chung, P.-C. et al. (2001). A fast algorithm for multilevel thresholding. J. Inf. Sci. Eng., 17, 713–727.
300 Luessi, M., Eichmann, M., Schuster, G. M., & Katsaggelos, A. K. (2006). New results on efficient optimal multilevel image thresholding, . (pp.
773–776).
Luessi, M., Eichmann, M., Schuster, G. M., & Katsaggelos, A. K. (2009). Framework for efficient optimal multilevel image thresholding. Journal
of Electronic Imaging, 18, 013004.
Maitra, M., & Chatterjee, A. (2008). A hybrid cooperative–comprehensive learning based PSO algorithm for image segmentation using multilevel
305 thresholding. Expert Systems with Applications, 34, 1341–1350.
Mala, C., & Sridevi, M. (2016). Multilevel threshold selection for image segmentation using soft computing techniques. Soft Computing, 20,
1793–1810.
Mlakar, U., Potočnik, B., & Brest, J. (2016). A hybrid differential evolution for optimal multilevel image thresholding. Expert Systems with
Applications, 65, 221–232.

19
310 Muangkote, N., Sunat, K., & Chiewchanwattana, S. (2017). Rr-cr-IJADE: An efficient differential evolution algorithm for multilevel image
thresholding. Expert Systems with Applications: An International Journal, 90, 272–289.
Nagaraj, Y., Madipalli, P., Rajan, J., Kumar, P. K., & Narasimhadhan, A. (2018). Segmentation of intima media complex from carotid ultrasound
images using wind driven optimization technique. Biomedical Signal Processing and Control, 40, 462–472.
Oliva, D., Cuevas, E., Pajares, G., Zaldivar, D., & Osuna, V. (2014). A multilevel thresholding algorithm using electromagnetism optimization.
315 Neurocomputing, 139, 357–381.
Otsu, N. (1979). A threshold selection method from gray-level histograms. IEEE transactions on systems, man, and cybernetics, 9, 62–66.
Ouadfel, S., & Taleb-Ahmed, A. (2016). Social spiders optimization and flower pollination algorithm for multilevel image thresholding: a perfor-
mance study. Expert Systems with Applications, 55, 566–584.
Rajinikanth, V., Fernandes, S. L., Bhushan, B., Sunder, N. R., & Others (2018). Segmentation and Analysis of Brain Tumor Using Tsallis Entropy
320 and Regularised Level Set. In Proceedings of 2nd International Conference on Micro-Electronics, Electromagnetics and Telecommunications
(pp. 313–321). Springer.
Sarkar, S., Das, S., & Chaudhuri, S. S. (2016). Hyper-spectral image segmentation using Rényi entropy based multi-level thresholding aided with
differential evolution. Expert Systems with Applications, 50, 120–129.
Staal, J., Abràmoff, M. D., Niemeijer, M., Viergever, M. A., & Van Ginneken, B. (2004). Ridge-based vessel segmentation in color images of the
325 retina. IEEE transactions on medical imaging, 23, 501–509.
Suresh, K., & Sakthi, U. (2018). Robust Multi-thresholding in Noisy Grayscale Images Using Otsu’s Function and Harmony Search Optimization
Algorithm. In Advances in Electronics, Communication and Computing (pp. 491–499). Springer.
Suresh, S., & Lal, S. (2016). An efficient cuckoo search algorithm based multilevel thresholding for segmentation of satellite images using different
objective functions. Expert Systems with Applications, 58, 184–209.
330 Tao, W., Jin, H., & Liu, L. (2007). Object segmentation using ant colony optimization algorithm and fuzzy entropy. Pattern Recognition Letters,
28, 788–796.
Wang, R., Zhou, Y., Zhao, C., & Wu, H. (2015). A hybrid flower pollination algorithm based modified randomized location for multi-threshold
medical image segmentation. Bio-medical materials and engineering, 26, S1345—-S1351.
Weber, A. G. (1997). The usc-sipi image database version 5. USC-SIPI Report, 315, 1–24.
335 Yin, P.-Y. (1999). A fast scheme for optimal thresholding using genetic algorithms. Signal processing, 72, 85–95.
Zhao, X., Turk, M., Li, W., Lien, K.-c., & Wang, G. (2016). A multilevel image thresholding segmentation algorithm based on two-dimensional
K–L divergence and modified particle swarm optimization. Applied Soft Computing, 48, 151–159.

20

View publication stats

You might also like