Fast Image Segmentation Based on Efficient Implementation of the Chan-Vese Model with Discrete Gray Level Sets

A new image segmentation based on fast implementation of the Chan-Vese model is proposed.This approach differs from previous methods in that we do not need to solve the Euler-Lagrange equation of the underlying variational problem. First, through experiments, we observe that for the smooth image segmentation, Chan-Vese model (CVM) can be simplified. Utilizing the Gaussian low pass filter, we pretreat the original image and regularize the level curves. Then, we calculate the energy directly on discrete gray level sets, find the minimizer of the energy, and obtain the segmentation results. We analyze the algorithm and prove that under discrete gray level sets, the global minimum of the energy is same as the one obtained by the previous methods. Another advantage of this method is that the reinitialization is not needed. Since there are at most 255 discrete gray level sets, the algorithm improves the computational speed dramatically. And the complexity of the algorithm is O(N), where N is the number of pixels in the image. So even for the large images, it is also very efficient. We apply our segmentation algorithm to synthetic and real world images to emphasize the performances of our model compared with other segmentation models.


Introduction
Images are the proper 2D projections of the 3D world containing various objects.To successfully reconstruct the 3D world, 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 of image segmentation.It has broad applications in variety of important fields such as computer vision and medical image processing.
Variational methods [1][2][3][4][5][6][7][8][9][10][11][12][13][14][15][16] have been extensively used and studied in image segmentation in the past decade because of their flexibility modeling and various advantages in the numerical implementation.These methods drive one or more initial curve(s), based on gradient and/or region information in the image, to the boundaries of objects in that image.The basic idea of variational methods is to minimize an energy.This functional generally depends on the features of the image.The classical way to solve the minimization problem is to solve the corresponding Euler-Lagrange equation.For instance, relatively early, Mumford and Shah [1] introduced a celebrated segmentation model by minimizing an energy functional that penalizes smoothness within regions and the length of their discontinuity contours.Recently, Chan and Vese [4] developed an active contour without edge model to deal with the problem of image segmentation by using the level-set framework introduced by Osher and Paragios [17].Tsai et al. [5] also independently developed a segmentation method which is similar to it.The active contour methods [4-8, 10, 13] based on level-set framework have several advantages.First, they can deal with topological changes such as break and merger.Second, intrinsic geometric elements such as the normal vector and the curvature can be easily expressed with respect to the level-set function.Third, this level-set framework can be extended and applied in any dimension.
However, the active contour methods based on levelset framework have some limitations.First, these methods are usually implemented by solving the partial differential equations (PDEs) and thus computational efficiency sharply decline because of numerical stability constraints.Particularly, the signed distance reinitialization procedure is necessary.It severely limits the efficiency of Chan-Vese model.Second, most methods have the initialization problem [6]: different initial curves produce different segmentations because of Mathematical Problems in Engineering the nonconvexity of Chan-Vese model.More recently, some of the researchers develop fast algorithms [14][15][16][18][19][20] for the Chan-Vese image segmentation model.In [14,15,18], the authors develop fast algorithms based on calculating the variational energy of the Chan-Vese model directly without the length term, that is, solving PDEs.In [14], the authors develop a fast method for image segmentation without solving the Euler-Lagrange equation of the underlying variational problem proposed by Chan and Vese [4].Instead, they calculate the energy directly and check if the energy is decreased when they change a point inside the level-set to outside or vice versa.Later, various modifications of Chan-Vese model, related to different aspects of the image analysis, have been proposed, such as adaptive segmentation of vector images [7,8,19,20] knowledge-based segmentation [13].
An efficient implementation method for the Chan-Vese model is proposed in this paper.Since the simplified Chan-Vese model is without the length term, the new method does not have to solve PDEs.Our method is the hybrid of the discrete simplified Chan-Vese model and the discrete gray level-set framework.First, we decouple the Chan-Vese model into two stages: in the first stage, utilizing Gaussian low pass filter to pretreat the original image and obtaining some appropriate smooth versions of the original image; in the second stage, segmenting the smooth image by Chan-Vese model without the length term.Second, we implement the previous algorithm based on the discrete gray levelset framework.Our segmentation method is also divided into two stages: in the first stage, we smooth the image into required scale; in the second stage, we calculate the energy directly on discrete gray level sets and find the minimizer of the energy.Each stage is independent and at each stage the method is flexible.The new method bears some similarities to [14,15,18], but we calculate the energy directly on discrete gray level sets, which is a new framework.More complicated issues which are not considered in [14], such as sensitivity to noise, are discussed.The segmentation method can also deal with complicated image, and the CPU time of large size/complicated images is not too long.First, we do not need to solve the Euler-Lagrange equation of the underlying variational problem, so the initial conditions and the procedure of reinitiation are not needed.Second, in the second stage of our algorithm, the main computation process is adding operators and logical operators, which costs little CPU time, so the complexity of the algorithm is ().
This paper is organized as follows.In Section 2, we present the Chan-Vese piecewise smooth active contours model [4] (also the algorithm of Tsai et al. [5]) for image segmentation.In Section 3, we give a full account of our model.Experimental results are presented in Section 4, and the final section is our conclusion.

The Main Idea of the Chan-Vese Active Contours Model
In this section, we present the main idea of the Chan-Vese active contours model in order to develop the idea of the new fast hybrid level-set algorithm.
The active contour model proposed by Chan and Vese [4] is a particular case of the Mumford-Shah model [1].Consider an image  0 with the domain Ω ⊂ R 2 .Let the segmenting closed curve  (active contour) divide Ω into two partitions Ω 1 and Ω 2 , which is corresponding to the image subdomains inside and outside the curve , respectively.It minimizes the following energy functional: where   is the average value of  0 (, ) in each region Ω  and  is a positive constant.Using the level-set method in [17], the authors replace the unknown curve  by the level-set function (, ) defined by Then the energy functional (1) can be written in terms of the level-set formulation as The finial segmentation curve could be obtained from the minimizer of the energy functional (4) with respect to .Using a gradient descent method, minimizing (4) yields the following problem: where () =   () in the distribution sense and From the solution of the problems ( 5) and ( 6), we obtain the evolution of (), defined by {(, ) | (, , ) = 0}, which is the boundary between the sets {(, ) |  0 ≈  1 } and {(, ) |  0 ≈  2 }.Therefore, the original image is segmented  0 into two parts.It is noticed that ( 5) is a nonlinear parabolic partial differential equation.So it requires expensive computation since the solution is on a large time domain (i.e., from the initial curve location to the finally achieved steady state).In particular, we need to reinitialize the level-set function  to a signed distance function in each iteration.If we do not do it, when the level-set function  becomes very sharp or flat during the evolution, it makes computation highly inaccurate.Although some semi-implicit methods in [21,22] could be used to partially alleviate the computational burden, the process of reinitialization is very important and may not be avoided by using some level-set methods.All in all, the Chan and Vese algorithm works very well for image segmentation, but solving the Euler-Lagrange equations ( 5) and ( 6) and reinitializing the level-set function cost a lot of CPU time.
In Section 3, we will propose a fast hybrid gray level-set algorithm in order to overcome the previous shortcomings of the Chan-Vese model.

Our Method
In this section, we show a two-stage scheme for implementation of the piecewise constant segmentation model.More precisely, the smooth version of the original image is first obtained by some smooth filters, and then minimizing the modified Chan-Vese energy functional on the gray level sets, the image is divided into two subregions.

Segmentation for the Smooth Image.
In the Chan-Vese segmentation model, the parameter  in ( 4) is a weight of the regularizing term, which controls the length of the zero levelset.When the noise level is high, the parameter  should be large and only large objects are detected.When the noise level is low, the parameter  could be small and objects of small size are detected.Because the Chan-Vese model is independent of the gradient of the image, the input image can be smooth enough [4].So the segmentation method for the smooth image should be different from the method for the noise image.In Figure 1, we present results of the noise image and some smooth versions of the noise image by the Chan-Vese model with the same parameter  = 0, respectively.It is noticed that for the smooth image, the parameter  could vanish in Chan-Vese model, and the good segmentation is also obtained.Now, based on the previous facts, we assume that the input image is reasonably smooth, and then the parameter  could vanish in (4).Hence the following simplified Chan-Vese model without the length term is considered: Using the gradient descent method, minimizing (7) can solve the following problem: where () =   () in the distribution sense and The simplified Chan-Vese algorithm is sketched in the following.
Algorithm 1.The simplified Chan-Vese algorithm is the following two-stage scheme.
(1) By the smooth filter obtain some appropriate smooth versions  of the noise image  0 .
The main difference between Algorithm 1 and the original Chan-Vese model is whether the input image requires smooth pretreatment.In Algorithm 1, there are a lot of methods to smooth image, such as Gaussian low pass filter, averaging filter, Laplacian filter, and enhancing filter based on PDEs.In this paper, we choose the simplest and possibly one of the most popular ways, Gaussian low pass filter.Though all image information, such as the noise and edges, will be indistinguishably destroyed by this filter, it tampers with the segmentation result little, since the Chan-Vese model makes use of a stopping edge function based on the density of the image instead of the gradient.It is notice that if the images are noisy, we do a preprocessing step to smooth or enhance the images firstly, or else this step is needless.In Figures 2 and 3, we present the other two experiments by Algorithm 1.In the two experiments, Figure 3(a) is smoother than Figure 2(a), so Figure 3(a) needs to be smoothed more.For the level-set method, it is inevitable to reinitialize the level-set function for the stability of algorithms.However, for Algorithm 1, we need not reinitialize the level-set function  to a signed distance function in each iteration, which is different from the Chan-Vese model.In Section 4, from the numerical experiments, we show the interesting phenomenon.Now, let us observe the following facts: for the noise image, the gray level lines are disorderly and irregular, while for the smooth image, the gray level lines are smooth and regular.These basic remarks are illustrated in Figure 4.In Figure 4(j), the contour line is very approximate to the real edges of the original image.Hence, we think the best segmentation result is one of the contour lines.How can the best segmentation result, that is, the most appropriate contour line, be obtained?In the next subsection, we will answer the question and then propose the new algorithm.7) is changed into minimizing with where  Definition 2 (discrete gray level-set).The -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 (, ).
,  ∈ [ min ,  max ]}, and then the element number of the set A is  max −  min + 1.For every level , the image u is always divided into two disjointed subregions by   1 and   2 .In Figure 4, the boundary of   1 (  2 ) is displayed at the different levels , for the image .Theorem 3. Minimizing the energy functional  1 is equivalent to min where  1 and  2 are defined as (11).
Since  1 ≤  2 , we have So we get Since the energy  1 obtains its minimizer, it is a contradiction.We complete the proof of the theorem.
By the proof mentioned previously, we can easily see that where  ∈ [ min ,  max ] and  1 and  2 are defined as (11).Now, if the energy functional  reaches a maximum, the best segmentation results are obtained, that is, the subregion   1 and subregion   2 .Since  =  min ,  min + 1, . . .,  max , the energy functional  has  max −  min + 1 cases, and then the maximum of  is easily found.The algorithm is sketched here in the following.
Algorithm 5.The method of maximizing the following functional .
(1) Sweep the image u once, record the number of all pixels at every gray level of the image u which range from  min to  max .
(3) The image u is divided into two subregions, that is, Remark 6.In fact, we restrict   1 = {(, ) : u < , (, ) ∈ },   2 = {(,) : u ≥ , (, ) ∈ }, since if two pixels with the same value  belong to both   1 and   2 , it will be ambiguous to determinant.However, the pixel number of u at  gray level is a little and cannot influence the maximizer of the energy ().The experiment result shows that our approximated method is still efficient.

The Final Method.
Based on Algorithm 5, the following is the new two-phase scheme for image segmentation.

Algorithm 7. (i) (Smooth the original image):
For the input noise image u 0 , use the Gaussian smooth filter to obtain the smooth image   (If the input image is noiseless, this step is optional).
(ii) (Segmentation): Use Algorithm 5 to obtain the segmentation results for the smooth image   , that is.
(1) Sweep the image   once, record the number of all pixels at every gray level of the image   which range from  min to  max .

Remark 8 (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.
(i) If the type of noise is "salt and pepper, " for example, the AMF (adaptive median filter) can be selected.
(ii) If the noise is "addition gauss noise, " for example, the gaussian lower-pass filter, the TV method [23], the PM method [24], and the other anisotropic diffusion method can be used to smooth the original image.
(iii) If the noise is "Poisson noise, " for example, the Variational method [25] can be used to denoise the original image.
In the new algorithm, the segmentation is only dependent on the smooth image but not sensitive to the smoothing scale.In Figure 5, using the new algorithm, we deal with the image with different types of noise.Remark 9.In the new algorithm, we select the Gauss low pass filter to obtain the smooth image.However the filter is not necessary.If the image is corrupted by the different way, we will select the different filters, such as average filter, Laplacian filter, and unsharp filter.For the addition Gaussian noise, the gaussian lower-pass filter may be the best tradeoff between time and segmentation.

Simulations
In this section, numerical examples on some synthetic and real world images are presented to illustrate the effectiveness of the new two-phase scheme in Section 4 by comparing it with Chan-Vese model.

Configuration.
In the new algorithm, the first stage is smoothing the original image by low pass filter.The low pass filter is generally made by convolution with Gaussian of increasing variance, which is as follows: where   = (1/) exp{−|| 2 /4 2 } and * denotes the convolution operation.Koenderink [26] noticed that the convolution of signal with Gaussian at each scale is equivalent to the solution of the heat equation with the signal as initial datum  0 ; that is, Assuming a time step size of Δ and a space grid size of ℎ, we quantize the time and space coordinates as follows: = Δ,  = 0, 1, 2, . . .,  = ℎ,  = 0, 1, 2, . . ., ,  = ℎ,  = 0, 1, 2, . . ., ,   where ℎ × ℎ is the size of image support.The classical fivepoint explicit numerical schemes of the heat equation ( 20) are as follows: or equivalently where  = Δ/ℎ 2 < 1/4 is for the stable of numerical scheme.
The simulations are performed in Matlab R2007b on a 2.8 GHz Pentium 4 processor.For comparison purpose, the Chan-Vese method (CVM) [4] is also tested.We utilize a locally one-dimensional (LOD) scheme for CVM, which is an unconditional scheme [10].6 and 7, we illustrate the performance of CVM, Algorithms 1 and 7 on synthetic noise Test01 and Test02 images.Among the segmentations, all algorithms give similar and good performances.For CVM (the Chan-Vese method), utilizing the unconditionally LOD scheme, the time step size can be sufficiently large to reduce the iteration steps (only 6/7 steps in Table 1).However, re-initializing the level-set function costs a lot of CPU time (in Table 1).

Segmentation Performance. In Figures
In Figure 8, on the synthetic noise Test03 image, we illustrate the results of Algorithm 1 with reinitialization and without reinitialization, respectively.One can see that in the segmentation process, reinitializing the level-set function or not influences the results of Algorithm 1 little (Figures 8(d)-8(g)).In CVM, reinitialization lets the level-set function  not be very sharp, and |∇| = 1 in mathematics.Algorithm 1 does not need ∇, so reinitialization is not necessary.
In Figures 9 and 10, we illustrate the results of Algorithm 1 without reinitialization and Algorithm 7 about a real CT and Stone image.Few differences between the segmented images are observed, but our method works much more faster than CVM (in Table 1).

4.3.
Robustness with the Smooth Scale .Instead of the low pass filter, we use the scheme (23) to smooth the image.Hence, the smooth scale  depends on the parameter  and the iteration step.The smoother of the original image, the more regular of the optimal gray level line.if we regularize too much, we will remove details from the image (in figures, the corner information is lost).In Figure 11, we illustrate how our model works on a real nebula image with  = 0.1 and different iteration steps.In Figure 11, we can see that in different smooth scales , the gray level lines are different and evolved into the more regular ones.Compared with CVM, Algorithm 1 need not the initial level-set function  0 and reinitialization.In Algorithm 1, we just adjust the parameter  and the iteration step, and always obtain the global minimum of the energy functional.

Computational Complexity.
We end this section by considering the complexity of our algorithm.Our algorithm requires two phases: smoothing the original image and segmenting.The first phase is done by the scheme (23).Similar to other low pass filters, it is fast.It is also worth mentioning that one of the efficient implementations of the scheme ( 23) is FFT (Fast Fourier Transform Algorithm) and the complexity of this stage is (), where  is the number of pixels in the image.In the second segmentation phase, 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 of all three algorithms.We summarize that the CPU time of our Algorithm 7 is about 0.01-0.08seconds which is the fastest in three algorithms.

Comparison with Some Other Segmentation Methods.
There are some classical segmentation methods, such as the watershed algorithm [27], the Canny filter [28], and the Sobel filter.In Figure 12, the smooth versions of the images mentioned previously are processed by these algorithms.
Watershed algorithm provides the advantages of stabilization and speediness, but is prone to oversegmentation in Figures 12(a)-12(c).In Figures 12(d)-12(f), the segmentation result of the Sobel operator is sensitive to the threshold: if the threshold is too small, the redundant edges will be detected; if the threshold is too big, the detected edges will be broken.The Canny filter is sensitive to noise in Figures 12(h)-12(i).

Summary and Further Research Directions
In this paper, we have proposed and implemented a new 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, smoothing the noisy image by using the heat equation filter method and then using the new discrete gray level-set method to segment the region of the original image.
In the Chan-Vese segmentation algorithm, the initialization of the level-set functions is a difficult problem.In the proposed new segmentation algorithm, the initialization is not required.And each step is simple and easily achieved.In the first step, there are a lot of algorithms to get the smooth version of the original image, and in the second step, we sweep the image only once and calculate (18) at every gray level (in fact, only 256 gray level sets) and then find the  Compared with the previous simultaneous segmentation methods [4,5,10], the proposed method is more simple, efficient, and flexible.First, we separate the segmentation processes into smoothing the original image and segmenting the smooth image into two regions, and in the second step, the mass of the computation process is adding operators and logical operators.Therefore, the CPU time of the second step is only a little (Tables 1 and 2).Second, the first step is just to get some smooth versions of the original image, so in some sense the second step is independent of the result of the first step, and the second step must have a result (of course, it is not always good).
While we have not pursued it in this paper, one of the potential advantages of our method is that we can also use it  to color image.For example, one method for the color image segmentation is that we replace (1) by the new energy function proposed by Chan et al. [8], and other processes are similar to this paper.

Figure 1 :
Figure 1: Segmentation results of the CV model.(a) The noise image with Gaussian white noise of mean 0 and variance 0.1.(b) The segmentation result of the noise image.(c) The smooth image by Gaussian low pass filter with  = 0.9.(d) The segmentation result of the smooth image.

Figure 2 :
Figure 2: Segmentation results by Algorithm 1.(a) The noise image.(b) The smooth image by Gaussian low pass filter with  = 0.8.(c) The segmentation contour line.(d) The segmentation result.

Figure 3 :
Figure 3: Segmentation results of Algorithm 1.(a) The noise image.(b) The smooth image by Gaussian low pass filter with  = 0.1.(c) The segmentation contour line.(d) The segmentation result.

Figure 4 :
Figure 4: The level lines at different gray levels.(a) The noise image with Gaussian white noise of mean 0 and variance 0.2.(b) The smooth image by Gaussian low pass filter with  = 1.5.(c)-(g) The level lines of the noise image at the gray level, 60, 80, 120, 180, and 200.(h)-(l) The level lines of the smooth image at the gray level, 60, 80, 120, 180, and 200.

Figure 5 :
Figure 5: Segmentations for the Cameraman image with different types of noise.(a) The noise image corrupted by 50% salt and pepper noise.(b) The noise image corrupted by Poisson noise with the variance 4. (c)-(d) The segmentation results of the new algorithm.(e)-(f) The segmentation counter of the new algorithm.

Figure 12 :
Figure 12: Some classical segmentation methods for the smooth images.(a)-(c) The segmentations based on the watershed Algorithm.(d)-(f) The segmentations from the Sobel operator.(g)-(i) The segmentations from the Canny filter.
11 is the number of pixels in  1 and | 2 | = ∑ (,)∈ 2 1 is the number of pixels in  2 .When the energy  1 reaches a minimum, the best segmentation results are obtained, that is, the subregion  1 and subregion  2 .It is noticed that since the selection of  1 and 2 is arbitrary, there are lots of combinations ( 1 ,  2 ), so minimizing the energy  1 is difficult.Now, we try to narrow the scope of the probable combinations.For any  ∈ [ min ,  max ], the image u is divided into two subregions, that is,   1 ≡ {(, ) :  , < } and   2 ≡ {(, ) :  , ≥ }.

Table 1 :
Comparison of CPU time in seconds and iterative step.
optimal gray level.In Table1, we show the CPU time of the Chan-Vese method and our proposed method.Obviously, our method is more efficient than the Chan-Vese method.

Table 2 :
The CPU time in seconds and iterative step.