Content uploaded by Taymaz Akan--R.Farshi
Author content
All content in this area was uploaded by Taymaz Akan--R.Farshi on Oct 15, 2018
Content may be subject to copyright.
Iran Journal of Computer Science
https://doi.org/10.1007/s42044-018-0022-5
ORIGINAL ARTICLE
A multilevel image thresholding using the animal migration
optimization algorithm
Taymaz Rahkar Farshi1
Received: 18 May 2018 / Accepted: 27 July 2018
© Springer Nature Switzerland AG 2018
Abstract
Thresholding is an important and well-known technique that plays a major role in distinguishing the image objects from its
background. In the other hand, separating the images into several different regions by determining multiple threshold values
is called multilevel image thresholding. The Kapur entropy thresholding and maximum between-class variance (Otsu) have
been widely used in image thresholding. However, these methods are computationally expensive and with increase in level
numbers computational complexity increase exponentially. To overcome this problem, this paper presents animal migration
optimization algorithm for multilevel thresholding. For evaluating the efficiency of proposed method, various benchmark
images are used for carrying out the experiments, and obtained results via animal migration optimization algorithm compared
with most popular optimization technique such as Particle Swarm Optimization, Genetic and bacterial foraging algorithm.
Experimental results figure out that the proposed method provides better result than the other tested algorithms.
Keywords Image segmentation ·Multilevel thresholding ·Animal migration optimization ·Kapur’s function ·Otsu’s function
1 Introduction
Segmentation is the fundamental and the basic step in image
processing and generally used in partitioning of images into
meaningful segments and objects. The aim of segmentation
is changing the representation of the images into images that
are meaningful and more simpler for interpreting and analyz-
ing [1]. Generally, in image processing applications, there are
many differences between grey levels of pixels that belong
to the background and those that belong to the foreground
(objects). Thresholding is one of the easiest and well-known
techniques for distinguishing the image objects from its back-
ground. Undoubtedly, image histogram in grey-level images
is a fully effective tool for developing algorithm in the field
of the image thresholding [2]. Dividing images into differ-
ent regions (background and object) by calculating a single
threshold value is known as bi-level thresholding [3], while
separating the images into several different regions by deter-
mining multiple threshold values is called multilevel image
thresholding [4,5].
BTaymaz Rahkar Farshi
taymaz.farshi@altinbas.edu.tr
1Computer Engineering Department, Altinbas University,
Istanbul, Turkey
Histogram of grey-level image is regarded as fully effec-
tive tool in image segmentation algorithm. The aim of
thresholding is determining a proper threshold value in bi-
level thresholding and determining proper multiple threshold
values in multilevel thresholding. The easiest problem is the
bi-level thresholding, where existing peaks represent the dif-
ferent segments, and the valley between the existing peaks
represents the threshold. Each pixel in an image which is
greater than the threshold value is replaced with a white pixel
and considered as an object pixel (foreground). On the other
hand, rest of the pixels that are less than threshold value
are replaced with black pixels and belong to the background
[6]. Moreover, the problem ramp up into more complex by
employing multilevel thresholding. Hence the image will be
segmented into many regions. Then pixels that are in same
range will be placed into a class [7].
In general, determining the exact locations of distinct val-
leys in an image histogram which include multiple peaks
(multimodal histogram) is not easy. A wide variety of algo-
rithms have been proposed in histogram thresholding area
[8–16]; a large number of these algorithms refer to bi-
level thresholding and rest of them address the multilevel
thresholding. Algorithms that are developed for bi-level
thresholding problems (such as Otsu and Entropy) [8,9] can
123
Iran Journal of Computer Science
also be extended to solve multilevel thresholding problems
[17–19].
Optimal thresholds can be determined by analyzing and
evaluating the histogram information or by optimizing cer-
tain and reliable objective function [20,21]. In both of
bi-level and multilevel thresholding, the aim is determining
an accurate threshold or multiple thresholds, respectively.
In the linear search the search process performed by
considering all the elements. Hence, with increasing the
number of thresholds, computational complexity increases
exponentially. This limits the ability of multilevel threshold-
ing algorithms.
Meta-heuristic techniques have been proved to be an effi-
cient tool to solve such problems and they are one of the best
ways to yield optimal solutions and also can be helpful to
overcome these limitations [22]. PSO, Genetic, Firefly Algo-
rithm (FA), Cuckoo search, Artificial Bee Colony (ABC)
and bacterial foraging algorithm (BF), which are the heuris-
tic algorithms, have been applied in multilevel thresholding
[23].
Sathya and Kayalvizhi proposed bacterial foraging algo-
rithm, modified bacterial foraging algorithm and amended
bacterial foraging algorithm for the minimum variance and
maximum entropy criterions [22,24,25]. Moreover, Yin [26]
proposed a particle swarm optimization for the multilevel
minimum cross-entropy criterion; on the other hand, Horng
and jiang [2] applied the firefly optimization algorithm to
optimize minimum cross-entropy criterion. In addition to
the mentioned algorithms, Pal and et al. [27] also proposed
a multilevel thresholding algorithm for the minimum vari-
ance and maximum entropy criterions using Spider Monkey
Optimization Algorithm. Finally, Horng [28] also proposed
a multilevel thresholding algorithm based on ABC algorithm
to optimize the maximum entropy criterion.
Animal migration optimization (AMO) developed by
Xiangtao and et al. is one of the novel heuristic algorithm
[29].AMO is inspired by the animal migration behavior,
which is a widespread phenomenon that can be seen in most
of animal groups. In this study, AMO algorithm is used
to solve the problem of multilevel thresholding for image
segmentation. In the proposed method Otsu’s and Kapur’s
methods are considered as the objective functions. Experi-
mental results are reported and are also compared with some
widely used optimization algorithm for multilevel threshold-
ing.
The paper is structured as follows. Section 2presents
problem formulation. Section 3presents the concepts of ani-
mal migration model and algorithm. Section 4provides the
illustration of the proposed method. Section 5analyzes and
compares the results obtained for the proposed approach and
other methods. Finally, conclusion is presented in Sect. 6.
Fig. 1 The scheme of the local neighbourhood of an individual
2 Problem formulation
In this proposed paper, two most popular methods that were
used for finding optimal threshold on image histogram are
known by the name of Kapur entropy and the between-class
variance (Otsu’s) method. Both of these methods separately
are used for maximizing an objective function [25].
2.1 Entropy criterion method (Kapur’s method)
As stated by Kapur’s method, for bi-level thresholding, the
objective function is represented with the following equation:
J(t1)H0+H1(1)
where
H0−
t1−1
i0
pi
ω0ln pi
ω0,ω
0
t1−1
i0
pi
and
H1−
L−1
it1
pi
ω1ln pi
ω1,ω
1
L−1
it1
pi
Maximization of Eq. (1) is the objective function that
demonstrates grey-level optimal threshold. Here, H0repre-
sents partial entropy of histogram for first segment and H1
is for second segment. Kapur’s entropy criterion method can
also extended for settling problem of multilevel thresholding.
Then, the problem can be turned as a multi-dimensional prob-
lem. Determining all of threshold values can be described
with the following equation:
J(t1,t1,...,tm)H0+H1+H2+···+Hm(2)
123
Iran Journal of Computer Science
Fig. 2 Images used for performance evaluation
Table 1 Control parameters of the optimization algorithms
Algorithm Initial values of control parameters
AMO Neighbourhood length 5,δis a random number
controlled by a Gaussian distribution
PSO Cognitive coefficient (C1and C2)0.88, inertia
weight (W)0.91
GA Roulette selection, CR 0.8, Gaussian Mutation
scale 2shrink1
BF Number of chemotactic steps (Nc) 100,
swimming length (Ns) 3, number of
reproduction steps (Nre) 4, number of
elimination of dispersal events (Ned) 2, step
size(Ci) 5.1, probability of elimination and
dispersal (Ped) 0.25
where
H0−
t1−1
i0
pi
ω0ln pi
ω0,ω
0
t1−1
i0
pi
H1−
t2−1
it1
pi
ω1ln pi
ω1,ω
1
t2−1
it1
pi
H2−
t3−1
it2
pi
ω2ln pi
ω2,ω
2
t3−1
it2
pi
.
.
.
Hm−
L−1
itm
pi
ωmln pi
ωm,ω
m
L−1
itm
pi
2.2 Between-class variance method (Otsu’s method)
As stated by between-class variance (Otsu’s) method, for bi-
level thresholding, the objective function is represented with
the following equation:
J(t1)σ0+σ1(3)
where
σ0ω0(μ0−μT)2and σ1ω1(μ1−μT)2
with
ω0
t1−1
i0
pi,μ
0
t1−1
i0
ip
i
ω0
ω1
L−1
it1
pi,μ
1
L−1
it1
ip
i
ω1
μT
L−1
i0
ip
i,
123
Iran Journal of Computer Science
Table 2 Comparison of best obtained objective and optimal threshold values based on Kapur
Test images No. of thresholds Average fitness value Average optimal threshold values
AMO PSO GA BF AMO PSO GA BF
Cameraman 2 12.2987 12.2802 12.2802 12.2651 125,196 125,196 125,196 125,196
315.4172 15.3880 15.3880 15.3765 43,101,196 44,102,196 44,102,196 44,103,196
418.6073 18.5497 18.5494 18.5080 42,96,145,196 42,96,145,198 42,96,145,197 42,97,145,197
521.3531 21.2613 21.2525 21.2230 41,96,143,191,221 42,96,145,191,222 42,90,133,180,214 26,66,108,153,201
Lenna 2 12.3753 12.3753 12.3464 12.3344 97,164 97,164 97,164 97,164
315.3737 15.3184 15.3184 15.2996 82,127,175 82,126,175 82,126,175 83,127,176
418.1020 18.0079 18.0061 17.9662 73,111, 147,183 66,101,140,181 68,103,141,180 68,102,141,180
520.7592 20.6093 20.6091 20.5042 63,94,127,162,193 63,94,128,163,194 63,94,128,163,194 63,95,128,162,194
Livingroom 2 12.4285 12.4059 12.4059 12.3945 89,170 94,175 94,175 94,175
3 15.5210 15.4056 15.5519 15.5262 49,107,178 60,123,192 47,104,175 48,104,174
4 18.4067 18.2453 18.4679 18.4198 46,100,159,215 47,102,171,230 47,98,149,196 47,98,150,194
521.1718 21.0947 21.1439 21.0683 45,93,139,183,233 47,98,145,188,236 44,87,125,163,199 41,86,125,164,199
Hunter 2 12.0302 12.0033 12.0033 11.9948 114,179 112,179 112,179 112,179
315.0333 14.9748 14.9745 14.9580 86,132,180 86,129,180 86,131,180 87,133,181
417.7674 17.6193 17.6581 17.6032 76,113,149,183 77,115,152,187 76,114,149,183 76,113,148,183
520.1427 20.0197 20.1024 20.0033 73,107,139,171,200 72,105,138,170,205 68,96,125,154,183 67,96,125,156,186
Pepper 2 12.6138 12.5852 12.5852 12.5781 76, 146 77,147 77,147 77,147
315.6802 15.6238 15.6238 15.6158 61,112,163 61,112,164 61,112,164 62,113,165
418.5368 18.5286 18.4608 18.4269 56,99,144,190 52,92,136,182 59,105,149,195 58,105,150,195
521.3175 21.3175 21.1922 21.1447 45,78,114,154,195 45,78,114,154,195 45,78,115,154,195 43,77,116,156,195
Mandrill 2 12.1245 12.1245 12.1245 12.1114 80,143 80,143 80,143 80,143
315.1310 15.1310 15.1309 15.1137 56,104,153 56,104,153 56,104,153 57,105,153
4 17.8940 17.8953 17.8936 17.8589 46,84,122,162 45,82,120,161, 47,85,124,163 45,83,121,161
5 20.5081 20.5084 20.5037 20.4341 40,73,107,139,172 40,73,106,139,172 42,75,108,140,172 38,72,106,141,174
123
Iran Journal of Computer Science
Table 3 Comparison of standard
deviation for Kapur based Test images No. of
thresholds
Standard deviation
AMO PSO GA BF
Cameraman 2 5.4202e−15 3.6450e−15 3.6450e−15 0.0987
3 1.6113e−05 9.1125e−15 9.1125e−15 0.0523
4 0.000031 3.6450e−15 4.2827e−04 0.0706
5 3.0161e−04 3.6450e−15 0.0232 0.0640
Lenna 2 0.0022 3.6450e−15 3.6450e−15 0.1082
3 0.0117 0 0 0.0985
4 0.0072 0.0092 0.0079 0.0876
5 3.4142e−04 0 3.7072e−04 0.0884
Livingroom 2 5.4202e−15 5.4675e−15 5.4675e−15 0.0948
3 0.2346 0.2500 0.0013 0.0906
4 0.1465 0.0972 0.0040 0.0654
5 0.0202 7.2900e−15 0.0031 0.0541
Hunter 2 1.8067e−15 0 0 0.0819
3 7.5814e−04 0 3.4816e−04 0.0745
4 3.6134e−15 0.1208 0.0012 0.0810
5 0.0705 0.0836 0.0085 0.0621
pepper 2 0 5.4675e−15 5.4675e−15 0.0650
3 9.0597e−05 0 3.7205e−06 0.0435
4 0.0145 0.0161 5.0796e−04 0.0290
5 3.7449e−15 1.0840e−14 0.0011 0.0275
Mandrill 2 5.4675e−15 5.4675e−15 5.4675e−15 0.1055
3 9.1125e−15 9.1125e−15 1.7303e−04 0.0874
4 0.0021 0.0021 0.0023 0.0663
5 4.6559e−04 3.6450e−15 0.0048 0.0585
here μTis the mean of the whole image intensity, it is for-
mulated in following equation:
ω0μ0+ω1μ1μTand ω0+ω11
Like entropy criterion (Kapur’s) method, between-class
variance (Otsu’s) method can also be extended for settling
problem of multilevel thresholding, then the problem can be
tuned as a multiple dimension problem. Determining all of
threshold value can be described as Eq. (4):
J(t1,t2,...,tm)σ0+σ1+σ2+···+σm(4)
where
σ0ω0(μ0−μT)2
σ1ω1(μ1−μT)2
σ2ω2(μ2−μT)2
.
.
.
σmωm(μm−μT)2
with
ω0
t1−1
i0
pi,μ
0
t1−1
i0
ip
i
ω0
ω1
t2−1
it1
pi,μ
1
t2−1
it1
ip
i
ω1
.
.
.
ωm
L−1
itm
pi,μ
m
L−1
itm
ip
i
ωm
In both of Otsu and Kapur methods, there are constrains
which are defined as:
t1<t2<t3<···<tm.
123
Iran Journal of Computer Science
Table 4 Comparison of PSNR and SSIM for Kapur based
Test images Number of
thresholds
Standard deviation
AMO PSO GA BF
PSNR SSIM PSNR SSIM PSNR SSIM PSNR SSIM
Cameraman 2 13.7753 0.5146 13.7753 0.5146 13.7753 0.5146 13.7753 0.5146
3 14.3070 0.6019 14.4263 0.6046 14.4263 0.6046 14.5417 0.60701
4 20.1555 0.6637 20.1555 0.6637 20.1633 0.6636 20.2167 0.66456
5 20.1686 0.6707 20.2799 0.6628 20.0774 0.6480 21.4091 0.68342
Lenna 2 14.5859 0.52382 14.5859 0.52382 14.5859 0.52382 16.838 0.51895
3 17.2232 0.6231 15.7096 0.62779 17.2244 0.62506 18.9112 0.61391
4 18.6493 0.67944 19.4767 0.69249 18.8699 0.67877 20.8974 0.64346
5 19.856 0.70838 19.7569 0.70255 19.8211 0.70712 22.2527 0.65467
Livingroom 2 14.631 0.49419 14.5962 0.48312 14.5962 0.48312 14.5962 0.48312
3 17.2887 0.60866 16.9132 0.57559 17.1987 0.61413 17.2845 0.61542
4 18.2184 0.64196 10.8862 0.38196 19.1671 0.66974 19.22 0.66957
5 19.8144 0.68587 19.6189 0.6816 21.2505 0.72583 21.0899 0.72317
Hunter 2 13.1492 0.3477 13.2331 0.35289 13.2331 0.35289 13.2331 0.35289
3 16.1986 0.48296 16.2147 0.48668 16.1971 0.48375 16.1222 0.48013
4 17.8826 0.56959 17.7638 0.56322 17.894 0.56994 17.9166 0.57187
5 18.4828 0.59193 18.5315 0.59075 19.2596 0.63065 19.3138 0.63115
Pepper 2 16.4554 0.58523 16.4435 0.58126 16.4435 0.58126 16.4435 0.58126
3 18.3578 0.65889 18.3578 0.65889 18.3578 0.65889 18.3571 0.65832
4 20.397 0.69456 20.397 0.69456 19.1435 0.68261 19.1194 0.68263
5 21.3492 0.74725 21.3492 0.74725 21.3756 0.74773 21.3604 0.74863
Mandrill 2 16.1789 0.61377 16.1789 0.61377 16.1789 0.61377 16.1789 0.61377
3 19.1587 0.72407 19.1587 0.72407 19.1587 0.72407 19.2053 0.72503
4 21.0974 0.77348 21.0733 0.77163 21.0668 0.77425 21.0887 0.77336
5 22.7607 0.82299 22.7317 0.82299 22.8556 0.825 22.5138 0.8171
123
Iran Journal of Computer Science
Table 5 Comparison of best obtained objective and optimal threshold values based on Otsu
Test images No. of thresholds Average fitness value Average optimal threshold values
AMO PSO GA BF AMO PSO GA BF
Cameraman 2 3.6098e+03 3.6098e+03 3.6039e+03 3.5985e+03 69,144 69,144 70,144 70,144
3 3.6765e+03 3.6774e+03 3.6774e+03 3.6735e+03 59,119,155 56,115,153 56,115,153 56,115,153
43.7325e+03 3.7325e+03 3.7324e+03 3.7264e+03 41,94,139,169 41,94,139,169 43,95,139,169 42,93,139,169
5 3.7617e+03 3.7631e+03 3.7624e+03 3.7544e+03 36,85,125,152,175 35,82,121,148,172 40,85,123,149,172 34,83,122,149,172
Lenna 2 1.9618e+03 1.9618e+03 1.9618e+03 1.9563e+03 92,152 92,152 93,151 93,151
32.1379e+03 2.1379e+03 2.1283e+03 2.1236e+03 79,125,172 79,125,172 81,127,171 81,126,171
42.2103e+03 2.2103e+03 2.1918e+03 2.1845e+03 74,112,145,177 74,112,145,177 75,114,145,180 74,114,145,179
5 2.2176e+03 2.2178e+03 2.2177e+03 2.2085e+03 73,108,136,160,188 73,109,136,160,188 71,105,133,157,186 70,107,134,160,189
Livingroom 2 1.6280e+03 1.6280e+03 1.6273e+03 1.6196e+03 86,145 86,145 87,145 87,145
31.7747e+03 1.7747e+03 1.7594e+03 1.7510e+03 73,123,164 73,123,164 76,123,163 75,123,163
41.8600e+03 1.8593e+03 1.8281e+03 1.8178e+03 48,91,132,168 48,92,133,168 56,97,132,168 56,97,132,168
51.9158e+03 1.9150e+03 1.8709e+03 1.8583e+03 47,86,123,151,182 47,87,124,152,182 51,89,121,148,179 45,86,120,146,177
Hunter 2 1.9962e+03 1.9962e+03 1.9945e+03 1.9907e+03 87,143 87,143 86,141 86,141
32.1396e+03 2.1396e+03 2.1153e+03 2.1114e+03 70,116,158 70,116,158 71,114,155 71,113,155
42.2643e+03 2.2443e+03 2.1697e+03 2.1653e+03 46,83,124,163 54,93,133,168 67,106,140,172 68,106,141,174
52.2006e+03 2.2006e+03 2.2006e+03 2.1935e+03 62,93,122,150,181 62,93,122,150,181 63,93,122,150,180 62,94,123,151,181
Pepper 2 2.4715e+03 2.4715e+03 2.4695e+03 2.4616e+03 66,135 66,135 69,136 69,136
32.6555e+03 2.6555e+03 2.6367e+03 2.6339e+03 61,118,167 61,118,167 64,119,166 64,119,167
42.7308e+03 2.7302e+03 2.6983e+03 2.6943e+03 53,90,130,175 50,88,128,173 48,86,126,170 48,87,126,169
52.7425e+03 2.7425e+03 2.7424e+03 2.7364e+03 43,79,113,146,177 43,79,113,146,177 44,80,113,146,177 44,78,113,147,178
Mandrill 2 1.3673e+03 1.3673e+03 1.3673e+03 1.3588e+03 98,148 98,148 98,148 98,148
31.4546e+03 1.4546e+03 1.4546e+03 1.4472e+03 86,124,159 86,124,159 86,124,159 86,124,159
41.5039e+03 1.5039e+03 1.5039e+03 1.4946e+03 73,106,135,165 73,106,135,165 73,106,135,165 73,106,135,165
5 1.5282e+03 1.5286e+03 1.5285e+03 1.5164e+03 68,98,123,146,171 69,100,125,148,172 69,100,125,148,172 66,96,122,146,171
123
Iran Journal of Computer Science
Table 6 Comparison of standard
deviation for Otsu based Test images No. of
thresholds
Standard deviation
AMO PSO GA BF
Cameraman 2 1.8501e−12 1.8501e−12 1.3997e−12 44.2376
3 1.7373 53.9406 1.8662e−12 15.9253
4 0.0120 9.3312e−13 0.1830 10.8050
5 0.9896 4.6656e−13 0.8725 7.1871
Lenna 2 9.2504e−13 9.2504e−13 2.3328e−13 51.8123
3 1.3876e−12 1.3876e−12 0 23.8312
4 1.8352e−12 1.8501e−12 4.6656e−13 15.3602
5 0.3689 0.3160 0.6278 9.8940
Livingroom 2 6.9378e−13 6.9378e−13 6.9984e−13 64.2211
3 9.2504e−13 9.2504e−13 0 35.7859
4 0.1456 3.6995 0.0154 21.6782
5 2.3126e−13 1.5258 0.2647 14.1206
Hunter 2 9.2504e−13 9.2504e−13 2.3328e−13 31.9147
3 9.2504e−13 9.2504e−13 0 14.4766
4 12.6234 32.1884 0.0024 7.1271
5 0.0940 0 0.1160 6.5958
Pepper 2 9.2504e−13 9.2504e−13 0 71.8040
3 1.1012e−15 0 4.6656e−13 14.4440
4 0.4845 1.8383 0.0945 10.1671
5 0.1946 0.9984 0.1275 4.5501
Mandrill 2 4.6656e−13 4.6656e−13 4.6656e−13 73.1514
3 4.6656e−13 4.6656e−13 4.6656e−13 32.4821
4 4.6656e−13 4.6656e−13 0.0069 17.6939
5 0.5030 4.6656e−13 0.0370 12.4319
3 Animal migration model and algorithm
The animal migration optimization algorithm is a new
meta-heuristic population-based optimization algorithm,
which is inspired by the natural animal migration behavior.
This algorithm consists of two processes. The first process is
simulation of moving animals to new position from current
position (migration process). For this motion there are three
essential rules that should be obeyed by each individual: (1)
the neighbours must move in the same direction; (2) keep dis-
tance between neighbours and (3) overlapping of neighbours
should be avoided. The latter process of algorithm simulates
leaving and joining interaction of animals in the group (pop-
ulation updating process). In this algorithm two simple ideas
are considering:
1. The animal with the best objective function value is con-
sidered as the leader, and its position is preserved in next
generation.
2. Size of population is fixed, and a new member will be
replaced with the existing animal probability pa. There-
fore, an animal is leaving from the group and a new one
will be joining instead of the leaving one.
Assume that the faced problem is a global optimization
problem and there are populations of candidate individu-
als. The individual is denoted as a multi-dimensional real
coded vector. Like other swarm-based optimization algo-
rithms, AMO also starts with a randomly initial population of
candidate. So, initialization of jth component from ith vector
defined as:
xj,i,0xj,min + randi,j[0,1]×xj,max −xj,min,(5)
where randi,j [0, 1] is a random number with uniformly dis-
tribution between 0 and 1, i1, …, Nand j1, …, D. where
Ndenotes the population size.
As it was mentioned earlier, the algorithm consists of two
processes: migration and updating process. As it mentioned
123
Iran Journal of Computer Science
before for obeying the first rule in the migration process,
position of all individual group members should be differ-
ent. For the rest rules, all individual group members should
be moves to a new position under consideration of current
position of their neighbours. Ring topology has been applied
to determine local neighbourhood of an individual. Scheme
of the ring topology has been illustrated in Fig. 1.
In this algorithm, the topology of the neighbourhood is
as static and based on the indices set of vectors. Because
of easiness, the neighbourhood length for all dimensions of
each individual is set to five. In this case, for the ith index,
indices of neighbourhood animal are i−2, i−1, i,i+ 1 and
i + 2 as it is clear from Fig. 1. The first animal is the neighbor
of the last animal and vice versa. So the indices of neighbours
of first animal are 1, 2, 3, Nand N−1. When the topology of
the neighbourhood has been constructed, one of neighbour
will be selected randomly and the individual position will be
updated according to this neighbour, as it is formulated in the
equation:
xi,G+1 xi,G+δ×xneighborhood,G−xi,G(6)
where xneighborhood,Gis the current position of the neighbour-
hood and δis depend on the problems. In the original paper of
AMO, δis a random number which is generated by Gaussian
distribution. During the process of population updating, some
animals leave the group, and then instead of those, some new
animal join in the population. Population size must be fixed,
so the number of the existing members cannot be changed
in any iteration performed. A new animal that desires to join
the group must be placed instead of an animal that has left
the group depending on a probability value . The probability
is related to fitness value. For the animal with the highest
fitness value probability Pa is 1 and for the animal with the
smallest fitness value probability, Pa is 1/N.
The pseudocode of this process is illustrated as follows:
where r1,r2are two randomly selected integers between
[1, Population size], and r1 r2 i. The new generated solu-
tion xi,G+ 1, will be evaluated to compare with the existing
solution xi,G
, if the fitness value of xi,G+1 is better than fit-
ness of Xi, G, the new solution will be xi,G+1; otherwise, the
accepted solution is xi, G. Algorithm 1 show the pseudocode
of standard animal migration optimization algorithm.
4 Multilevel thresholding based on AMO
In this proposed algorithm, optimum D-dimensional vector
x[t1,t2,t3,...,tD] will be obtained by maximized the
Eqs. (2)or(4). In AMO algorithm both of these objective
functions are also applied as the fitness function. Each indi-
vidual position corresponds to a solution. The number of
thresholds determines the dimension number of optimization
algorithm. Each dimension of optimization algorithm rep-
resents a solution to a threshold. The algorithm starts with
a D-dimension population that is initiated randomly. Each
dimension is constrained by bounds [0, 255]. So, initializa-
tion of jth component from ith vector defined as Eq. (7):
xj,i,0xj,0+ randi,j[0,1]×xj,255 −xj,0(7)
Each solution is formulated as:
x[t1,t2,t3,..., tD] subject to 1 <t1<t2<t3<···<tm<L
123
Iran Journal of Computer Science
5 Experimental results and performance
evaluation
The proposed method and all compared algorithms (Genetic
Algorithm, Bacterial foraging optimization, Particle
Swarm Optimization) have been implemented in Mat-
lab programming language under a same PC with Intel
Core(TM) i7-3632QM 2.2 GH processor and 8 gigabytes
of RAM. To evaluate the efficiency of proposed method,
six benchmark images named “CAMERMAN”, “LENA”,
‘L˙
IV˙
INGROOM‘”, “HUNTER”, “PEPPER”, and “MAN-
DRILL” shown in Fig. 2are used for carrying out the
experiments.
Number of solutions (animals, particles, chromosome and
bacteria in AMO, PSO, GA, and BF, respectively) and num-
ber of maximum generation for all applied optimization
algorithm have been set to 200. The other parameters for
the algorithms used in the experiments are given in Table 1.
All the algorithms run 30 times over each test image. After
30 times running of the algorithms, the average of obtained
results for all runs is reported. The obtained thresholds by
Otsu’s and Kapur’s method and corresponding fitness values
of six test images with AMO, PSO, GA, and BF have been
reported in Tables 2and 5. For evaluating the consistency and
stability of algorithms, standard deviation (STD) has been
123
Iran Journal of Computer Science
Fig. 3 Segmented Lena, Livingroom, Hunter and Mandrill images by Otsu method with 2, 3, 4 and 5 “m”levels
calculated from the results obtained in the 30 times run of
algorithms and reported in Tables 3and 6. The formulation
of STD is expressed in equation
Figure 3shows the segmented Lena, Livingroom, Hunter
and Mandrill images by Otsu method with various “m”levels.
The best obtained results are bolded in each row. As it is clear
from Tables 2and 5, in most case the best results are obtained
by AMO algorithm. Also, Tables 3and 6reveal that except
BA, most of the calculated standard deviations from other
three algorithms are too small. By comparing Tables 3and 6
it turns out that the obtained standard deviation from Kapur
method is lower than Otsu method. Moreover, two well-
123
Iran Journal of Computer Science
Table 7 Comparison of PSNR and SSIM for Otsu based
Test images Number of
thresholds
Standard deviation
AMO PSO GA BF
PSNR SSIM PSNR SSIM PSNR SSIM PSNR SSIM
Cameraman 2 17.1732 0.59537 17.1732 0.59537 17.2478 0.59641 17.2478 0.59641
3 20.2363 0.63574 20.3227 0.64408 20.3227 0.64408 20.3227 0.64408
4 21.5455 0.65043 21.5455 0.65043 21.6175 0.65091 21.4807 0.64909
5 23.2902 0.68322 23.3765 0.68896 23.4499 0.68699 23.3814 0.6886
Lenna 2 15.2802 0.54522 15.2802 0.54522 15.2823 0.54652 15.2823 0.54652
3 17.3742 0.63411 17.3742 0.63411 17.3146 18.6142 17.3146 18.6142
4 18.6337 0.67846 18.6337 0.67846 0.62887 0.67729 18.6502 0.6786
5 19.2572 0.70155 19.2517 0.70288 19.4237 0.69785 19.4245 0.70323
Livingroom 2 16.0077 0.53765 16.0077 0.53765 15.9995 0.53677 15.9995 0.53677
3 18.1379 0.61375 18.1379 0.61375 18.1975 0.61634 18.1415 0.61475
4 20.54 0.70526 20.6179 0.70537 20.6735 0.70428 20.6735 0.70428
5 21.9078 0.74681 21.9366 0.7466 22.1618 0.75334 22.244 0.75756
Hunter 2 15.5292 0.45068 15.5292 0.45068 15.5917 0.45593 15.5917 0.45593
3 17.8573 0.5603 17.8573 0.5603 17.7883 0.56217 17.7709 0.56207
4 20.0522 0.6475 19.4655 0.62044 18.7652 0.60213 18.6814 0.59819
5 19.8157 0.65123 19.8157 0.65123 19.8157 0.65123 19.8263 0.65048
Pepper 2 16.2227 0.61328 16.2227 0.61328 16.3234 0.60961 16.3234 0.60961
3 18.3452 0.65895 18.3452 0.65895 18.4696 0.65733 18.4426 0.65726
4 20.6145 0.702 20.6753 0.71086 20.6804 0.71674 20.6766 0.71482
5 22.393 0.76129 22.393 0.76129 22.4186 0.7591 22.3611 0.76169
Mandrill 2 15.4335 0.58674 15.4335 0.58674 15.4335 0.58674 15.4335 0.58674
3 17.8513 0.67863 17.8513 0.67863 17.8513 0.67863 17.8513 0.67863
4 20.4155 0.77083 20.4155 0.77083 20.4155 0.77083 20.4155 0.77083
5 21.8362 0.81077 21.6952 0.80974 21.6952 0.80974 22.0639 0.8137
123
Iran Journal of Computer Science
known performance indicators, peak signal-to-noise ratio
(PSNR) and structural-similarity index (SSIM), are used to
compare the segmentation results using the multilevel image
threshold methods. General form of PSNR and SSIM can be
modelled as in Eqs. (8) and (9), respectively.
PSNR 10 log102552
MSE
MSE 1
M×N
M−1
x0
N−1
y0I(x,y)−˜
I(x,y)2
(8)
Here Iand ˜
Iare original and segmented images of size M
×N, respectively.
SSIMI,˜
I2μIμ˜
I+c12σI˜
I+c2
μ2
Iμ2
˜
I+c1σ2
I+σ2
˜
I+c2(9)
where μIand μ˜
Iare the local sample averages of original
image Iand segmented image ˜
I, respectivelyσI, and σ˜
Ithe
local sample standard deviations of Iand ˜
I, respectively, σI˜
I
the local sample correlation coefficient between Iand ˜
I,C1,
C2 the constants required to balance the calculations. The
SSIM can take values in range [−1, 1].
Tables 4and 7give the PSNR and SSIM results between
the original images and its threshold image for different algo-
rithms and number of thresholds, respectively. Experimental
results demonstrate that our proposed method is more impres-
sive and stable than other three compared methods.
σ1
N
N
i1
(xi−μ)2(10)
where Nindicates number of runs, xiis fitness value in ith
run and μis mean values among all runs.
6 Conclusion
In this paper, based on animal migration optimization (AMO)
algorithm a new multilevel image thresholding is presented
for image segmentation. Kapur and Otsu are considered as
objective functions. The proposed method has been tested on
the various widely used benchmark images. Obtained results
via animal migration optimization algorithm are compared
with PSO, GA and BF methods. In most case, the obtained
results from proposed method give worthy results than the
other three tested algorithms in terms of objective function
value. Under consideration of standard deviation values, the
stability of the AMO is promising. In this study, the number
of thresholds was a pre-defined parameter. However, auto-
matic threshold number could be tested in future investigation
(Tables 5,6and 7).
Acknowledgements The author declares no conflict of interest in this
study.
Funding We confirm that we do not have a funding source.
Compliance with ethical standards
Conflict of interest The authors declare that they have no competing
interests.
References
1. Sarkar, S., Das, S., Chaudhuri, S.S.: A multilevel color image
thresholding scheme based on minimum cross entropy and dif-
ferential evolution. Pattern Recogn. Lett. 54, 27–35 (2015)
2. Horng, M.-H., Liou, R.-J.: Multilevel minimum cross entropy
threshold selection based on the firefly algorithm. Expert Syst.
Appl. 38(12), 14805–14811 (2011)
3. Chang, C.-C., Wang, L.-L.: A fast multilevel thresholding method
based on lowpass and highpass filtering. Pattern Recogn. Lett.
18(14), 1469–1478 (1997)
4. Kurban, T., Civicioglu, P., Kurban, R., Besdok, E.: Comparison of
evolutionary and swarm based computational techniques for mul-
tilevel color image thresholding. Appl. Soft Comput. 23, 128–143
(2014)
5. Oliva, D., Cuevas, E., Pajares, G., Zaldivar, D., Perez-Cisneros,
M.: Multilevel thresholding segmentation based on harmonysearch
optimization. J. Appl. Math. (2013)
6. Arora, S., Acharya, J., Verma, A., Panigrahi, P.K.: Multilevel
thresholding for image segmentation through a fast statistical recur-
sive algorithm. Pattern Recogn. Lett. 29(2), 119–125 (2008)
7. Maitra, M., Chatterjee, A.: A hybrid cooperative–comprehensive
learning based PSO algorithm for image segmentation using mul-
tilevel thresholding. Expert Syst. Appl. 34(2), 1341–1350 (2008)
8. Kapur, J.N., Sahoo, P.K., Wong, A.K.: A new method for gray-level
picture thresholding using the entropy of the histogram. Comput.
Vis. Graph. Image Process. 29(3), 273–285 (1985)
9. Otsu, N.: A threshold selection method from gray-level histograms.
Automatica 11(285–296), 23–27 (1975)
10. Pun, T.: Entropic thresholding, a new approach. Comput. Graph.
Image Process. 16(3), 210–239 (1981)
11. Brink, A.: Minimum Spatial Entropy Threshold Selection. In:
Vision, image and signal processing, IEE proceedings, vol. 3. IET,
pp 128–132 (1995)
12. Cheng, H., Chen, J.-R., Li, J.: Threshold selection based on fuzzy c-
partition entropy approach. Pattern Recogn. 31(7), 857–870 (1998)
13. Li, X., Zhao, Z., Cheng, H.: Fuzzy entropy threshold approach to
breast cancer detection. Inf. Sci. Appl. 4(1), 49–56 (1995)
14. Tobias, O.J., Seara, R.: Image segmentation by histogram thresh-
olding using fuzzy sets. IEEE Trans. Image Process. 11(12),
1457–1465 (2002)
15. Huang, L.-K., Wang, M.-J.J.: Image thresholding by minimizing
the measures of fuzziness. Pattern Recogn. 28(1), 41–51 (1995)
16. de Albuquerque, M.P., Esquef, I.A., Mello, A.G.: Image threshold-
ing using Tsallis entropy. Pattern Recogn. Lett. 25(9), 1059–1065
(2004)
123
Iran Journal of Computer Science
17. Liao, P.-S., Chen, T.-S., Chung, P.-C.: A fast algorithm for multi-
level thresholding. J. Inf. Sci. Eng. 17(5), 713–727 (2001)
18. Yin, P.-Y., Chen, L.-H.: A fast iterative scheme for multilevel
thresholding methods. Signal Process. 60(3), 305–313 (1997)
19. Cao, L., Shi, Z., Cheng, E.: Fast automatic multilevel thresholding
method. Electron. Lett. 38(16), 868–870 (2002)
20. Pikaz, A., Averbuch, A.: Digital image thresholding, based on topo-
logical stable-state. Pattern Recogn. 29(5), 829–843 (1996)
21. Hertz, L., Schafer, R.W.: Multilevel thresholding using edge match-
ing. Comput Vis Graph Image Process 44(3), 279–295 (1988)
22. Sathya, P., Kayalvizhi, R.: Modified bacterial foraging algorithm
based multilevel thresholding for image segmentation. Eng. Appl.
Artif. Intell. 24(4), 595–615 (2011)
23. Sezgin, M., Sankur, B.: Survey over image thresholding techniques
and quantitative performance evaluation. J. Electron. Imaging
13(1), 146–166 (2004)
24. Sathya, P., Kayalvizhi, R.: Amended bacterial foraging algorithm
for multilevel thresholding of magnetic resonance brain images.
Measurement 44(10), 1828–1848 (2011)
25. Sathya, P., Kayalvizhi, R.: Optimal segmentation of brain MRI
based on adaptive bacterial foraging algorithm. Neurocomputing
74(14), 2299–2313 (2011)
26. Yin, P.-Y.: Multilevel minimum cross entropy threshold selec-
tion based on particle swarm optimization. Appl. Math. Comput.
184(2), 503–513 (2007)
27. Pal, S.S., Kumar, S., Kashyap, M., Choudhary, Y., Bhattacharya,
M.: Multi-level Thresholding Segmentation Approach Based on
Spider Monkey Optimization Algorithm. In: Proceedings of the
second international conference on computer and communication
technologies. Springer, Berlin, pp 273–287 (2016)
28. Horng, M.-H.: Multilevel thresholding selection based on the arti-
ficial bee colony algorithm for image segmentation. Expert Syst.
Appl. 38(11), 13785–13791 (2011)
29. Li, X., Zhang, J., Yin, M.: Animal migration optimization: an opti-
mization algorithm inspired by animal migration behavior. Neural
Comput. Appl. 24(7–8), 1867–1877 (2014)
123
A preview of this full-text is provided by Springer Nature.
Content available from Iran Journal of Computer Science
This content is subject to copyright. Terms and conditions apply.