Abstract

Traditional two-dimensional Otsu algorithm has several drawbacks; that is, the sum of probabilities of target and background is approximate to 1 inaccurately, the details of neighborhood image are not obvious, and the computational cost is high. In order to address these problems, a method of fast image segmentation using two-dimensional Otsu based on estimation of distribution algorithm is proposed. Firstly, in order to enhance the performance of image segmentation, the guided filtering is employed to improve neighborhood image template instead of mean filtering. Additionally, the probabilities of target and background in two-dimensional histogram are exactly calculated to get more accurate threshold. Finally, the trace of the interclass dispersion matrix is taken as the fitness function of estimation of distributed algorithm, and the optimal threshold is obtained by constructing and sampling the probability model. Extensive experimental results demonstrate that our method can effectively preserve details of the target, improve the segmentation precision, and reduce the running time of algorithms.

1. Introduction

Image segmentation is the technology and process of segmenting an image into multiple segments with characteristics and extracting regions of interest, and it is the basis of image analysis. The quality of image segmentation directly affects the results of the subsequent image processing [1].

Image segmentation methods mainly include threshold method [2, 3], edge detection method [4], region method [5], graph cut method [6], clustering method [712], and machine learning based method [1315]. In recent years, machine learning, especially the deep learning represented by convolution neural networks (CNN), has captured more attention in image segmentation [1519]. However, such methods require a multitude of annotated images as samples for training, which is a very time-consuming. In addition, in practice, a small amount of real images as training sample, such as dozens of computed tomography (CT) scanning images, is unable to achieve the desired results.

Threshold technique is simple and effective for image segmentation, which has been widely used in computer vision and pattern recognition. There are several popular threshold methods including Otsu, maximum entropy, minimum cross entropy, and histogram [20, 21]. Compared to other threshold segmentation methods, Otsu is the most popular for grayscale image segmentation [22]. In order to enhance the performance of the classical Otsu, a series of improvements have been proposed [2326]. However, those improved Otsu methods still only use the one-dimensional gray histogram of image without considering the spatial information of image, which is similar to the classical Otsu method. When the image is affected by noneven brightness, noise, and other factors, the result of image segmentation is not ideal, even incorrect. For this reason, Liu and Li [27] extended the Otsu from one dimension to two dimensions and proposed an Otsu method based on two-dimensional gray histogram. By combining the pixel information with the spatial correlation information between the pixel and its neighborhood, the proposed method is able to provide better segmentation results than one-dimensional Otsu. Nevertheless, the two-dimensional Otsu enlarges the search space into two dimensions, which increases the complexity of the algorithm and expands the computational cost with exponential growth. Consequently, some fast algorithms have been proposed, one of which is the introduction of artificial intelligence algorithm. The intelligent search strategy is employed to speed up solving the global optimal threshold instead of exhaustion method. Sun [28] and Deng et al. [29] applied the genetic algorithm to image segmentation based two-dimensional Otsu, which improves the efficiency of algorithm to some extent but fails to address the premature convergence problem of genetic algorithm. The two-dimensional Otsu based artificial fish swarm algorithm [30] is not sensitive to the selection of initial value and parameter, robust, simple, and easy to implement, but easy to fall into local optimum and low convergence accuracy. Tang et al. [31] and Guo et al. [32] introduced the particle swarm algorithm into the method of image segmentation based on the two-dimensional Otsu. Although the algorithm manifests simple, easy to operate, and general characteristics, the diversity of particles disappears rapidly when the selection of the parameter or the population size is not appropriate. And the above defects of the algorithm can lead to precocious and fall into local optimum. Sun et al. [33] adopted a method of image segmentation using two-dimensional Otsu based on simulated annealing algorithm, which shows its superiority in searching the global minimal solution but also has the disadvantage of slow convergence speed. The above-mentioned two-dimensional Otsu methods based on intelligent algorithm enhance the calculation efficiency of two-dimensional Otsu to a certain extent. However, the sum of probabilities of target and background on the main diagonal of two-dimensional histogram is still approximately 1, which is similar to the traditional two-dimensional Otsu. This approximation has been proved to be incompatible with the real image by Fan and Zhao [34] and Wu et al. [35]. And the curve and oblique methods based on two-dimensional Otsu were, respectively, proposed to get a satisfying effect of image segmentation, but the applicability of these two methods is poor [36]. Furthermore, the existing two-dimensional Otsu methods employ the mean filtering template to construct two-dimensional histogram, which loses the edges and detailed features of the neighborhood image and influences the effect of image segmentation.

In this paper, in order to improve the effect of segmentation and reduce computational cost of two-dimensional Otsu algorithm, a novel fast image segmentation method using two-dimensional Otsu based on estimation of distributed algorithm is proposed. Firstly, to obtain the approving performance of image segmentation, the guided filtering is employed to improve neighborhood image template instead of the mean filtering. Moreover, the probabilities of the target and background in two-dimensional histogram are exactly calculated to get more accurate threshold. Finally, in order to segment the image quickly and accurately, the estimation of distribution algorithm [37] with outstanding searching ability and fast convergence speed is applied to find the optimal segmentation threshold.

2. Improvements to Method of Two-Dimensional Otsu

The method of two-dimensional Otsu applies the two-dimensional histogram comprising the image gray and its neighborhood image average gray to find the optimal threshold and then divides the image into the target and background. The main diagonal regions I and III of the two-dimensional histogram denote, respectively, the target and background; the subdiagonal regions II and IV present severally the edge and noise, as shown in Figure 1.

Under the method of traditional two-dimensional Otsu, the sum of probabilities of the target and background is approximate to 1, and the sum of probabilities of the edge and noise is approximate to 0. This approximation is only satisfied under certain conditions, which has been confirmed in theory and experiment by the literatures [3436]. The accuracy of image segmentation is low when the approximation is not true. In addition, the neighborhood image is obtained by a mean filtering template under the method of traditional two-dimensional Otsu, which can effectively eliminate the Gaussian noise of image but also obscure the edge and detailed features of image and affect the performances of image segmentation. Therefore, in order to enhance the performances of image segmentation, the traditional two-dimensional Otsu is improved from two aspects: using the guided filtering to build a new neighborhood template and accurately calculating the probabilities of the target and background.

2.1. Construction of Neighborhood Template Based on Guided Filtering

In order to enhance the effect of image segmentation under two-dimensional Otsu method, we introduce the guided filtering to improve the neighborhood template, which can preferably preserve features of the edge and details [38]. The guided filtering is a filtering method that restrains the details of image and is similar to the bilateral filtering. However, compared with the bilateral filtering, the performance of guided filtering is better and the algorithm is faster. It can be regarded as a local linear model, defined aswhere represents the guided image, denotes the input image, stands for the output image, , is the index of the pixel, and is the filter kernel function, and defined aswhere is the th window of kernel function, is the number of pixels in the window, and denote the mean value and the variance of a window in , and is the smoothing factor. Here, the local window radius is set to 2, the value of is set to 0.04, and then the number of pixels in the window is .

A new neighborhood template can be constructed by using the guided filtering with preserving the edge and details of image instead of the mean filtering, which can preferably construct the image two-dimensional histogram and advance the performance of image segmentation.

2.2. Exact Calculation of the Two-Dimensional Otsu

Step 1. Construct two tuples according to the gray values of original image and the filtered neighbor image by the guided filtering, denoted as the gray value of original image and the gray value of neighbor image. If the frequency of two tuples is expressed as , then the corresponding joint probability density can be defined aswhere is the number of pixels and is the gray level of image, and there is

Step 2. Calculate accurately the probabilities and of the target and background regions in the two-dimensional histogram:where and represent the threshold values of original image and neighbor image, respectively.

Step 3. Calculate, respectively, the corresponding mean vectors and of the target and background:

Step 4. Calculate the total mean vector on the two-dimensional histogram:

Step 5. Calculate the trace of interclass dispersion matrix :

Step 6. Calculate the optimal threshold :The improved two-dimensional Otsu algorithm suffers from a high computational cost. Consequently, we introduce the estimation of distribution algorithm with favorable global convergence ability and high computation efficiency to find the optimal segmentation threshold .

3. Fast Image Segmentation Using Two-Dimensional Otsu Method Based on Estimation of Distribution Algorithm

As a new type of optimization algorithm in the field of evolutionary computation, the estimation of distribution algorithm proposes a new evolutionary model [39]. There are no genetic operations such as crossover and mutation in the estimation of distribution algorithm, which is different from the traditional evolutionary algorithm. The estimation of distribution algorithm predicts the best searching region according to sampling and statistical learning for searching space and generates the optimal new individual. The algorithm using the macrolevel evolution method based on search space has superior global search ability and positive convergence rate [38]. The two-dimensional Otsu method searches the optimal combination of image threshold and neighborhood image threshold in the global range, and the two variables are independent of each other. Accordingly, the variable independent estimation of distribution algorithm is employed to solve the optimal segmentation threshold in the two-dimensional Otsu.

The gray value of a pixel in the image and a pixel in its neighborhood image is represented by the individual , where the ranges of and are 0 to 255. The th individual in the th generation is denoted as , the population size is indicated by the PopSize, and the largest generation of evolution is expressed by the MaxGen. The flowchart of image segmentation using two-dimensional Otsu based on estimation of distribution algorithm is shown in Figure 2, and the concrete steps are as follows.

Step 1 (initialize the population). The current evolutionary generation is initialized to 1, and the initial population is obtained by random sampling referring to the literature [40]:

Step 2 (calculate the individual fitness). The trace of interclass dispersion matrix is regarded as the fitness function, as seen in (8). Firstly, let , in (8), and calculate fitness value of individual in the th generation. Then similar method is applied to calculate the fitness values of other individuals in the th generation. Finally, the fitness values of all individuals are obtained:

Step 3 (obtain the optimal fitness and the best individual). Calculate the optimal fitness , and the corresponding individual is the best individual in the population.

Step 4 (determine whether the termination condition is satisfied). If the evolutionary generation is not greater than , then Step is performed; otherwise, the optimization process is terminated, and the optimal fitness and the best individual are obtained; Step is performed.

Step 5 (select the individual for establishing probability model). In order to ensure that the probability model is sensitive to the search process, the individual who is used to construct the probability model must be able to accurately track the information of probability model. For the sake of preventing the algorithm into local optimal, the individual selection should have a certain randomness. Roulette is a proportion of random selection method. On the one hand, in order to ensure the tracking accuracy of probability model, the individual is selected according to the probability of alleles per gene bit. On the other hand, this method does not guarantee that the allele of large probability must be selected and has a certain randomness. In this paper, when the fitness value is the largest, the optimal segmentation threshold is obtained. Therefore, the roulette selection method based on fitness is adopted; that is, the probability that each individual is selected is proportional to its fitness. The specific steps are as follows:(1)Calculate the relative fitness of each individual , denoted as , where and .(2)According to relative fitness , the disc is divided into PopSize copies, where the central angle of the th fan is .(3)Simulate the roulette operation, that is, to generate a random number between 0 and 1. If and , then individual is selected, denoted as .(4)Repeat step () until the PopSize excellent individuals have been obtained.

Step 6 (establish the probability model). Firstly, construct the Gaussian distribution function according to the excellent individual selected by Step . Then, calculate the mean and standard deviation of the first variable for all individuals:where . Mean and standard deviation of the second variable of all individuals are calculated in a similar manner. The probability distribution function can be expressed as follows:

Step 7 (obtain the new population by sampling). The sampling method depends on the probability model used by the algorithm. Therefore, the next generation population is generated on the basis of the constructed Gaussian distribution function:The individual of the population is denoted as , where , .

Step 8 (establish the diverse population). In order to enhance the diversity of population and avoid the excessive effect on the population, in the first place, individuals are randomly removed from the current population, where and represents an integer that is closest to . Then, the optimal individuals in the previous population are appended to the current population to establish a diverse population. Finally, return to Step and recalculate the fitness of each individual.

Step 9 (image segmentation). On the basis of the optimal threshold , obtained by Step , the two-dimensional Otsu method is employed to segment the image.

4. Experimental Results and Analyses

In order to evaluate the performance of image segmentation and the efficiency of the proposed method, a large number of industrial computed tomography (CT) images of different mechanical parts and many images from popular image segmentation dataset are used to test. Extensive experimental results are compared with the results of the following approaches, that is, Otsu, 2D Otsu [27], 2D Otsu-GA [29], 2D Otsu-FSA [30], LCK [10], LSD [11], and ME + PPD [3], quantitatively and qualitatively.

4.1. Comparisons of Segmentation on Real Image

Figure 3 shows the results of image segmentation regarding five real industrial CT images with Gaussian noise under different methods. The cylinder head, carburetor, nuts, aluminum part, and bearing are arranged from left to right; the original image, the results of the traditional two-dimensional Otsu, the results of the 2D Otsu-FSA, the results of the 2D Otsu-GA, and the results of our method are distributed from top to bottom. In order to compare objectively the performances of the above methods, the population size of genetic algorithm, fish swarm algorithm, and estimation of distribution algorithm are set to 20, and evolutionary generations (or optimization times) are set to 50.

The experimental results are shown in Figure 3. For industrial CT images of the nuts and bearing with clear boundary and large target and background discrimination, the above methods can preferably segment the target and background, and the effect is preferable. However, for industrial CT images of the cylinder head, carburetor, and aluminum part with relative blurred boundary, there is a certain gap in the segmentation effects of each method. For the cylinder head image, the traditional two-dimensional Otsu is poor for the detail at the upper right corner of image, and the 2D Otsu-FSA and the 2D Otsu-GA lose the details at the upper right corner and the upper left corner of image, which is inconsistent with the original image. For the carburetor image, we can intuitively see that the detailed features at the bottom of image are lost after the traditional two-dimensional Otsu, the 2D Otsu-FSA, and the 2D Otsu-GA. For the aluminum part image, the traditional two-dimensional Otsu and the 2D Otsu-GA process incorrectly a noise at the upper right of image as a target. Though the noise is well processed by the 2D Otsu-FSA, the detailed feature (i.e., hole) above the left image is lost. The segmentation result of the 2D Otsu-GA also lost the detail, that is, the hole. It can be seen the proposed method can preferably preserve the details of original images with blurred boundary from the last line in Figure 3.

4.2. Comparisons of Computational Cost on Real Image

The computational cost of two-dimensional Otsu based on intelligent algorithm is mainly reflected in calculation of the fitness of individual. In the case of the same population size, the computational cost of different algorithms are qualitatively evaluated by comparing the evolutionary generation of population when the algorithms reach convergence state.

The maximum fitness convergence curves of the aluminum part are obtained by using two-dimensional Otsu methods based on intelligent algorithm, as shown in Figures 46. The 2D Otsu-FSA: if the population size is equal to 10, the fitness is convergent until the number of iterations is about 40. If the population size is equal to 20, the fitness is convergent when the number of iterations is about 22. If the population size is equal to 30, the fitness has converged when the number of iterations is close to 12. The 2D Otsu-GA: if the population size is equal to 10, the fitness is convergent when the number of iterations is about 45. However, the fitness of the algorithm is obviously fluctuant in the process of convergence, which reflects the evolutionary disorder affected by variant randomness under the genetic algorithm. If the population size is equal to 20, the fitness is convergent when the number of iterations is about 35. If the population size equals 30, the fitness is convergent when the number of iterations is about 25. Our method: if the population size equals 10, 20, or 30, the fitness has converged when the number of iterations is only about 25, 10, or 3. In addition, the results of the proposed method are stable after convergence.

According to the above experimental results and analyses, for solving the optimal threshold of two-dimensional Otsu, the estimation of distribution algorithm requires fewer population size and few number of iterations than the genetic algorithm and the fish swarm algorithm. In other words, the estimation of distribution algorithm can effectively reduce the computational cost.

Moreover, in order to compare the efficiencies of the proposed method and the existing methods, objectively and precisely, the mean time of image segmentation under different methods is counted. Table 1 illustrates the mean time of 10 segmentations for 5 industrial CT images. According to the data in Table 1, the speed of the proposed method is about 10, 5, and 3 times faster than the traditional two-dimensional Otsu, 2D Otsu-FSA, and 2D Otsu-GA, respectively.

4.3. Comparisons of Segmentation on Image Dataset

In this section, we compare our method with Otsu, 2D Otsu, 2D Otsu-FSA, 2D Otsu-GA, ME + PPD, LCK, and LSD on a host of images that come from popular image datasets. As an example, we select a grain image and a tire image from the general image library, a duck image and a bird image from the BSD500 image dataset, and a motorcycle image from the VOC image dataset to demonstrate the comparative results, as illustrated in Figure 7. For rice grains image, our method can preferably retain the completeness of rice grains. Especially at the bottom of the image, it can better preserve the structural characteristics of rice grains and segment the target from the background. Fortunately, LCK and LSD can also detect the target efficiently. However, these two methods require a high computational cost. With regard to the tire image segmented by the proposed method, the contour details of eight axis are clear; the edges between the inner and outer rings of the tire are favorable. Moreover, the middle four screws are very easy to identify and have only a small black background. For the duck image with simple background, each of above-mentioned methods can obtain a promising result. However, the proposed method can preferably preserve the details, such as the mouth and tail. Compared with 2D Otsu, 2D Otsu-FSA, ME + PPD, and LSD, our method can preferably extract the edges of target on the bird image. Furthermore, our method can more accurately segment out the claw comparing with Otsu, 2D Otsu-GA, ME + PPD, LCK, and LSD. For the motorcycle image with complex contour and scene, the proposed method is favorable on the details, such as the rearview mirror and support and rear seat. ME + PPD and LCK obtain a preferable performance of the global segmentation. Nevertheless, LCK is time-consuming.

The computational costs of the above methods on the five images in Table 2 are also measured. From this table, we can see that the computational cost of our method is lower than the other methods except Otsu. However, Otsu’s segmentation results are not very good.

5. Conclusion

In this paper, we present a fast image segmentation method using two-dimensional Otsu based on estimation of distribution algorithm. The proposed method can preferably preserve the edges and details of the object because the guided filtering template is replaced with the mean filtering template. Furthermore, compared with other existing image segmentation methods, our method has desirable segmentation performance and computational cost for image with simple scene. However, similar to other threshold-based image segmentation methods, our method is preferable for the images with the same gray scale range; it has a limitation to the object with large gray scale distribution. In addition, the actual segmentation effect of our method is not perfect in complex scene.

In the future, we plan to preprocess the object so that our segmentation method can perform well for special objects as well as handle more complex images.

Conflicts of Interest

The authors declare that they have no conflicts of interest.

Acknowledgments

This paper is supported partly by Chongqing Natural Science Foundation of China (Grant no. cstc2016jcyjA0353) and National Key Scientific Instrument and Equipment Development Projects of China (Grant no. 2013YQ030629).