Otsu Based Optimal Multilevel Image Thresholding Using Firefly Algorithm

Histogram based multilevel thresholding approach is proposed using Brownian distribution (BD) guided firefly algorithm (FA). A bounded search technique is also presented to improve the optimization accuracy with lesser search iterations. Otsu’s betweenclass variance function is maximized to obtain optimal threshold level for gray scale images. The performances of the proposed algorithm are demonstrated by considering twelve benchmark images and are compared with the existing FA algorithms such as Lévy flight (LF) guided FA and random operator guided FA. The performance assessment comparison between the proposed and existing firefly algorithms is carried using prevailing parameters such as objective function, standard deviation, peak-to-signal ratio (PSNR), structural similarity (SSIM) index, and search time of CPU.The results show that BD guided FA provides better objective function, PSNR, and SSIM, whereas LF based FA provides faster convergence with relatively lower CPU time.


Introduction
In imaging science, image processing plays a vital role in the analysis and interpretation of images in fields such as medical discipline, navigation, environment modeling, automatic event detection, surveillance, texture and pattern recognition, and damage detection.The development of digital imaging techniques and computing technology increased the potential of imaging science.
During the image processing operation, a photograph or a video frame is analyzed with a chosen signal processing technique and the outcomes such as processed image, data, and/or parameters related to image are further investigated to extract the desired information from the raw input image.
Image segmentation is one of preprocessing techniques used to regulate the features of an image.It is also judged to be an important procedure for significant examination and interpretation of input images [1].
Over the years, several techniques for segmentation have been proposed and implemented in the literature [2][3][4][5][6][7][8][9][10].In segmentation, the input image is separated into nonoverlapping, homogenous regions containing similar objects.Based on the performance appraisal process, the segmentation methods are classified into two groups such as supervised and unsupervised evaluation.Unsupervised methods are preferable in real-time processing because they do not require a manually segmented image [11].
Thresholding is considered the most desired procedure out of all the existing procedures used for image segmentation, because of its simplicity, robustness, accuracy, and competence [12].If the input image is divided into two classes, such as the background and the object of interest, it is called bilevel thresholding.Bilevel thresholding is extended to multilevel thresholding to obtain more than two classes [11,13,14].

Modelling and Simulation in Engineering
The thresholds can be derived at a local or global level [15].In local thresholding, a different threshold is assigned for each part of the image.In global thresholding, a single global threshold in the probability density function of the grey level histogram is obtained using parametric or nonparametric approach to find the thresholds.In the parametric approaches, the statistical parameters of the classes in the image are estimated.They are computationally expensive, and their performance may vary depending on the initial conditions.In the nonparametric approaches, the thresholds are determined by maximising some criteria, such as betweenclass variance [16] or entropy measures.
The methods such as Kapur, Tsallis, and Otsu are widely adopted by most of the researchers to find solution for multilevel image segmentation problems [17][18][19][20].In general, Kapur and Otsu based thresholding techniques proved their better shape and uniformity measures for the bilevel and multilevel thresholding problems [1].
Traditional methods work well for a bilevel thresholding problem, when the number of threshold level increases, complexity of the thresholding problem also will increase and the traditional method requires more computational time.Hence, in recent years, soft computing algorithm based multilevel image thresholdingprocedure is widely proposed by the researchers.
The paper is organized as follows.Section 2 presents the Otsu based multilevel thresholding problem.Section 3 presents the overview of the FA, and the implementation of Otsu guided FA is discussed in Section 4. Experimental results are evaluated and discussed in Section 5. Conclusion of the present research work is given in Section 6.

Methodology
The classical and optimization algorithm based thresholding methods existing in the literature are employed to find the best possible threshold in the segmented histogram by satisfying some guiding parameters.Otsu based image thresholding is initially proposed in 1979 [50].This method presents the optimal values by maximizing the objective function.In the present work, Otsu's nonparametric segmentation method known as between-class variance is considered.A detailed description of the between-class variance method could be found in [1,11].
In bilevel thresholding (for  = 2), input image is divided into two classes such as  0 and  1 (background and objects, or vice versa) by a threshold at a level "." The class  0 encloses the gray levels in the range 0 to  − 1 and class  1 encloses the gray levels from  to  − 1.The probability distributions for the gray levels  0 and  1 can be expressed as where  0 () = ∑ −1 =0   ,  1 () = ∑ −1 =   , and  = 256.The mean levels  0 and  1 for  0 and  1 can be expressed as The mean intensity (  ) of the entire image can be represented as The objective function for the bilevel thresholding problem can be expressed as where  0 =  0 ( 0 −   ) 2 and The above discussed procedure can be extended to a multilevel thresholding problem for various "" values as follows.
Let us consider that there are "" thresholds ( 1 ,  2 , . . .,   ), which divide the input image into "" classes:  0 with gray levels in the range 0 to  − 1,  1 with enclosed gray levels in the range  1 to  2 − 1, . .., and   with gray levels from   to  − 1.
The objective function for the multilevel thresholding problem can be expressed as where (Note that, in the proposed work, objective functions are assigned for  = 2,  = 3,  = 4, and  = 5.)

Firefly Algorithm
Firefly algorithm is a nature inspired metaheuristic algorithm initially proposed by Yang [35,36].This algorithm is developed by imitating the flashing illumination patterns generated by invertebrates such as glowworm and firefly.They generate chemically produced light from their lower abdomen.This bioluminescence with varied flashing patterns generated by glowworm/firefly is used to establish communication between two neighboring insects, to search for prey and also to find mates.
(i) All the fireflies are unisex and one firefly will be attracted to the nearest firefly regardless of their sex.
(ii) The attractiveness between two fireflies is proportional to the luminance.For any couple of flashing fireflies, the firefly with the brighter luminance will attract the firefly with lesser luminance.The attractiveness between two fireflies mainly depends on the Cartesian distance and is proportional to the brightness which decreases with increasing distance between fireflies.In a region, if all the fireflies have lesser luminance, then they will move randomly in the "" dimensional search space until they find a firefly with brighter luminance.
(iii) The brightness of a firefly is somehow related to the analytical form of the objective function assigned to guide the search process.
The overall performance (exploration time, speed of convergence, and optimization accuracy) of the FA depends on the cost function, which monitors the optimization search.For a maximization problem, luminance of a firefly is considered to be proportional to the value of cost function (i.e., luminance = objective function).

Fundamentals.
The chief parameters which decide the efficiency of the FA are the variations of light intensity and attractiveness between neighboring fireflies.These two parameters will be affected by the increase in the distance between fireflies [23].
Variation in luminance can be analytically expressed by the following Gaussian form: where  is the new light intensity,  0 is the original light intensity, and  is the light absorption coefficient.
The attractiveness to the luminance can be analytically represented as where  is the attractiveness coefficient and  0 is the attractiveness at  = 0.
The above equation describes a characteristic distance Γ = 1/ √  over which the attractiveness changes significantly from  0 to  0  −1 .The attractiveness function () can be any monotonically decreasing functions such as the following form: For a fixed , the characteristic length becomes Conversely, for a given length scale Γ, the parameter  can be used as atypical initial value (i.e.,  = 1/Γ).
The Cartesian distance between two fireflies  and  at   and   , in the -dimensional search space, can be mathematically expresses as In FA, the light intensity at a particular distance  from the light source    obeys the inverse square law.The light intensity of a firefly  reduces, as the distance  increases in terms of  ∝ 1/ 2 .The movement of the attracted firefly  towards a brighter firefly  can be determined by the following position update equation: where  +1  is the updated position of firefly,    is the initial position of firefly,  0  − 2  (   −    ) is the attraction between fireflies, and Ψ is the randomization parameter.
From (11), it is observed that updated position of the th firefly depends on initial position of the firefly, attractiveness of firefly to the luminance, and the randomization parameter.In this paper randomization parameters such as  [36] and  sign (rand − 1/2) Lévy [37,51] are considered.Lévy flight based randomization parameter helps to achieve faster convergence compared to other randomization parameters existing in the literature.

Working Principle.
The working principle of the traditional FA is demonstrated in this section using a twodimensional optimization problem.The total number of fireflies is assigned as six.When the algorithm is initialized, all the fireflies are randomly distributed in the two-dimensional search space.In this problem, it is assumed that the search space has two local best values and a global best value.
During the initial search, some fireflies move towards the local best (LB) values and some reach the global best (GB) value as illustrated in Figure 1(a).From Figure 1(a), it is observed that firefly 1 (FF1) is at LB1, firefly 4 (FF4) is at GB, and firefly 5 (FF5) is at LB2. FF2 lies between LB1 and GB, FF3 lies between GB and LB2, and FF6 is between GB and LB2.The light intensity produced by FF4 is brighter than the light intensity by FF1 and FF5.At this condition, FF2 moves towards LB1 or GB based on the Cartesian distance "" (8).In this problem, the distance between FF1 and FF2 (1) is short compared to 2; hence FF2 moves towards LB1.Similarly, the Cartesian distance between FF4 and FF3 (3) is shorter than 4, and FF3 is more likely attracted to GB than LB2.The Cartesian distance between FF6 and FF5 (5) is shorter than 6, and FF6 is likely attracted to LB2.
Figure 1(b) shows the second stage of search process.When the search iteration increases, the firefly at the GB is retained.The attraction signal between the fireflies at the local best value is exponentially decreased with the increase in search iteration and the entire fireflies move towards the GB.Finally a considerable amount of fireflies are gathered at the global best value as shown in Figure 1(c) at the end of optimization search.

Lévy Flight and Brownian Distribution.
In recently developed nature inspired methods such as firefly and cuckoo algorithm, optimization search process is guided by Lévy flight (LF) strategy [35].
LF is a random walk with a sequence of arbitrary steps and is conceptually similar to the search path of a foraging animal [52].In LF, the flight span and the length between two successive changes in direction are drawn from a probability distribution.Similar to LF, Brownian distribution (BD) is also in the family of random walks.Figure 2 shows the relationship between LF and BD.Based on the temporal exponent () and spatial exponent () values, LF and BD can be realized from the random walks [53].A detailed justification of LF and BD is discussed in the book by Yang [35].Lévy flight is superdiffusive Markovian process, whose step length is drawn from the Lévy distribution in terms of a simple power-law formula: The Brownian walk is a subdiffusive non-Markovian process, which obeys a Gaussian distribution with zero mean and time-dependent variance.In (12), the ratio of exponents / provides the relationship between sub-and superdiffusion.When  < 2, the continuous random walk is superdiffusive, and for  > 2 it is subdiffusive.For  = 2, the search process exhibits the same scaling as ordinary Brownian motion [52,54].
Figures 3(a) and 3(b) depict the search patterns of a single firefly with LF and BD in a two-dimensional search space.Figure 3(a) shows that Lévy flight guided FA is very efficient in exploring unknown search space with minimal number of iterations, because of its large step size.Figure 3(b) shows that the BD guided FA explores the search space with smaller step size and provides the best possible solution.In this work, the following formulae are considered: Brownian distribution: where  is the random variable,  is the spatial exponent,  is the temporal exponent, and Γ() is a Gamma function.Equations ( 13) and ( 14) are formed as discussed in [49].The random variable presented in ( 15) is chosen based on the article by Gandomi et al. [51].

Implementation
The multilevel thresholding problem deals with finding optimal thresholds within the gray scale range [0,  − 1] that maximize a fitness criterion ().Otsu's between-class variance function is employed to find the threshold values.The search dimension of the optimization problem is assigned based on the number of thresholds () considered.In this paper, optimal multilevel thresholding has been carried out by an unsupervised global-level nonparametric approach.In the proposed approach, the efficiencies of BDFA, LFFA, and FA are tested separately, and their performances have been compared.Figure 4 depicts the flow chart of the proposed work.The firefly algorithms are employed to find the optimal threshold values by maximizing the objective function.
In metaheuristic algorithm based optimization methods, the bounded search technique helps to achieve better values with lesser iterations [49].In the proposed work, the Modelling and Simulation in Engineering dimension of the search varies from 2 to 5 based on the "" values.When  = 2, it is a simple two-dimensional optimization problem and an unbounded search may offer better result with lesser iterations.When "" value increases, the complexity of the optimization problem also will increase.
In this paper we introduced a bounded search technique for the image segmentation problem.Instead of initializing the search operation with a range of gray levels [0,  − 1], we propose a search boundary as min value < gray levels < max value. ( Figure 5 shows the histogram of the Barbara image.The value of "" is five; hence it is a five-dimensional optimization problem (i.e., the number of threshold to be identified is five).The search boundary for the threshold is assigned as 20 < gray levels < 220.During the boundary based search, the optimization algorithm explores the gray levels situated between 20 and 220 and ignores the rest of the gray levels.This bounded search technique will provide better solution with lesser iterations.
The performance of the Otsu guided firefly algorithms is evaluated using the well-known parameters such as peak-tosignal ratio (PSNR) and structural similarity indices (SSIM) [11].
The PSNR is mathematically represented as PSNR (, ) = 20 log 10 ( 255 The SSIM is normally used to estimate the image quality and interdependencies between the original and processed image.SSIM index combines luminance comparison, contrast comparison, and structure comparison and satisfies symmetry, boundedness, and unique maximum properties: Otsu guided firefly algorithm based multilevel thresholding techniques have been tested on different standard test images such as Barbara, where   is the average of ,   is the average of ,  2   is the variance of ,  2  is the variance          Like SSIM, structural dissimilarity (DSSIM) is also a measure of the processed image quality and it can be expressed as In this work, PSNR and SSIM are considered to evaluate the performance of firefly algorithms.

Results and Discussion
The images Lena, Cameraman, Living Room, Mandrill, Jet, and Boat are obtained from the database available at [55].The remaining five images, Zebra, Snake, Fish, Star Fish, and Sailor, were taken from the Berkeley Segmentation Dataset [56].The entire image has an inimitable grey level histogram.All the test images are converted into a 256 × 256 sized gray scale image before the analysis.In the test images, most of them are difficult to segment because of their multimodal histograms.Images such as Barbara and Lena show multiple peaks and valleys whereas the Living Room image shows abruptly changing pixel levels.Other images such as Mandrill, Boat, Zebra, Snake, Fish, and Star Fish show a smooth distribution in gray level compared to the Cameraman and Jet.
All the experiments were performed on a work station with an AMD C70 Dual Core 1 GHz CPU with 4 GB of RAM and equipped with MATLAB R2010a software.
The firefly algorithm parameters are assigned as discussed in [51]; the number of fireflies is as follows: () = 25,  0 = 1,  = 5, and  0 = 0.5 (gradually reduced to 0.1 in steps of 0.01 as iterations proceed), and the total number of run is chosen as 5000.
During the experiment, each image is examined with a number of thresholds such as  = 2 to 5. The simulation study is repeated 20 times individually and the best value among the search is recorded as the optimal threshold value.In Figures 6, 7   The objective values and optimal threshold values for Otsu guided BDFA, LFFA, and FA are presented in Table 1.The other quality measures such as standard deviation, PSNR, SSIM, and CPU time are depicted in Table 2. From Table 1, it is seen that the BDFA offers better objective function values for most of the test images compared to the LFFA and FA.

Conclusion
In this paper, optimal multilevel image thresholding problem is addressed using Otsu guided firefly algorithms.The proposed histogram based bounded search technique helps in reducing the computation time.Further, the performances of the BDFA, LFFA, and FA are evaluated using parameters such as objective function, standard deviation, PSNR, SSIM, and search time of CPU.When the assigned threshold level is two ( = 2), all the FAs provide approximately similar threshold values.When "" increases, the search time taken by the BDFA regularly increases compared to LFFA and FA.From the result, it is evident that, for  > 3, Brownian distribution based FA provides better objective function, PSNR, and SSIM, whereas Lévy flight based FA shows faster convergence with relatively lower CPU time.To analyze the permanence of the algorithms, the standard deviations of 20 runs have been presented in Table 1 for Otsu's between-class variance.The PSNR and the SSIM presented in Table 2 also prove the efficiency of the proposed Brownian distribution guided firefly algorithm.Due to the smaller search step, the BD guided firefly algorithm's run time is considerably larger than Lévy flight guided firefly and the traditional FAs.

Figure 1 :
Figure 1: Various stages of firefly search.

Figure 2 :
Figure 2: Relation between LF and BD.

Figure 3 :Figure 4 :Figure 5 :
Figure 3: (a) Search pattern of a firefly with LF.(b) Search pattern of a firefly with BD.

For all the test
images, the histogram (Figure b) and Otsu guided BDFA based processed images for  = 2, 3, 4, and 5 are presented (Figures (c) to (f)) for all the considered test images.The quality of image segmentation is better for all the images when  = 5 compared to lesser "" values.

Table 1 :
Comparison of objective values achieved with Otsu guided various FAs.