Image Bi-Level Thresholding Based on Gray Level-Local Variance Histogram

Thresholding is a popular method of image segmentation. Many thresholding methods utilize only the gray level information of pixels in the image, which may lead to poor segmentation performance because the spatial correlation information between pixels is ignored. To improve the performance of thresolding methods, a novel two-dimensional histogram—called gray level-local variance (GLLV) histogram—is proposed in this paper as an entropic thresholding method to segment images with bimodal histograms. The GLLV histogram is constructed by using the gray level information of pixels and its local variance in a neighborhood. Local variance measures the dispersion of gray level distribution of pixels in a neighborhood. If a pixel’s gray level is close to its neighboring pixels, its local variance is small, and vice versa. Therefore, local variance can reflect the spatial information between pixels. The GLLV histogram takes not only the gray level, but also the spatial information into consideration. Experimental results show that an entropic thresholding method based on the GLLV histogram can achieve better segmentation performance.


Introduction
Image segmentation is the process of grouping an image's pixels into homogenous regions with respect to one or more characteristics, such as texture, color, and brightness.It plays a critical role in image, video, and computer vision applications such as defect detection [1,2], character recognition [3], document analysis [4], etc.Many methods have been developed for image segmentation.Among these methods, the thresholding method is widely used for its simplicity and ease of implementation.The basic assumption of thresholding method is that the object and background can be classified by their intensity values.Thresholding methods can be classified into two classes: bi-level thresholding and multi-level thresholding.For bi-level thresholding, only one threshold is selected to segment the image into two classes, while for multi-level thresholding, more than one threshold should be determined to segment the image into multiple classes because the histogram of the image has more than two modes [5].
To select a suitable threshold, thresholding methods usually optimize a criterion function; for example, maximizing between-class variance [6], or minimum classification error [7].Entropy is a measure of uncertainty in an information source, and has received increasing attention from researchers for the selection of thresholding values.Pun [8,9] first proposed the selection of thresholds using an entropy criterion.In his proposed method, the upper bound of the posteriori entropy of the object and background were maximized.Wong and Sahoo [10] refined Pun's method and determined the optimal threshold by maximizing the posteriori entropy under inequality constraints, which characterize the uniformity and shape of the segmented regions.Kapur et al. [11] put forward a new method called maximum entropy thresholding, which selects the optimum threshold by maximizing the sum of entropies of the object and the background.Li and Lee [12] proposed the cross-entropy thresholding method by minimizing the information difference between the input image and the output binary image.
Entropic thresholding methods are effective for most real-world images, but a few shortcomings remain.Most importantly, entropic thresholding methods only utilize the distribution of gray level (i.e., one-dimensional (1D) histogram) of an image.As a result, different images with the same histogram may have the same threshold, which is not reasonable.To overcome this shortcoming, many researchers devoted their efforts to integrating spatial correlation information between pixels into the thresholding process.The pioneer work on this point belongs to Abutaleb [13].Abutaleb proposed the concept of a two-dimensional (2D) histogram, which incorporates spatial information as well as the gray-level of pixels to enhance the performance of Kapur's entropic thresholding method.Then, the 2D histogram was adopted by several authors to improve the performance of thresholding methods based on 1D histograms.In [14], a two-dimensional Reny's entropy thresholding method was proposed.A two-dimensional Otsu's thresholding method was proposed in [15].In [16], Tang et al. extended the minimum Tsallis cross-entropy thresholding method to a two-dimensional case.Sahoo and Arora [17] proposed a 2D Tsallis entropy thresholding method.
Though improved performance can be obtained, all 2D thresholding methods still have a distinct disadvantage; i.e., they only utilize the information related to background and object, and ignore the information related to edges, in which important information may be contained.Hence, several authors proposed the use of other information reflecting spatial correlation between pixels to construct a 2D histogram.Xiao et al. [18] proposed the gray level spatial correlation (GLSC) histogram, which was constructed using the gray value of pixels and and their similarity with neighboring pixels.In Reference [19], a 2D direction (2D-D) histogram was proposed by using the local edge property computed from the orientation histogram of a gradient image.After analyzing the drawbacks of GLSC and 2D-D, Xiao et al. [20] proposed another 2D histogram; i.e., the gray-level and gradient magnitude (GLGM) histogram.GLGM utilizes the gradient magnitudes instead of gradient orientation.It was claimed that the 2D-D histogram and the GLGM histogram are more effective than Abutaleb's 2D histogram.Nevertheless, the construction of 2D-D and GLGM histograms are not as convenient as Abutaleb's 2D histogram.For the 2D-D histogram, the gradient orientation is divided into K bins, and the magnitude of the gradient should be filtered using a Gaussian filter with parameter σ.It is difficult to select an appropriate value for K and σ.In addition, to construct the GLGM histogram, anisotropic diffusion filtering (ADF) is performed as a preprocessing step.In ADF, the selection of a conductivity function and its parameter is also difficult.Furthermore, our research results show that the filtering operation in the construction of the 2D-D and GLGM histograms has a great effect on the performance of entropic thresholding methods.
In this paper, a novel thresholding method is presented by taking the spatial information between pixels into consideration.To this end, a novel 2D histogram-called gray level local variance (GLLV) histogram-is constructed from the gray level of pixels and the local variance of its neighboring pixels.The GLLV histogram can effectively capture edge information, and its computation burden is less than that of 2D-D and GLGM histogram.
The rest of this paper is organized as follows.The construction of the GLLV histogram is presented in Section 2. Image thresholding based on GLLV is given in Section 3. The experimental results are presented in Section 4. Finally, the concluding remarks are given in Section 5.

GLLV Histogram
As stated before, taking spatial information into account can enhance the performance of thresholding methods.The spatial information of an image can be represented by its local features, such as local mean [13], gradients [19,20], etc.In this paper, we propose another method to construct a 2D histogram to integrate spatial information into the thresholding process.The proposed method is based on the local variance of a pixel and not the gradient information, as in 2D-D and GLGM histograms.

Local Feature of Image via Local Variance
In probability theory, variance is a measure of the dispersion of a random variable.If the observations of a random variable are more dispersed, the variance is larger, and vice versa.Generally speaking, in an image, the gray values of pixels inside the objects or background are homogeneous.In other words, their gray values are close to its neighboring pixels, and therefore the local variance of the pixel is small.However, with respect to the pixels located at the boundary between the object and the background, their gray values are obviously different from its neighboring pixels.So, their local variance is large.It is seen that local variance can reflect some certain properties of the edges [21].Based on this observation, in the following, a new 2D histogram called gray level-local variance (GLLV) histogram is constructed.
For each pixel at (x, y), its local variance with neighborhood size n × n is calculated as where I(x, y) is the mean of pixels in the neighborhood, and is calculated as The local variance of each pixel is normalized as where INT[•] is an operator to get the integer part, and g max and g min denote the maximum and minimum of g(x, y), respectively.L is chosen as 64 according to the experimental conclusion.Letting n ij be the total number of pixel pairs that I(x, y) = i and g(x, y) = j in the image, then the GLLV histogram is defined as Suppose a 2D threshold vector (s, t) divides the GLLV histogram into four regions, where s represents the threshold of the original image and t the threshold of the local variance.Observing that pixels inside the objects and background have small local variance, in the GLLV histogram, Regions 1 and 4 therefore contain the information of objects and background, respectively.Regions 2 and 3 contain information of edges and noise.Since our main task is to segment object from background, we therefore pay much attention to Regions 1 and 4 and ignore Regions 2 and 3. Specifically, The histogram bins with j between t + 1 and L − 1 cover Regions 2 and 3.

Image Thresholding Based on GLLV
Suppose there are two classes in the image; i.e., the background C 0 and object C 1 .As mentioned above, Regions 1 and 4 contain the background and object, respectively.Let P 0 and P 1 be the probability of the object and background, respectively.They are calculated as where Then, the normalized posteriori class probabilities of the object and background are C 0 : and The Shannon entropy of background and object are and Then, the total Shannon entropy of background and object are According to maximum entropy principle [17,22], the optimum threshold (s * , t * ) are determined by maximizing T(s, t); i.e., (s * , t * ) = arg max T(s, t)

Experimental Results and Discussion
In this section, the proposed method is tested on various images and compared to other thresholding methods, including Kapur's 1D entropic method (1D KSW), Abutaleb's 2D approach (2D KSW), Xiao's GLSC proposition (GLSC KSW), and Xiao's GLGM proposition (GLGM KSW).These methods are implemented on an Intel Celeron 2.7 GB platform with 1.89 GB RAM using Matlab.The test images are Blood (272 × 265), Ant (331 × 240), Stele (545 × 360), Ceram (321 × 481), Bird (481 × 321), Bacteria (178 × 178), Boat (256 × 308), Factory (185 × 254), in which some of them are taken from the Berkeley segmentation dataset [23], and some of them are taken from related references. Figure 2 shows all the test images, their ground-truth images, and their local variance images.The ground true images are usually obtained via manual segmentation.In our paper, if the test images are from a dataset, the ground true are also taken from the same dataset, and if the test images are taken from reference, the ground true are also taken from references.The segmentation results obtained by different approaches are shown in Figure 3.
As is shown in Figure 3, for the Blood image, the proposed method gives the best result, and the other four methods cannot produce fully correct segmentation results.The segmentation results of image Ant and the Bacteria by the five methods are similar and acceptable.It can be seen in the segmentation results of the Stele image, except for the resulted image produced by 1D KSW, the other four thresholded images are basically the same.However, upon closer observation, the sky area obtained by our proposed method shows better.The results of the Bird image segmented by the GLSC KSW, GLGM KSW, and our proposed method also have a little difference, but our proposed method gives the better segmentation result.Seen from the results of the Ceram image, the 2D KSW, GLSC KSW, and GLGM KSW methods do not give satisfactory segmentation results, while the other two methods produce acceptable results.For the last two images (Boat and Factory), the proposed method and the 1D KSW yield good threshold results; however, the 2D KSW, GLSC KSW, and GLGM KSW are not suitable.To evaluate the efficiency and accuracy of the proposed method, the misclassification error (ME) is adopted, which is only limited to the case of bi-level threshold evaluation.The results of ME for each image are used to illustrate the accuracy of the five thresholding methods.
ME is an important index that reflects the percentage of background pixels wrongly assigned to the objects, and conversely, foreground pixels wrongly assigned to the background.For a two-class segmentation, ME [24,25] can be simply formulated as where B o and F o denote the background and foreground of the original (ground-truth) image, respectively, B T and F T are the counterparts in the thresholded images, respectively, and |.| represents the cardinality of a set.Note that the value of ME varies from 0 for a perfectly well classified image to 1 for a completely wrongly classified one.The lower the value of ME, the better the quality of the corresponding thresholded image.Table 1 shows the results of ME of the thresholded images obtained by the five methods, which makes it clear that the proposed method can extract the objects from the background more completely, compared with the other four methods.

Conclusions
In this paper, a new thresholding method is proposed for image segmentation.First, a novel 2D histogram-called GLLV histogram-is constructed by using the gray level information of pixels and the local variance information.Then, optimal threshold values are selected by maximizing the Shannon entropy of objects and background, which are calculated according to the GLLV histogram.In the GLLV histogram, local variance can reflect the edge information of pixels in a neighborhood in a simple way, and thus, the GLLV histogram can effectively incorporate spatial information into the thresholding procedure.Experimental results and comparisons with other typical thresholding methods show that the proposed method is superior to traditional thresholding methods, including a 1D histogram-based thresholding method and several 2D histogram-based thresholding methods reported recently.The proposed method can be considered a promising and viable method in image segmentation.

Table 1 .
Misclassification error (ME) comparison of the referenced thresholding methods.