Automatic Histogram Threshold Using Fuzzy Measures

In this paper, an automatic histogram threshold approach based on a fuzziness measure is presented. This work is an improvement of an existing method. Using fuzzy logic concepts, the problems involved in finding the minimum of a criterion function are avoided. Similarity between gray levels is the key to find an optimal threshold. Two initial regions of gray levels, located at the boundaries of the histogram, are defined. Then, using an index of fuzziness, a similarity process is started to find the threshold point. A significant contrast between objects and background is assumed. Previous histogram equalization is used in small contrast images. No prior knowledge of the image is required.


I. INTRODUCTION
I MAGE segmentation plays an important role in computer vision and image processing applications. Segmentation of nontrivial images is one of the most difficult tasks in image processing. Segmentation accuracy determines the eventual success or failure of computerized analysis procedures. Segmentation of an image entails the division or separation of the image into regions of similar attribute. For a monochrome image, the most basic attribute for segmentation is image luminance amplitude [1].
Segmentation based on gray level histogram thresholding is a method to divide an image containing two regions of interest: object and background. In fact, applying this threshold to the whole image, pixels whose gray level is under this value are assigned to a region and the remainder to the other. Histograms of images with two distinct regions are formed by two peaks separated by a deep valley called bimodal histograms. In such cases, the threshold value must be located on the valley region. When the image histogram does not exhibit a clear separation, ordinary thresholding techniques might perform poorly. Fuzzy set theory provides a new tool to deal with multimodal histograms. It can incorporate human perception and linguistic concepts such as similarity, and has been successfully applied to image thresholding [2]- [9].
The remainder of this paper is organized as follows. In Section II a background review on thresholding methods is N. Vieira Lopes is with the Department of Electrical Engineering, Escola Superior de Tecnologia e Gestão -IPL, Campus  presented. A general description of the fuzzy set theory and index of fuzziness measuring is presented in Section III. The existing method is described in Section IV. The proposed method is presented in Section V. Limitations and detected problems of the existing method are also discussed. Section VI shows comparative results to illustrate the effectiveness of the proposed approach and Section VII presents the final conclusions.

II. THRESHOLDING ALGORITHMS
In general, threshold selection can be categorized into two classes, local and global methods. Using global thresholding methods an entire image is binarized with a single threshold, while the local methods divide the given image into a number of sub-images and select a suitable threshold for each subimage. The global thresholding techniques are easy to implement and computationally less demanding, therefore they are more suitable than local methods in terms of many real image processing applications. Many different approaches are used in image thresholding.
Rosenfeld's convex hull method is based on analyzing the concavity structure of the histogram defined by its convex hull [10]. When the convex hull of the histogram is calculated, the deepest concavity points become candidates for the threshold value. A variation of this method can be found in [11].
Ridler and Calvard algorithm [12] uses an iterative technique for choosing a threshold value. At iteration n, a new threshold T n is established using the average of the foreground and background class means. The process is repeated until the changes in T n become sufficiently small.
Otsu's technique [13] is based on discrimination analysis, in which the optimal threshold value calculation is based on the minimization of the weighted sum of the object and background pixels within-class variances.
In Kittler and Illingworth's minimum error thresholding method it is assumed that the image can be characterized by a mixture distribution of object and background pixels [14].
Jawahar et al. [6] propose a fuzzy thresholding scheme based on Fuzzy C-means clustering. The problem of fuzzy clustering is that of partitioning the set of n sample points into c classes. The algorithm is an iterative optimization that minimizes one cost function. Two extensions of this algorithm are found in [7] and [3].
Kapur et al. [15] propose a method based on the previous work of Pun [16] that first applied the concept of entropy to thresholding. This method interprets the image object and background as two different information sources. When the sum of the object and background entropies reaches its maximum, the image is said to be optimally thresholded.
Huang and Wang [8] assign the memberships to the pixel with the help of the relationship between its gray value and mean gray value of the region to which it belongs. In this case, the image is regarded as a single fuzzy set where the membership distribution reflects the compatibility of the pixels to the region to which it belongs.
An exhaustive survey of image thresholding methods can be found in [17].

A. Fuzzy Set Theory
Fuzzy set theory assigns a membership degree to all elements among the universe of discourse according to their potential to fit in some class. The membership degree can be expressed by a mathematical function µ A (x i ) that assigns, to each element in the set, a membership degree between 0 and 1. Let X be the universe (finite and not empty) of discourse and x i an element of X. A fuzzy set A in X is defined as The S-function is used for modeling the membership degrees [18]. This type of function is suitable to represent the set of bright pixels and is defined as where b = 1 2 (a + c). The S-function can be controlled through parameters a and c. Parameter b is called the crossover point where µ AS (b) = 0.5. The higher the gray level of a pixel (closer to white), the higher membership value and vice versa. A typical shape of the S-function is presented in Fig. 1. The Z-function is used to represent the dark pixels and is defined by an expression obtained from S-function as follows Both membership functions could be seen, simultaneously, in Fig. 2. The S-function in the right side of the histogram and the Z-function in the left.

B. Measures of fuzziness
A reasonable approach to estimate the average ambiguity in fuzzy sets is measuring its fuzziness [19]. The fuzziness of a crisp set should be zero, as there is no ambiguity about whether an element belongs to the set or not. If µ A (x) = 0.5, ∀x, the set is maximally ambiguous and its fuzziness should be maximum. Degrees of membership near 0 or 1 indicate lower fuzziness, as the ambiguity decreases. Kaufmann in [20] introduced an index of fuzziness (IF) comparing a fuzzy set with its nearest crisp set. A fuzzy set A * is called crisp set of A if the following conditions are satisfied This index is calculated by measuring the normalized distance between A and A * defined as where n is the number of elements in A, k ∈ [1, ∞[. Depending if k = 1 or 2, the index of fuzziness is called linear or quadratic. Such an index reflects the ambiguity in a set of elements. If a fuzzy set shows low index of fuzziness there exists a low ambiguity among elements.

IV. EXISTING METHOD
This work is an improvement of an existing method based on a fuzziness measure to find the threshold value in a gray image histogram [4], [5]. The method incorporates fuzzy concepts that are more able to deal with object edges and ambiguity and avoids the problems involved in finding the minimum of a function. However it has some limitations concerning the initialization of the seed subsets. To achieve an automatic process these limitations must be overcome. In order to implement the thresholding algorithm on a basis of the concept of similarity between gray levels, Tobias & Seara made the assumptions that there exists a significant contrast between the objects and background and that the gray level is the universe of discourse, a one-dimensional set, denoted by X. The purpose is to split the image histogram into two crisp subsets, object subset O and background subset F , using the measure of fuzziness previously defined. The initial fuzzy subsets, denoted by B and W , are associated with initial histogram intervals located at the beginning and the end regions of the histogram. The gray levels in each of these initial intervals have the intuitive property of belonging with certainty to the final subsets object or background. For dark objects B ⊂ O and W ⊂ F , for light objects B ⊂ F and W ⊂ O. These initial fuzzy subsets, W and B, are modeled by the S and Z membership functions, respectively. The parameters of the S and Z functions are variable to adjust its shape as a function of the set of elements [5].
These subsets are a seed for starting the similarity measure process. A fuzzy region placed between these initial intervals is defined as depicted in Fig. 2. Then, to obtain the segmented version of the gray level image, we have to classify each gray level of the fuzzy region as being object or background. The classification procedure is done by adding to each of the seed subsets a gray level x i picked from the fuzzy region. Then, by measuring the index of fuzziness of the subsets B ∪ {x i } and W ∪ {x i }, the gray level is assigned to the subset with lower index of fuzziness (maximum similarity). Applying this procedure for all gray levels of the fuzzy region, we can classify them into object or background subsets. Since the method is based on measures of index of fuzziness, these measures need to be normalized by first computing the index of fuzziness of the seed subsets and calculating a normalization factor α according to where ψ(W ) and ψ(B) are the IF's of the subsets W and B, respectively. This normalization operation ensures that both initial subsets have identical index of fuzziness at the beginning of the process. It is a necessary condition since the method is based in the calculation of similarity between gray levels. Fig. 3 illustrate how the normalization works. For dark objects the method can be described as follows: 1. Compute the normalization factor α; 2. For all gray levels x i in the fuzzy region compute ψ For light objects the method performs similarly except for the set inclusion in step 3. In this case, if ψ(W ∪{x i }) is lower than αψ(B ∪ {x i }), then x i is included in set O, otherwise x i is included in set F .

V. PROPOSED METHOD
The concept presented above sounds attractive but has some limitations concerning the initialization of the seed subsets. In [5] these subsets should contain enough information about the regions and its boundaries are defined manually. The proposed method in this paper aims to overcome some of the limitations of the existing method. In fact, the initial subsets are defined automatically and they are large enough to accommodate a minimum number of pixels defined at the Fig. 2. Histogram and the functions for the seed subsets [5] beginning of the process. This minimum depends on the image histogram shape and it is a function of the number of pixels in the gray level intervals [0, 127] and [128,255]. It is calculated as follows where P 1 ∈ [0, 1] and h(x i ) denotes the number of occurrences at gray level x i . Equation ( 7) can be seen as a special case of a cumulative histogram. However, in images with low contrast the method performs poorly due to the fact that one of the initial regions contain a low number of pixels. So, previous histogram equalization is carried out in images with low contrast aiming to provide an image with significant contrast. If the number of pixels belonging to the gray level intervals [0, 127] or [128, 255] is smaller than a value P MIN defined by P MIN = P 2 M N , where P 2 ∈ [0, 1] and M , N are the dimensions of the image, the image histogram is equalized.
Equalization is carried out using the concept of cumulative distribution function [21]. The probability of occurrence of gray level x i in an image is approximated by For discrete values the cumulative distribution function is given by Thus, a processed image is obtained by mapping each pixel with level x i in the input image into a corresponding pixel with level s i = T (x i ) in the output image using (9).
A. Calculation of parameters P 1 and P 2 To obtain the parameters P 1 and P 2 a statistical approach is used. Parameters P 1 and P 2 are concerned with the number of pixels of the initial intervals and histogram equalization, respectively. As the parameters are not mutually related, the statistical study is made independently.  Fig. 3. Normalization step and determination of the threshold value [5] In this study, 30 test images are used. To determine the parameter P 1 the images in the data base presenting a significant contrast are used. Such images exhibit a significant distribution of pixels' gray levels over the interval [0, 255] and it is not necessary an histogram equalization. For each image, the parameter P 1 is chosen to ensure that both the IFs of the subsets W and B provide an increasing monotonic behavior. If P 1 is too high, the fuzzy region between the initial intervals is too small and the values of gray levels for threshold are limited. On the other hand, if P 1 is too low, the initial subsets are not representative and the method does not converge. With these minimum values of P 1 that ensure the convergence, Table I is constructed and the mean (m) and the standard deviation (σ) are calculated. After analysis of the results, the mean value of P 1 = 39.64% is adopted. To determine the value of P 2 the images with low contrast and parameter P 1 , calculated earlier, are used. These images present a small contrast with most pixels concentrated in half side of the histogram. For these images, the minimum number of pixels in the gray level intervals [0, 127] or [128, 255] that ensures the convergence of the method is obtained by trial and error and the parameter P 2 is calculated. With these minimum values, Table II is constructed and the mean and standard deviation are also calculated. In this work, the value of P 2 = 20% is used.

VI. EXPERIMENTAL RESULTS
In order to illustrate the performance of the proposed methodology, 14 images are randomly selected from our original 30 images database. A manually generated groundtruth image has been defined for each image and used as a gold standard. Original images and their gold standard are illustrated in Fig. 4. Results are compared with two well established methods: the Otsu's technique (OTSU) [13] and Fuzzy C-means clustering algorithm (FCM) [6]. In this way, a comparison between fuzzy and non-fuzzy threshold algorithms is carried out and the results of the three techniques are presented in Fig. 5. Performance is obtained by comparing the gold standard image with the corresponding image provided by the three different methods. To measure such performance, a parameter η, based on the misclassification error, has been used [17]. Thus, where B O and F O are, respectively, the background and foreground of the original (ground-truth) image, B T and F T are the background and foreground pixels in the resulting image, respectively, and |.| is the cardinality of the set. This parameter varies from 0% for a totally wrong output image to 100% for a perfectly binary image. The performance measure for every algorithm is listed in Table III. Mean and standard deviation are also presented. The methods indicated by IM1 and IM2 represent the improved method without and with histogram equalization, respectively. After comparing results, the improved method with histogram equalization provides, in general, satisfactory results with particular attention in images with imprecise edges.

VII. CONCLUSION
In this work, an automatic histogram threshold approach based on index of fuzziness measure is presented. This work overcome some limitations of an existing method concerning the definition of the initial seed intervals. Method convergence depends on the correct initialization of these initial intervals. After calculating the initial seeds a similarity process is started to find the threshold point. This property of similarity is obtained calculating an index of fuzziness. To measure the performance of the proposed method the misclassification error parameter is calculated. For performance evaluation purposes, results are compared with two well established methods: the Otsu's technique and the Fuzzy C-means clustering algorithm.
After results analysis we can conclude that the proposed approach presents a higher performance for a large number of tested images.