- Open Access
Fast two-phase image segmentation based on diffusion equations and gray level sets
Boundary Value Problems volume 2014, Article number: 11 (2014)
In this paper we propose a new scheme for image segmentation composed of two stages: in the first phase, we smooth the original image by some filters associated with noise types, such as Gaussian filters for Gaussian white noise and so on. Indeed, we propose a novel diffusion equations scheme derived from a non-convex functional for Gaussian noise removal in this paper. In the second phase, we apply a variational method for segmentation in the smoothed image domain obtained in the first phase, where we directly calculate the minimizer on the discrete gray level sets. In contrast to other image segmentation methods, there is no need for us to re-initialize parameters, which deduces the complexity of our algorithm to (N is the number of pixels) and provides significant efficiency improvement when dealing with large-scale images. The obtained numerical results of segmentation on synthetic images and real world images both clearly outperform the main alternative methods especially for images contaminated by noise.
Images are the proper 2-D projections of the 3-D world containing various objects. To reconstruct the 3-D world perfectly, at least approximately, the first crucial step is to identify the regions in images that correspond to individual objects. This is the well-known problem as image segmentation which has broad applications in a variety of important fields such as computer vision and medical image processing.
Image segmentation has been studied extensively in the past decades. A well-established class of methods consists of active contour models, which have been widely used in image segmentation with promising results. In general, these models apply variational methods where they minimize some energy functionals depending on the features of the image. Classical ways to solve such problems are to solve the corresponding Euler-Lagrange equations. The existing active contour models can be roughly categorized into two classes: region-based models [1–9] and edges-based models [10–14]. A literature review of major active contour models can be found in [15–17].
Based on image gradient information, edges-based models drive one or more initial curve(s) to the boundaries of objects in the image. However, edges-based models are usually sensitive to noise and weak edges information . Instead of utilizing image gradient information, region-based models typically aim to identify each region of interest by using a certain region descriptor, such as intensity, color, texture, to guide the motion of the contour . Therefore region-based models tend to rely on global information to steer contour evolution, which increase the chance to have better performance in the presence of image noise and weak object boundaries. In addition, region-based models are less sensitive to the initial contour locations than edge-based models. For instance, Chan and Vese  developed an active contour without edge model to deal with image segmentation by using the level-set framework introduced by Osher and Sethian , which is similar to the segmentation method independently proposed by Tsai et al. . The active contour methods based on level-set framework have several following advantages. Firstly, they can deal with topological changes such as breaking and merging. Secondly, intrinsic geometric elements such as the normal vector and the curvature can be easily interpreted with respect to the level-set function. Finally, this level-set framework can be extended and applied in any dimension.
However, these active contour methods based on level-set framework have some drawbacks. Firstly, most of these methods have initialization problems: different initial curves produce different segmentations because of the non-convexity of Chan-Vese models . Secondly, these methods are usually implemented by solving corresponding evolution equations that suffer from severe numerical stability constrains which render them inefficient. For instance, Chan-Vese models become severely inefficient due to the signed distance re-initialization procedure for stability reason. Recently, some researchers developed fast algorithms [18–23] to the Chan-Vese image segmentation model to avoid these drawbacks above. In [18–21], the authors developed fast algorithms based on calculating the variational energy of the Chan-Vese model directly without the length term. In , the authors proposed a fast method for image segmentation without solving the Euler-Lagrange equation of the underlying variational problem proposed by Chan and Vese, therefore they calculated the energy directly and checked if the energy is decreased when they change a point inside the level set to outside or vice versa.
In this paper we develop a two-phase image segmentation model. In the first phase, we propose a new non-convex functional to get the smoothing image of the original image for noise removal, resulting in the sharpened edge. We also prove the nonexistence of the minimizer of the non-convex functional above. Noted that this purpose may be accomplished by other smoothing filters, for example, the Gaussian low-pass filter in the general case. In the second phase, a new functional based on gray level sets is firstly proposed, and then the associated discrete model based on the discrete gray level sets is discussed, which educes the new segmentation algorithm to obtain the segmentation results. Each stage is independent and thus the method at each stage is flexible. Although the new methods share some similarities to those in [18–20], it is a new framework that we calculate the energy directly on discrete gray level sets. Furthermore, we discuss other complicated issues which are not considered in , such as sensitivity to noise. Last but not least, our segmentation method can also deal with large-scale images because of the following reasons. Firstly, we do not need the initial conditions and the procedure of re-initiation as we directly calculate the minimizer on the discrete gray level sets rather than solving the Euler-Lagrange equation of the underlying variational problem. Secondly, in the second stage of our algorithm, the main computation process, which is adding operators and logical operators which cost little CPU time, deduces the complexity of the algorithm to .
This paper is organized as follows. In Section 2, we propose two-phase segmentation model. Experimental results are given in Section 3, and the final section is our conclusion.
2 Two-phase segmentation model
In this section, we show a two-stage scheme for implementation of the piecewise constant segmentation model. More precisely, the smoother version of the original image is first obtained by some smooth filter, and then, minimizing the Chan-Vese minimal variance criterion on the gray level sets, the image is divided into two subregions. Based on the idea above, we deal with the problem in two phases, respectively. Firstly, we propose a new denoising functional to obtain smoothing images. Secondly, we consider the continuous model of the new two-phase segmentation model based on gray level sets to propose the associated discrete model and then obtain a new algorithm.
2.1 The non-convex functional for Gaussian noise removal
In our two-phase algorithm, the second phase is fixed and can be easily performed and the new method depends in a large part on the smooth version u of the original image. So it is better to use different edge-preserving denoising models for various types of noise.
According to conclusions in , the non-convex functional may provide better or sharper edges than the convex functional does. In the smoothing phase of our method, the following edge-preserving denoising model is considered
where . Note that for , the model is non-convex, so the edges will be protected and even enhanced. However, the model above is an ill-posed problem. According to the proof given by Chipot et al. , we have the following theorem.
Theorem 2.1 If is not a constant and , the function has no minimizer in and .
Proof We only prove the one-dimensional case , and the same proof goes for .
By density, we may always find a sequence of step functions such that
In fact, we can find a partition such that is the constant on each interval , with . Let us set . Next, we define a sequence of continuous functions by
and then taking the limit on both sides yields
Now, if there exists a minimizer , then necessarily , which implies
The first equality is possible only if , and in this case the second equality implies , which is possible only if f is a constant. Therefore, excluding this trivial case, has no minimizer in . □
Remark 2.1 As we all know, if the region Ω is bounded,
Note that , and therefore
However, we cannot obtain any information about the minimizer of in .
From the Euler-Lagrange equation for (2.1), we can obtain the following diffusion equation:
Remark 2.2 (Segmentation for various types of noisy image)
There are lots of methods to obtain the smooth image in the first phase of the new method.
If the type of noise is ‘salt and pepper’, for example, the AMF (adaptive median filter) can be selected;
If the noise is ‘addition Gaussian noise’, for example, the Gaussian lower-pass filter, the new non-convex functional (2.1), the TV method (total variation model) , the PM method (Perona-Malik model) , and other anisotropic diffusion  methods can be used to smooth the original image;
If the noise is ‘multiplication noise’, for example, the SO method (Shi-Osher Model), which is an effective multiplicative noise removal model , can be used to denoise the original image.
2.2 Chan-Vese minimal variance criterion based on gray level sets
First let us review the following Chan-Vese minimal variance criterion
Assume that the smooth image u is the solution from diffusion equations (2.2)-(2.4). Let be the K-level set of u. It is clear that for the noise image, is disorderly and irregular; while for the smooth image, is smooth and regular. These basic facts are illustrated in Figure 1, where some are very close to the real edges of the original image.
Hence, the level-set function can be replaced by the image gray function u in the Chan-Vese minimal variance criterion , and the new model is as follows:
and the Heaviside function H
Minimizing the function above, the best threshold is obtained, and then the image is segmented into two subregions and .
and for ,
Theorem 2.2 Assume , and then there exists the minimizer of . Furthermore, if f is not a constant function, then the minimizer is the minimum point with .
Proof If , and , there exists the minimizer of . Noted that get the minimal at , and then
which implies that the minimizer is the minimum point. By the Fermat theorem, we obtain that there exists such that . □
For any images we can always obtain the function . Figure 2(d) shows the function for the image in Figure 2(a). From the figure, we can see that has the global minimizer and has several local minimizers.
Based on the new model (2.6), the two-phase algorithm is sketched below.
(Smoothing) By (2.2)-(2.4) obtain some appropriate smooth version u of the noise image f.
(Minimal variance) Calculate the new model (2.6) for each , and then obtain the minimizer with . The segmentation results are and .
2.3 Discrete version of model (2.6)
Let , for , be the gray level of a true M-by-N image u at pixel location , and let be the range of the smooth image u, i.e., . Let and , and then the image u is divided into two regions. Instead by , and by , respectively. Then minimizing the energy (2.5) is changed into minimize
where is the number of pixels in , and is the number of pixels in . If the energy F reaches a minimum, the best segmentation results are obtained, i.e., the subregion and subregion .
It is noticed that since the selection of and is arbitrary, there are lots of pairs , so minimizing the energy F is difficult. Now, we introduce the following definition, which contains a limited number of elements.
Definition 2.1 (Discrete gray level set)
The K-discrete gray level set , which is the set of pixel location , is defined as follows
where is the gray level of the image u at pixel location .
For any , the image u is divided into two subregions, i.e., and . Then . Let , and then the element number of the set is which is less than 256 in general. Then minimizing the energy (2.6) is changed into minimize
Proof It is clear that . We only need to prove .
From Theorem 2.2, there exist two subdomains and such that
Without loss of generality, assume and there exist and such that . Denote and . Note that , , and .
Having compared the energy and , we get
Since , we have
So we get
Since , it is a contradiction. Therefore, for any , , we have . Hence there exists such that , i.e., . We complete the proof of the theorem. □
From (2.8) and (2.9), we can easily see that
Hence we have the following.
Theorem 2.4 is equivalent to
where , and is defined as (2.11).
Now, if the energy functional E reaches a maximum, the best segmentation results are obtained, i.e., the subregion and subregion . Since , the energy functional E has cases, and then the maximum of E is easily found. The algorithm in the second phase is sketched below.
Algorithm 2.2 The method of maximizing the following functional E
Sweep the image u once, record the number of all pixels at every gray level of the image u which range from to .
Calculate the energy by (2.16) for , and find the maximizer .
The image u is divided into two subregions, i.e., and .
Based on Algorithm 2.2, the following is the new two-phase scheme for image segmentation.
(Smoothing) For the input noise image f, use the Gaussian smooth filter or diffusion equations (2.2)-(2.4) to obtain the smooth image u (if the input image is noiseless, this step is optional).
(Minimal variance) Use Algorithm 2.2 to obtain the segmentation results for the smooth image u.
In this section, numerical examples on some synthetic and real world images are presented to illustrate the efficiency and effectiveness of our new two-phase scheme. The simulations are performed in Matlab R2007b on a 2.8 GHz Pentium 4 processor. For comparison purpose, the Chan-Vese method (CVM)  is also tested. We utilize a locally one-dimensional (LOD) scheme adopted for CVM, which is an unconditional scheme .
3.1 Configuration of smoothing filter
In the new algorithm, the first stage is smoothing the original image. The low-pass filtering is generally made by convolution with Gaussian of an increasing variance. Koenderink  noticed that the convolution of signal with Gaussian at each scale was equivalent to the solution of the heat equation with the signal as initial datum f, i.e.,
FFT (fast Fourier transform algorithm), the classical five-point explicit numerical schemes and the additive operator splitting (AOS) schemes can be used for the heat equation. In our experiment, we will use the Gaussian low-pass filter as one smoothing method in the first phase. For simplicity, we refer to the method as GLF-GLS (Gaussian low-pass filter-gray level set).
On the other hand, using the scheme in , problems (2.2)-(2.4) can be discretized as
where is the set of the two neighbors of pixel i (boundary pixels have only one neighbor). AOS schemes with large time steps still reveal average grey value invariance, stability based on extremum principle, Lyapunov functionals, and convergence to a constant steady-state . The AOS scheme is less than twice the typical effort needed for the PM scheme, a rather low price for gaining absolute stability . Hence, in our numerical experiments, the AOS scheme is considered as the other smoothing method in the first phase. For simplicity, we refer to the two-phase method with the smoothing method as DE-GLS (diffusion equation-gray level set).
3.2 Segmentation performance
In Figure 3, we illustrate the performance of CVM, GLF-GLS and DE-GLS on the synthetic noise Test01 image (size: ). Among the segmentations, all algorithms give similar and good performances. For CVM (the Chan-Vese method), utilizing the unconditional LOD scheme, the time step size can be sufficiently large to reduce the iteration steps (only 5/12 steps in Table 1). However, re-initializing the level-set function costs a lot of CPU time (Table 1). In the new method, GLF-GLS cost very little time (Table 1) and for DE-GLS, it not only costs little time, but also has a very good segmentation result, especially for some singular information, such as corners and edges of the image.
In Figures 4 and 5, we illustrate the results of GLF-GLS and DE-GLS about the real brain and ultrasound image. Few differences between the segmented images are observed, but our method works much faster than CVM (Table 1).
3.3 Computational complexity
We end this section by considering the complexity of our algorithm. Our algorithm requires two phases: smoothing the original image and segmentation. Smoothing the original image is done by the AOS scheme, which is very efficient, and the complexity of this stage is , where N is the number of pixels in the image  and so is the Gaussian low-pass filter. In the second segmentation stage, our algorithm only sweeps the image once, so the complexity of the stage is no more than . In Table 1, we compare the CPU time needed for all three algorithms. Especially, we see that our algorithm GLF-GLS is about 0.01-0.08 seconds and is the fastest out of the three algorithms.
In this paper, we have proposed and implemented a novel image segmentation algorithm based on the Chan-Vese active contour model. The discrete gray level-set method is employed in our numerical implementation. This algorithm works in two steps, we first smooth the noisy image by using the heat equation filter method, and then we utilize the new discrete gray level-set method to segment the region of the original image. The proposed new segmentation algorithm does not require the initialization of the level-set functions, which is a difficult problem in the Chan-Vese segmentation algorithm. Each step of the proposed new segmentation algorithm is simple and easily implemented. In the first step, there are a lot of algorithms to get the smoothing version of the original image, and in the second step, we only sweep the image once and calculate (2.16) at every gray level (in fact, only 256 gray level sets) and find the optimal gray level. In Table 1, we show the CPU time of the Chan-Vese method and our proposed method. Obviously, our method is much more efficient than the Chan-Vese method.
Mumford D, Shah J: Optimal approximation by piecewise smooth functions and associated variational problems. Commun. Pure Appl. Math. 1989, 42: 577-685. 10.1002/cpa.3160420503
Chan TF, Vese LA: Active contours without edges. IEEE Trans. Image Process. 2001, 10(2):266-277. 10.1109/83.902291
Tsai A, Yezzi A, Willsky AS: Curve evolution implementation of the Mumford-Shah functional for image segmentation, denoising, interpolation, and magnification. IEEE Trans. Image Process. 2001, 10(8):1169-1186. 10.1109/83.935033
Gao S, Bui T: Image segmentation and selective smoothing by using Mumford-Shah model. IEEE Trans. Image Process. 2005, 14(10):1537-1549.
Vese L, Chan TF: A multiphase level set framework for image segmentation using the Mumford and Shah model. Int. J. Comput. Vis. 2002, 50(3):271-293. 10.1023/A:1020874308076
Chan TF, Yezrielev Sandberg B, Vese LA: Active contours without edges for vector-valued images. J. Vis. Commun. Image Represent. 2000, 2(11):130-141.
Paragios N, Deriche R: Geodesic active regions and level set methods for supervised texture segmentation. Int. J. Comput. Vis. 2002, 46(3):223-247. 10.1023/A:1014080923068
Kimmel R: Fast edge integration. In Level Set Methods and Their Applications in Computer Vision. Springer, New York; 2003. Chapter 3
Li C, Huang R, Ding Z, Gatenby C, Metaxas D, Gore J: A variational level set approach to segmentation and bias correction of medical images with intensity inhomogeneity. Lecture Notes in Computer Science 5242. In Proceedings of Medical Image Computing and Computer Aided Intervention (MICCAI). Part II. Springer, Berlin; 2008:1083-1091.
Kass M, Witkin A, Terzopoulos D: Snakes: active contour models. Int. J. Comput. Vis. 1987, 1(4):321-331.
Caselles V, Catte F, Coll T, Dibos F: A geometric model for active contours. Numer. Math. 1993, 66: 1-31. 10.1007/BF01385685
Malladi R, Sethian JA, Vemuri BC: Shape modeling with front propagation: a level set approach. IEEE Trans. Pattern Anal. Mach. Intell. 1995, 17(2):158-175. 10.1109/34.368173
Xu C, Prince J: Generalized gradient vector flow external forces for active contours. Signal Process. 1998, 71(2):131-139. 10.1016/S0165-1684(98)00140-6
Li C, Xu C, Gui C, Fox MD: Level set evolution without reinitialization: a new variational formulation. 1. Proceedings of IEEE Conference on Computer Vision and Pattern Recognition (CVPR) 2005, 430-436.
Osher S, Paragios N: Geometric Level Set Methods in Imaging, Vision, and Graphics. Springer, New York; 2003.
Jain AK, Zhong Y, Dubuisson-Jolly M: Deformable template models: a review. Signal Process. 1998, 71(2):109-129. 10.1016/S0165-1684(98)00139-X
Cremers D, Rousson M, Deriche R: A review of statistical approaches to level set segmentation: integrating color, texture, motion and shape. Int. J. Comput. Vis. 2007, 72(2):195-215. 10.1007/s11263-006-8711-1
Shi Y, Karl W: A fast level set method without solving pdes. II. Proceedings of ICASSP 2005 2005, 97-100. Philadelphia, PA, USA, March 2005
Song, B, Chan, T: A fast algorithm for level set based optimization. Tech. Rep. CAM02-68, UCLA Dept. Math. (2002)
Pan Y, Birdwell JD, Djouadi SM: Efficient implementation of the Chan-Vese models without solving PDEs. Proceedings of International Workshop on Multimedia Signal Processing 2006, 350-353. Victoria, BC, Canada, Oct. 03-06
He L, Osher SJ: Solving the Chan-Vese model by a multiphase level set algorithm based on the topological derivative. Proceedings of the 1st International Conference on ScaleSpace Variational Methods in Computer Vision 2007.
Pan Y, Birdwell DJ, Seddik DM: An efficient bottom-up image segmentation method based on region growing, region competition and the Mumford Shah functional. Proceedings of International Workshop on Multimedia Signal Processing 2006, 344-348. Victoria, BC, Canada, Oct. 03-06
Wang X, Huang D, Xu H: An efficient local Chan-Vese model for image segmentation. Pattern Recognit. 2010, 43: 603-618. 10.1016/j.patcog.2009.08.002
Aubert G, Kornprobst P App. Mathem. Sciences 147. In Mathematical Problems in Image Processing: PDE’s and the Calculus of Variations. Springer, Berlin; 2002.
Chipot M, March R, Rosati M, Vergara Caffarelli G: Analysis of a nonconvex problem related to signal selective smoothing. Math. Models Methods Appl. Sci. 1997, 7(3):313-328. 10.1142/S0218202597000189
Rudin L, Osher S, Fatemi E: Nonlinear total variation based noise removal algorithms. Physica D 1992, 60: 259-268. 10.1016/0167-2789(92)90242-F
Perona P, Malik J: Scale-space and edge detection using anisotropic diffusion. IEEE Trans. Pattern Anal. Mach. Intell. 1990, 12(7):629-639. 10.1109/34.56205
Weickert J: Applications of nonlinear diffusion in image processing and computer vision. Acta Math. Univ. Comen. 2000, 70(1):33-50.
Shi J, Osher S: A nonlinear inverse scale space method for a convex multiplicative noise model. SIAM J. Imaging Sci. 2008, 1(3):294-321. 10.1137/070689954
Koenderink JJ: The structure of image. Biol. Cybern. 1984, 50: 363-370. 10.1007/BF00336961
Weickert J, Romeny B, Viergever M: Efficient and reliable scheme for nonlinear diffusion filtering. IEEE Trans. Image Process. 1998, 7(3):398-410. 10.1109/83.661190
This work is partially supported by the National Science Foundation of China (11271100, 11301113, 71303067), China Postdoctoral Science Foundation funded project (Grant No. 2012M510933, Grant No. 2013M541400).
The authors declare that they have no competing interests.
XJ and BW carried out the proof of the main part of this article, DZ corrected the manuscript, and participated in its design and coordination. All authors have read and approved the final manuscript.
About this article
Cite this article
Wu, B., Ji, X. & Zhang, D. Fast two-phase image segmentation based on diffusion equations and gray level sets. Bound Value Probl 2014, 11 (2014). https://doi.org/10.1186/1687-2770-2014-11
- two-phase segmentation
- discrete gray level set
- forward-backward diffusion
- non-convex functional
- Chan-Vese minimal variance