Fast twophase image segmentation based on diffusion equations and gray level sets
 Boying Wu^{1},
 Xiaoping Ji^{1} and
 Dazhi Zhang^{1}Email author
https://doi.org/10.1186/16872770201411
© Wu et al.; licensee Springer. 2014
Received: 22 August 2013
Accepted: 5 December 2013
Published: 9 January 2014
Abstract
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 nonconvex 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 reinitialize parameters, which deduces the complexity of our algorithm to $O(N)$ (N is the number of pixels) and provides significant efficiency improvement when dealing with largescale 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.
Keywords
1 Introduction
Images are the proper 2D projections of the 3D world containing various objects. To reconstruct the 3D world perfectly, at least approximately, the first crucial step is to identify the regions in images that correspond to individual objects. This is the wellknown 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 wellestablished 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 EulerLagrange equations. The existing active contour models can be roughly categorized into two classes: regionbased models [1–9] and edgesbased models [10–14]. A literature review of major active contour models can be found in [15–17].
Based on image gradient information, edgesbased models drive one or more initial curve(s) to the boundaries of objects in the image. However, edgesbased models are usually sensitive to noise and weak edges information [2]. Instead of utilizing image gradient information, regionbased 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 [17]. Therefore regionbased 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, regionbased models are less sensitive to the initial contour locations than edgebased models. For instance, Chan and Vese [1] developed an active contour without edge model to deal with image segmentation by using the levelset framework introduced by Osher and Sethian [15], which is similar to the segmentation method independently proposed by Tsai et al. [3]. The active contour methods based on levelset 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 levelset function. Finally, this levelset framework can be extended and applied in any dimension.
However, these active contour methods based on levelset framework have some drawbacks. Firstly, most of these methods have initialization problems: different initial curves produce different segmentations because of the nonconvexity of ChanVese models [4]. Secondly, these methods are usually implemented by solving corresponding evolution equations that suffer from severe numerical stability constrains which render them inefficient. For instance, ChanVese models become severely inefficient due to the signed distance reinitialization procedure for stability reason. Recently, some researchers developed fast algorithms [18–23] to the ChanVese image segmentation model to avoid these drawbacks above. In [18–21], the authors developed fast algorithms based on calculating the variational energy of the ChanVese model directly without the length term. In [18], the authors proposed a fast method for image segmentation without solving the EulerLagrange 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 twophase image segmentation model. In the first phase, we propose a new nonconvex 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 nonconvex functional above. Noted that this purpose may be accomplished by other smoothing filters, for example, the Gaussian lowpass 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 [18], such as sensitivity to noise. Last but not least, our segmentation method can also deal with largescale images because of the following reasons. Firstly, we do not need the initial conditions and the procedure of reinitiation as we directly calculate the minimizer on the discrete gray level sets rather than solving the EulerLagrange 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 $O(N)$.
This paper is organized as follows. In Section 2, we propose twophase segmentation model. Experimental results are given in Section 3, and the final section is our conclusion.
2 Twophase segmentation model
In this section, we show a twostage 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 ChanVese 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 twophase segmentation model based on gray level sets to propose the associated discrete model and then obtain a new algorithm.
2.1 The nonconvex functional for Gaussian noise removal
In our twophase 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 edgepreserving denoising models for various types of noise.
where $0<\alpha <1$. Note that for $0<\alpha <1$, the model is nonconvex, so the edges will be protected and even enhanced. However, the model above is an illposed problem. According to the proof given by Chipot et al. [25], we have the following theorem.
Theorem 2.1 If $f(x)$ is not a constant and $f\in {L}^{\mathrm{\infty}}(\mathrm{\Omega})$, the function $E(u)$ has no minimizer in ${W}^{1,2}(\mathrm{\Omega})$ and ${inf}_{u\in {W}^{1,2}(\mathrm{\Omega})}E(u)=0$.
Proof We only prove the onedimensional case $\mathrm{\Omega}=(a,b)$, and the same proof goes for $N\ge 2$.
The first equality is possible only if $f\in {W}^{1,2}(\mathrm{\Omega})$, and in this case the second equality implies ${f}^{\prime}=0$, which is possible only if f is a constant. Therefore, excluding this trivial case, $E(u)$ has no minimizer in ${W}^{1,2}(\mathrm{\Omega})$. □
However, we cannot obtain any information about the minimizer of $E(u)$ in $BV(\mathrm{\Omega})$.
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 lowerpass filter, the new nonconvex functional (2.1), the TV method (total variation model) [26], the PM method (PeronaMalik model) [27], and other anisotropic diffusion [28] methods can be used to smooth the original image;

If the noise is ‘multiplication noise’, for example, the SO method (ShiOsher Model), which is an effective multiplicative noise removal model [29], can be used to denoise the original image.
2.2 ChanVese minimal variance criterion based on gray level sets
Minimizing the function above, the best threshold is obtained, and then the image is segmented into two subregions $\{(x,y);u\ge K\}$ and $\{(x,y);u(x,y)<K\}$.
Theorem 2.2 Assume $f\in {L}^{2}(\mathrm{\Omega})$, and then there exists the minimizer $\mathcal{K}\in [{K}_{m},{K}_{M}]$ of $\mathcal{F}(K)$. Furthermore, if f is not a constant function, then the minimizer is the minimum point with ${F}^{\prime}(\mathcal{K})=0$.
which implies that the minimizer is the minimum point. By the Fermat theorem, we obtain that there exists $\mathcal{K}\in ({K}_{m},{K}_{M})$ such that ${F}^{\prime}(\mathcal{K})=0$. □
Based on the new model (2.6), the twophase algorithm is sketched below.
 1.
(Smoothing) By (2.2)(2.4) obtain some appropriate smooth version u of the noise image f.
 2.
(Minimal variance) Calculate the new model (2.6) for each $K\in [{max}_{x\in \mathrm{\Omega}}u,{min}_{x\in \mathrm{\Omega}}u]$, and then obtain the minimizer $\mathcal{K}$ with $E(\mathcal{K})={min}_{K\in [{K}_{m},{K}_{M}]}E(K)$. The segmentation results are $\{u(i,j)\ge K\}$ and $\{u(i,j)>K\}$.
2.3 Discrete version of model (2.6)
where ${D}_{1}={\sum}_{(i,j)\in {D}_{1}}1$ is the number of pixels in ${D}_{1}$, and ${D}_{2}={\sum}_{(i,j)\in {D}_{2}}1$ is the number of pixels in ${D}_{2}$. If the energy F reaches a minimum, the best segmentation results are obtained, i.e., the subregion ${D}_{1}$ and subregion ${D}_{2}$.
It is noticed that since the selection of ${D}_{1}$ and ${D}_{2}$ is arbitrary, there are lots of pairs $({D}_{1},{D}_{2})$, 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)
where ${u}_{i,j}$ is the gray level of the image u at pixel location $(i,j)$.
Proof It is clear that ${min}_{({D}_{1},{D}_{2}),{D}_{1}\subset D}F\le {min}_{({D}_{1}^{K},{D}_{2}^{K})\in \mathcal{A}}\mathcal{F}$. We only need to prove ${min}_{({D}_{1},{D}_{2}),{D}_{1}\subset D}F\ge {min}_{({D}_{1}^{K},{D}_{2}^{K})\in \mathcal{A}}\mathcal{F}$.
Without loss of generality, assume ${c}_{1}\le {c}_{2}$ and there exist $({i}_{1},{j}_{1})\in {D}_{1}^{\ast}$ and $({i}_{2},{j}_{2})\in {D}_{2}^{\ast}$ such that ${u}_{{i}_{1},{j}_{1}}>{u}_{{i}_{2},{j}_{2}}$. Denote ${D}_{1}^{\prime}={D}_{1}^{\ast}({i}_{1},{j}_{1})+({i}_{2},{j}_{2})$ and ${D}_{2}^{\prime}={D}_{2}^{\ast}({i}_{2},{j}_{2})+({i}_{1},{j}_{1})$. Note that ${D}_{1}^{\ast}={D}_{1}^{\prime}$, ${D}_{2}^{\ast}={D}_{2}^{\prime}$, ${c}_{1}^{\ast}>{c}_{1}^{\prime}$ and ${c}_{2}^{\ast}<{c}_{2}^{\prime}$.
Since $F({c}_{1},{c}_{2},{D}_{1},{D}_{2})={min}_{({D}_{1},{D}_{2}),{D}_{1}\subset D}F({c}_{1},{c}_{2},{D}_{1},{D}_{2})$, it is a contradiction. Therefore, for any $(i,j)\in {D}_{1}$, $({i}^{\prime},{j}^{\prime})\in {D}_{2}$, we have ${u}_{i,j}<{u}_{{i}^{\prime},{j}^{\prime}}$. Hence there exists $K\in [{K}_{m},{K}_{M}]$ such that ${u}_{i,j}<K\le {u}_{{i}^{\prime},{j}^{\prime}}$, i.e., $({D}_{1},{D}_{2})\in \mathcal{A}$. We complete the proof of the theorem. □
Hence we have the following.
where $K\in [{K}_{m},{K}_{M}]$, ${c}_{1}$ and ${c}_{2}$ is defined as (2.11).
Now, if the energy functional E reaches a maximum, the best segmentation results are obtained, i.e., the subregion ${D}_{1}^{K}$ and subregion ${D}_{2}^{K}$. Since $K={K}_{m},{K}_{m}+1,\dots ,{K}_{M}$, the energy functional E has ${K}_{M}{K}_{m}+1$ cases, and then the maximum of E is easily found. The algorithm in the second phase is sketched below.
 1.
Sweep the image u once, record the number of all pixels at every gray level of the image u which range from ${K}_{m}$ to ${K}_{M}$.
 2.
Calculate the energy $E(K)$ by (2.16) for $K\in [{K}_{m},{K}_{M}]$, and find the maximizer $\mathcal{K}$.
 3.
The image u is divided into two subregions, i.e., ${D}_{1}^{\mathcal{K}}=\{(i,j):u<\mathcal{K}\}$ and ${D}_{2}^{\mathcal{K}}=\{(i,j):u\ge \mathcal{K}\}$.
Based on Algorithm 2.2, the following is the new twophase scheme for image segmentation.
Algorithm 2.3

(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.
3 Simulations
In this section, numerical examples on some synthetic and real world images are presented to illustrate the efficiency and effectiveness of our new twophase scheme. The simulations are performed in Matlab R2007b on a 2.8 GHz Pentium 4 processor. For comparison purpose, the ChanVese method (CVM) [2] is also tested. We utilize a locally onedimensional (LOD) scheme adopted for CVM, which is an unconditional scheme [8].
3.1 Configuration of smoothing filter
FFT (fast Fourier transform algorithm), the classical fivepoint 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 lowpass filter as one smoothing method in the first phase. For simplicity, we refer to the method as GLFGLS (Gaussian lowpass filtergray level set).
where $\mathcal{N}(i)$ 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 steadystate [31]. The AOS scheme is less than twice the typical effort needed for the PM scheme, a rather low price for gaining absolute stability [31]. 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 twophase method with the smoothing method as DEGLS (diffusion equationgray level set).
3.2 Segmentation performance
Comparison of CPU time in seconds and iterate step
Image  CVM CPU(s)  Steps  GLFGLS CPU(s)  DEGLS CPU(s)  Steps 

Test01  53.14  5  0.07  0.93  2 
Ultrasound  107.34  8  0.06  0.62  2 
Brain  297.18  12  0.07  1.48  2 
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 $O(N)$, where N is the number of pixels in the image [31] and so is the Gaussian lowpass filter. In the second segmentation stage, our algorithm only sweeps the image once, so the complexity of the stage is no more than $O(N)$. In Table 1, we compare the CPU time needed for all three algorithms. Especially, we see that our algorithm GLFGLS is about 0.010.08 seconds and is the fastest out of the three algorithms.
4 Summary
In this paper, we have proposed and implemented a novel image segmentation algorithm based on the ChanVese active contour model. The discrete gray levelset 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 levelset method to segment the region of the original image. The proposed new segmentation algorithm does not require the initialization of the levelset functions, which is a difficult problem in the ChanVese 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 ChanVese method and our proposed method. Obviously, our method is much more efficient than the ChanVese method.
Declarations
Acknowledgements
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).
Authors’ Affiliations
References
 Mumford D, Shah J: Optimal approximation by piecewise smooth functions and associated variational problems. Commun. Pure Appl. Math. 1989, 42: 577685. 10.1002/cpa.3160420503MathSciNetView ArticleGoogle Scholar
 Chan TF, Vese LA: Active contours without edges. IEEE Trans. Image Process. 2001, 10(2):266277. 10.1109/83.902291View ArticleGoogle Scholar
 Tsai A, Yezzi A, Willsky AS: Curve evolution implementation of the MumfordShah functional for image segmentation, denoising, interpolation, and magnification. IEEE Trans. Image Process. 2001, 10(8):11691186. 10.1109/83.935033View ArticleGoogle Scholar
 Gao S, Bui T: Image segmentation and selective smoothing by using MumfordShah model. IEEE Trans. Image Process. 2005, 14(10):15371549.View ArticleGoogle Scholar
 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):271293. 10.1023/A:1020874308076View ArticleGoogle Scholar
 Chan TF, Yezrielev Sandberg B, Vese LA: Active contours without edges for vectorvalued images. J. Vis. Commun. Image Represent. 2000, 2(11):130141.View ArticleGoogle Scholar
 Paragios N, Deriche R: Geodesic active regions and level set methods for supervised texture segmentation. Int. J. Comput. Vis. 2002, 46(3):223247. 10.1023/A:1014080923068View ArticleGoogle Scholar
 Kimmel R: Fast edge integration. In Level Set Methods and Their Applications in Computer Vision. Springer, New York; 2003. Chapter 3Google Scholar
 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:10831091.Google Scholar
 Kass M, Witkin A, Terzopoulos D: Snakes: active contour models. Int. J. Comput. Vis. 1987, 1(4):321331.View ArticleGoogle Scholar
 Caselles V, Catte F, Coll T, Dibos F: A geometric model for active contours. Numer. Math. 1993, 66: 131. 10.1007/BF01385685MathSciNetView ArticleGoogle Scholar
 Malladi R, Sethian JA, Vemuri BC: Shape modeling with front propagation: a level set approach. IEEE Trans. Pattern Anal. Mach. Intell. 1995, 17(2):158175. 10.1109/34.368173View ArticleGoogle Scholar
 Xu C, Prince J: Generalized gradient vector flow external forces for active contours. Signal Process. 1998, 71(2):131139. 10.1016/S01651684(98)001406View ArticleGoogle Scholar
 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, 430436.Google Scholar
 Osher S, Paragios N: Geometric Level Set Methods in Imaging, Vision, and Graphics. Springer, New York; 2003.Google Scholar
 Jain AK, Zhong Y, DubuissonJolly M: Deformable template models: a review. Signal Process. 1998, 71(2):109129. 10.1016/S01651684(98)00139XView ArticleGoogle Scholar
 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):195215. 10.1007/s1126300687111View ArticleGoogle Scholar
 Shi Y, Karl W: A fast level set method without solving pdes. II. Proceedings of ICASSP 2005 2005, 97100. Philadelphia, PA, USA, March 2005Google Scholar
 Song, B, Chan, T: A fast algorithm for level set based optimization. Tech. Rep. CAM0268, UCLA Dept. Math. (2002)Google Scholar
 Pan Y, Birdwell JD, Djouadi SM: Efficient implementation of the ChanVese models without solving PDEs. Proceedings of International Workshop on Multimedia Signal Processing 2006, 350353. Victoria, BC, Canada, Oct. 0306Google Scholar
 He L, Osher SJ: Solving the ChanVese 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.Google Scholar
 Pan Y, Birdwell DJ, Seddik DM: An efficient bottomup image segmentation method based on region growing, region competition and the Mumford Shah functional. Proceedings of International Workshop on Multimedia Signal Processing 2006, 344348. Victoria, BC, Canada, Oct. 0306Google Scholar
 Wang X, Huang D, Xu H: An efficient local ChanVese model for image segmentation. Pattern Recognit. 2010, 43: 603618. 10.1016/j.patcog.2009.08.002View ArticleGoogle Scholar
 Aubert G, Kornprobst P App. Mathem. Sciences 147. In Mathematical Problems in Image Processing: PDE’s and the Calculus of Variations. Springer, Berlin; 2002.Google Scholar
 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):313328. 10.1142/S0218202597000189MathSciNetView ArticleGoogle Scholar
 Rudin L, Osher S, Fatemi E: Nonlinear total variation based noise removal algorithms. Physica D 1992, 60: 259268. 10.1016/01672789(92)90242FView ArticleGoogle Scholar
 Perona P, Malik J: Scalespace and edge detection using anisotropic diffusion. IEEE Trans. Pattern Anal. Mach. Intell. 1990, 12(7):629639. 10.1109/34.56205View ArticleGoogle Scholar
 Weickert J: Applications of nonlinear diffusion in image processing and computer vision. Acta Math. Univ. Comen. 2000, 70(1):3350.MathSciNetGoogle Scholar
 Shi J, Osher S: A nonlinear inverse scale space method for a convex multiplicative noise model. SIAM J. Imaging Sci. 2008, 1(3):294321. 10.1137/070689954MathSciNetView ArticleGoogle Scholar
 Koenderink JJ: The structure of image. Biol. Cybern. 1984, 50: 363370. 10.1007/BF00336961MathSciNetView ArticleGoogle Scholar
 Weickert J, Romeny B, Viergever M: Efficient and reliable scheme for nonlinear diffusion filtering. IEEE Trans. Image Process. 1998, 7(3):398410. 10.1109/83.661190View ArticleGoogle Scholar
Copyright
This article is published under license to BioMed Central Ltd. This is an open access article distributed under the terms of the Creative Commons Attribution License (http://creativecommons.org/licenses/by/2.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.