Threshold selection by clustering gray levels of boundary

https://doi.org/10.1016/S0167-8655(03)00037-0Get rights and content

Abstract

In this paper, threshold selection is considered in the continuous image rather than in digital image. We prove that, for each given object within 2D image, its optimal threshold is determined by the mean of the gray values of the points lying on its continuous boundary. Thus, we try to deduce threshold from the gray values of the boundary rather from the gray values of the given discrete sampling points (pixels or edge pixels). By the scheme, we well overcome some disadvantages existing in the threshold methods based on the histogram of edge pixels. Besides, the proposed method has the ability to well handle the image whose histogram has very unequal peaks and broad valley.

Introduction

A popular tool used in image segmentation is thresholding. Thresholding assumes that image present a number of components, each of a nearly homogeneous value, and that one can separate the components by a proper choice of intensity threshold. Many thresholding techniques are proposed in 2D image processing (Sahoo et al., 1988; Rosenfeld and Kak, 1982), including the thresholding methods selecting threshold by analyzing histogram of whole image (Olivo, 1994; Otsu, 1979; Glasbey, 1993; Kapur et al., 1985), the thresholding methods selecting threshold from histogram of edge pixels (Weszka et al., 1974; Wang and Haralick, 1984; Milgram and Herman, 1979; Katz, 1965; Yanowitz and Bruckstein, 1989), etc. In this paper, we will present a new method on threshold selection.

In this paper, 2D image is treated as the discrete sampling of the underlying 2D continuous function represented as f(x,y). Therefore, the boundary of the objects within 2D image actually should be some implicitly defined continuous curves determined by f(x,y). We know that, the boundary usually is such curve on the either side of which gray values have sharp change. Thus, in terms of computer vision theory, each boundary consists of such points that are zero-value points of the Laplacian function of 2D image and have high gradient values (Marr and Hildreth, 1980; Haralick, 1984). Mathematically, the boundaries within 2D image could be represented as follows:l(x,y)=0Δf(x,y)∥⩾Twherel(x,y)=2fx2+2fy2andΔf(x,y)∥=fx2+fy2represent the Laplacian function and gradient magnitude function of f(x,y), respectively. T is a predefined gradient threshold. Sometimes, it is selected adaptively in different local neighborhood as that in (Peter and David, 1996; Jung and Park, 1988). Each point lying on boundary has an intermediate gray value between object and background gray levels as illustrated in Fig. 1, where, O is a boundary point of 1D continuous function and has an in between gray value. Thus, the boundary of object within 2D image is a continuous curve that separates pixels of the object from pixels of the background, and has the gray level ranges between the object and the background gray levels in the sense of statistics. However, the points lying on boundaries differ from the edge pixels detected by 2D edge detection techniques. Meanwhile, the gray values of boundary points differ from the gray values of the edge pixels. The edge pixels usually have the gray values belonging to object or background.

In principal, for each object within 2D image, its boundary is the exact curve separating the object from background. Thus, we try to deduce the optimal threshold from the object’s boundary. It is obvious that, better a threshold approximate the gray values of the points lying on the object’s boundary in the sense of least square error, better the threshold separates the pixels of the object from the pixels of the background. Thus, we think that, for each object in 2D image, gray level that approximates the gray values of the points lying on the object’s boundary with least square error will determine an optimal threshold for this object. In other words, let C(x,y) represent the boundary of one object within 2D image. Then the optimal threshold for the object is determined by the solution of the following optimization problem:minrC(x,y)(f(x,y)−r)2d(x,y),r∈Rwhere, C(x,y)(f(x,y)−r)2d(x,y) represents the integration of error function (f(x,y)−r)2 over the boundary curve C(x,y). Thus, the problem of selecting optimal threshold for one object within 2D image is converted into the problem of solving above optimization problem (2) for the object.

In this paper, we will solve the optimization problem (2) and present a new method to select multiple optimal thresholds for different objects within 2D image.

Thresholding techniques selecting threshold from the histogram of 2D image assume that gray values of each object are possible to cluster around a peak of the histogram of 2D image and try to directly compute the location of valley or peaks from the histogram (Sahoo et al., 1988; Rosenfeld and Kak, 1982; Olivo, 1994; Otsu, 1979; Glasbey, 1993; Kapur et al., 1985). However, in many cases, interesting structures within 2D image only occupy a small percentage of the whole image, such as bone in CT image, signature in a sheet, and etc. In these cases, histogram of whole image exhibits several peaks of very unequal amplitude separated by a broad valley or contains only one peak and a “shoulder”. For images with such histogram, interesting structures cannot be well “seen” or “recognized” directly from the histogram of whole image, and the threshold methods based on the histogram of image are limited.

Thresholding techniques selecting threshold from histogram of edge pixels can overcome the above difficulty to some extent (Weszka et al., 1974; Wang and Haralick, 1984; Milgram and Herman, 1979; Katz, 1965; Yanowitz and Bruckstein, 1989). In many cases, they can handle image whose histogram has very unequal peaks or broad valley very well. They are based on the fact that, no matter how much percentage one object occupies in the whole 2D image, its threshold actually is possible to be deduced from the gray levels of the edge pixels of this object. Katz (1965) pointed out that since the pixels in the neighborhood of an edge have higher edge values, the gray level histogram for these pixels should have a single peak at a gray level between the object and the background gray levels. This gray level is, therefore, a suitable choice of the threshold value. It provides the basis for designing threshold selection method based on histogram of edge pixels.

Weszka et al. (1974) suggested a bi-level thresholding method. They first filter 2D image by a Laplacian operator, and then select the valley of histogram of pixels with high Laplacian value (edge pixels) as threshold.

Wang and Haralick (1984) proposed a multi-threshold selection method based on the histogram of edge pixels. In their methods, edge pixels are first classified, on the basis of their neighborhoods, as being relatively dark or relatively light. Then two histograms of gray level are obtained respectively for these two sets of edge pixels. Threshold is selected as one of the highest peaks of the two histograms. By recursively using the procedure, the multiple thresholds can be obtained.

Milgram and Herman (1979) selected thresholds from images containing several object classes by clustering thinned edge pixels in a 2D histogram whose axes represent gray level value and edge value. Where, each such edge cluster suggests its average gray level as a threshold.

Similar method as above introduced ones is applied to select local adaptive threshold (Yanowitz and Bruckstein, 1989). Where, 2D image is partitioned into several non-overlapping sub-images of equal area, and a threshold for each sub-image is selected from histogram of edge pixels of the sub-image by similar method as that in the references (Wang and Haralick, 1984; Milgram and Herman, 1979).

Thresholding techniques based on the histogram of edge pixels try to deduce the threshold from the gray values of edge pixels. We know that, because of the “double responding” phenomenon of edge pixels, the pixels closely distributing both side of the boundary are detected out by edge detector. Generally, the “double responding” edge pixels could be categorized into two classes: one belongs to object and has the gray value of object, and another belongs to background and has the gray value of background. Thus, the histogram of edge pixels of each object has two peaks (clusters) with similar amplitude (see Fig. 2). One peak (cluster) represents the edge pixels in the background and another represents the edge pixels in the object. Thresholding technique in the reference (Weszka et al., 1974) is based on the fact. However, the technique fails for images having several object classes. In reference (Wang and Haralick, 1984), threshold is selected as one of the higher peaks on the histogram of edge pixels. However, selecting directly threshold from the histogram of edge pixels might mistakenly classify some edge pixels and some pixels around these edge pixels. For example, in Fig. 2, selecting the peak of cluster A as threshold is possible to mistakenly classify some edge pixels in cluster A and some pixels around these edge pixels (they belong to background) into object. In references (Milgram and Herman, 1979; Yanowitz and Bruckstein, 1989), each edge pixel is assigned a new gray value that is the average value of gray values of two adjacent points of this edge pixel. By using the scheme, for each given object, “double-peaks” phenomenon does not appear on the histogram of its edge pixels, and only one peak exists in the histogram of its edge pixels. However, the problem what are the suitable values to be assigned to different edge pixels is still open, and it lacks a clear mathematical explanation.

As we have introduced, thresholding techniques based on the histogram of edge pixels have different drawbacks. In this paper, we will introduce a new threshold method that deduces the optimal threshold from gray values of the points lying on the boundary rather than from histogram of whole 2D image or from histogram of edge pixels. In this way, we well overcome the drawbacks in the thresholding techniques based on the histogram of edge pixels (Weszka et al., 1974; Wang and Haralick, 1984; Milgram and Herman, 1979; Katz, 1965; Yanowitz and Bruckstein, 1989). Meanwhile, comparing with the thresholding techniques based on the histogram of whole 2D image, this method can still well handle image whose histogram has very unequal peaks or broad valley. The proposed method is shown to be effective through lots of examples and by comparing its experimental results with the ones of Otsu’s threshold method (Otsu, 1979) and Kapur’s threshold method (Kapur et al., 1985).

Section snippets

Theoretical analysis on optimal threshold

Let C(x,y) represent a boundary of a given object in 2D image. Recall that, the optimal threshold of this object is the solution of the optimization problem (2). Below, we solve the optimization problem (2). Let F(r)=∫C(x,y)(f(x,y)−r)2d(x,y). To find the threshold that minimizes F(r), we differentiate F(r) with respect to r and set the result to zero:F(r)=∫C(x,y)2·f(x,y)d(x,y)−∫C(x,y)2·rd(x,y)=0Then, we haver=C(x,y)f(x,y)d(x,y)C(x,y)d(x,y)It shows that, solution of the optimization problem

Computation of discrete sampling of gray values of boundaries

Generally, it is impossible to compute the mean of gray values of boundary by analytical method from discrete 2D image. Thus, we will compute discrete sampling of gray values of points lying on the boundaries within 2D image, and estimate the mean from these discrete sampling. We first introduce a method to compute discrete sampling points of the boundaries within 2D image.

In this paper, 2D image is treated as the discrete sampling data sampled from the grid-points of 2D regular grids as shown

Threshold selection method

The discussion above has demonstrated that, for each object within 2D image, the optimal threshold is determined by the mean of the gray values of points lying on its boundary. Besides, the ideal mean could be estimated or deduced from the discrete sampling of gray values of the boundary that are computed by the method introduced in Section 3. In what follows, these results are used in the selection of bi-level threshold or multi-threshold from 2D image.

Analysis of method

In the proposed threshold method, threshold is deduced from the histogram of the discrete sampling points of boundary. Thus, it is useful to enhance the quality of the computed discrete sampling points of boundary. Recall that, non-linear diffusion methods allow a denoising and smoothing of image intensities while retaining and enhancing edges (Weickert, 1998). Thus, in order to enhance the quality of the poor discrete sampling points of boundary, we suggest using non-linear diffusion methods

Discussion and conclusion

In threshold techniques, there are two classes of important methods: the threshold techniques based on the histogram of whole image and the threshold techniques based on the histogram of edge pixels. The former is widely used in image processing. However, they cannot well deal with such images whose histograms exhibit several peaks of very unequal amplitude separated by a broad valley or contain only one peak and a “shoulder”. The later overcomes the mentioned difficulty to some extent and

Acknowledgements

The authors would like to thank the anonymous referee for his/her constructive comments on the earlier version of this paper. This research is partially supported by the Chinese Postdoctoral Science Foundation.

References (19)

There are more references available in the full text version of this article.

Cited by (46)

  • Automatic histogram-based fuzzy C-means clustering for remote sensing imagery

    2014, ISPRS Journal of Photogrammetry and Remote Sensing
    Citation Excerpt :

    He deduced that combining several segmentation maps with his method gave a more reliable and accurate segmentation result than traditional clustering algorithms. Moreover, histogram thresholding is one of the widely used techniques for image segmentation and clustering (Sahaphong and Hiransakolwong, 2007; Dhanalakshmi and Kanimozhi, 2013; Otsu, 1979; Wang and Bai, 2003; Huang et al., 2009; Cheng and Chen, 1999; Sahoo et al., 1988; Tizhoosh, 1997; Koonsanit et al., 2012; Tian et al., 2013). However, many of these developed methods applied to gray level images.

  • Effects of CT image segmentation methods on the accuracy of long bone 3D reconstructions

    2011, Medical Engineering and Physics
    Citation Excerpt :

    In the absence of a standard method of selecting an appropriate threshold level, various techniques have been developed over time [25]. Histogram based selection of the threshold level [26,27] and clustering of grey level of boundary [28] have previously been applied to specific anatomical regions of a long bone or to a small bone (phalanx or tarsal bone). Furthermore, most of these methods have been used with a single threshold level for the segmentation of the whole region.

View all citing articles on Scopus
View full text