Histogram Transformation Based Threshold Selection for Image Segmentation
2.2 Co-occurrence Matrix
Co-occurrence matrix (Jain, 1995) is extensively used in texture analysis. The method is based on the estimation of the second-order joint conditional probability density function, P
d,r(i,j), which is the 2-D matrix. Each P
d,r(i,j) is the probability of going from a gray level I to a gray level j in a given direction r at a given intersample spacing d. The co-occurrence matrix P
d,r is a representation of the estimated values. It is square matrix of dimension N
g, which is the number of gray levels in the image.
Two co-occurrence matrices are derived from the first principal component image, for r=0° and 90°, and d = 1, then summed together. A histogram can be constructed for the gray levels running from 0 to N
g-1. The cumulative frequency of occurring at each level x is defined by the Summation of all matrix elements with rounded -up value of (I+j)/2 equal to x, where I and j are row and column positions of the matrix (Ahuja, 1978).
2.3 Otsu Algorithm
(Otsu, 1979) proposed an algorithm for automatic threshold selection from a histogram of image. Let the pixels of a given image. Let the pixels of a given image be represented in L gray levels [1,2,….L]. The number of pixels at level i is denoted by ni, and the total number of pixels by N=n
1 + n
2 + …. + n
i …. Then suppose that the pixels were dichotomized into two classes C
0 and C
1, which denote pixels with levels [1,… k] and [k+1,…, L], respectively. This method is based on a discriminant criterion, which is the ratio of between-class variance and total variance of gray levels :
The optimal thresholds of an image depend on maximizes
s2B which seems equivalent with h, so as to maximize the separability of the resultant classes in gray levels.
3. Experimental Results
To compare our algorithm with Otsu algorithm, a synthetic image representing three classes of data was used. The original "ground truth" image is shown in Figure 2(a). An observed image, in Figure 2(b), was simulated by adding 15% Gaussian noise to the original one. The segmentation result obtained by the direct application of Otsu algorithm is given in Figure 2(c), compared to the result from the our algorithm in Figure 2(d). It is obvious that our algorithm is given in Figure 2(d). It is obvious that our algorithm is better. The segmentation error or these two methods are also provided in Table 1. The error is reduced from 11.96% to 7.81% when using the histogram transformation technique. In addition, Figure 3 is provided to compare two histograms, One calculated from the image gray values, and another calculated from the co-occurrence matrix. We can see that the classes are more clearly separate from each other in the histogram of Figure 3(a).
Figure 2: (a) Original image. (b) 15% noise added image. (c) Segmented image obtained by Otsu algorithm. (d) Segmented by the proposed algorithm.