1 Introduction

The image segmentation problem is fundamental in the field of computer vision, and the aim of it is to divide an image into a finite number of important regions. Recently, variational methods have been extensively studied for image segmentation because of their flexibility in modeling and advantages in numerical implementation.

The geometric active contour (GAC) model is one of the most well-known variational models [14] for image segmentation. It was proposed in [2] and has been widely used in practice [5]. The main idea of the GAC model is to utilize the image gradient to stop evolving contours on object boundaries. However, this model has one major disadvantage, that is, giving an initial curve, during the evolution, the energy may evolve to its local minimizers.

Moreover, there are other variational models for image segmentation [68]. These models do not utilize the image gradient and are significantly less sensitive to the location of initial contours than other modes. Therefore, they have good performance for the image with weak object boundaries. Among these models, the Chan-Vese model [6] is very popular and useful. This model can be applied for the segmentation of images with two regions, each having a distinct mean of pixel intensities. In order to handle images with multiple regions, Vese and Chan proposed the piecewise constant (PC) models [9], in which multiple regions can be represented by multiple level set functions. And yet, these PC models are not very successful for images with intensity inhomogeneity. To deal with more general situation efficiently, Chunming Li proposed the region-scalable fitting model in [10]. However, this model is not always valid when the whole object needs to be segmented.

In this paper, inspired by the GAC model, the region-scalable fitting model, the weighted bounded variation model [35] and the active contour model based on the Mumford-Shah model [11], we propose a new model which can be applied to segment both gray-scale and color images. In order to make our model apply to color images, we shall use the red-green-blue model [12]. Although there are some other models which are similar to our new model, they have different essence and applications. Our new model cannot only make full use of advantages of both edge-based and region-based models, but also overcome the usual drawback in the level set approach. Moreover, compared with other active contours models, our model can keep more accurate overall message of segmented objects for simple and complex images of different modalities. Finally, we investigate the new model mathematically and establish the existence of the minimum to the new energy functional.

The remainder of the paper is organized as follows. In Section 2, we show some background. In Section 3, our new model is proposed. Theoretical results, iterating schemes and experimental results are also given in this section. Finally, we conclude our paper in Section 4.

2 Background

2.1 GAC model

Consider a given vector-valued image f:Ω R d , where Ω R 2 is the image domain and d1 is the dimension of the vector f(x). For gray-scale images, d=1 and for color images, d=3. In [2, 13], the geodesic active contour model (GAC) is defined by the following minimization problem:

min c { E G A C ( c ) = 0 L ( c ) g d s } ,
(2.1)

where ds is the Euclidean element of length and L(c) is the length of the curve c. Hence the energy functional in (2.1) is actually a new length obtained by weighting the Euclidean element of length ds. The function g is an edge indicator function that vanishes at object boundaries. If d=1,

g= 1 1 + β | G σ f | 2 ,
(2.2)

where β is an arbitrary positive constant.

If d=3, it is a color image and this stopping function should be modified. For a color image f=( f 1 , f 2 , f 3 ), a new stopping function g(x) is proposed as follows:

g= 1 1 + β 2 ,
(2.3)

where ∧ is the largest eigenvalue of the structure tensor metric g i j in the spatial-spectral space, and

g i j =( 1 + R x 2 + B x 2 + G x 2 R x R y + B x B y + G x G y R x R y + B x B y + G x G y 1 + R y 2 + B y 2 + G y 2 ),

where R, G and B represent the pixel values of red, green and blue after Gaussian convolution, respectively, i.e., R= G σ f 1 , G= G σ f 2 and B= G σ f 3 .

2.2 The region-scalable fitting model

Let Ω R 2 be the image domain, and let f:ΩR be a given gray-scale image. The region-scalable fitting model is defined by minimizing the following energy functional:

Ω λ 1 Ω K σ ( x y ) | f ( y ) f 1 ( x ) | 2 H ( ϕ ) d y d x + λ 2 Ω 1 2 ( | ϕ | 2 1 ) d x + Ω λ 3 Ω K σ ( x y ) | f ( y ) f 2 ( x ) | 2 ( 1 H ( ϕ ) ) d y d x + Ω H ( ϕ ) | ϕ | d x ,
(2.4)

where K σ is the Gaussian function and f 1 , f 2 are two functions that fit image intensities near the point x. Moreover, ϕ is the level set function embedding the evolving active contour c(t)={x:ϕ(x,t)=0} and H(ϕ) is the Heaviside function.

This model does not need to re-initialize ϕ periodically during the evolution because of the second term of (2.4). If λ 2 =0, (2.4) is equivalent to

ϕ t = H [ div ( ϕ | ϕ | ) λ 1 Ω K σ ( x y ) | f ( x ) f 1 ( y ) | 2 d y + λ 3 Ω K σ ( x y ) | f ( x ) f 2 ( y ) | 2 d y ] .

The steady state solution of this gradient flow is the same as

ϕ t = div ( ϕ | ϕ | ) λ 1 Ω K σ ( x y ) | f ( x ) f 1 ( y ) | 2 d y + λ 3 Ω K σ ( x y ) | f ( x ) f 2 ( y ) | 2 d y .
(2.5)

Moreover, it is known that equation (2.5) is the gradient descent flow of the following energy:

Ω | ϕ | d x + Ω ( λ 1 Ω K σ ( x y ) | f ( x ) f 1 ( y ) | 2 d y λ 3 Ω K σ ( x y ) | f ( x ) f 2 ( y ) | 2 d y ) ϕ d x .
(2.6)

3 Our proposed model

Let f=( f 1 ,, f d ):Ω R d be a given vector-valued image, where Ω R 2 is the image domain and d1 is the dimension of the vector f(x). For gray-scale images, d=1 and for color images, d=3. Inspired by the GAC model, energy functional (2.6) and the active contour model based on the Mumford-Shah model [11], our new model is constructed. This model is to minimize the following energy functional w.r.t. ugB V [ 0 , 1 ] (Ω), f i 1 , f i 2 L 1 (Ω):

E ( u , f i 1 , f i 2 ) = Ω g ( x ) | u | d x + Ω ( i = 1 d λ i 1 Ω K σ ( x y ) ( f i ( x ) f i 1 ( y ) ) 2 d y ) u ( x ) d x + Ω ( i = 1 d λ i 2 Ω K σ ( x y ) ( f i ( x ) f i 2 ( y ) ) 2 d y ) ( 1 u ( x ) ) d x ,
(3.1)

where g is a diffusion coefficient defined in the same way as formula (2.2) or (2.3) and K σ is the Gaussian function.

In the following, we analyze the above model from two aspects. Firstly, for any given u, according to the necessary condition of the minimization problem, the functions f i 1 (y), f i 2 (y) must satisfy the following equations:

f i 1 ( y ) Ω K σ ( x y ) u ( x ) d x = Ω K σ ( x y ) f i ( x ) u ( x ) d x , f i 2 ( y ) Ω K σ ( x y ) ( 1 u ( x ) ) d x = Ω K σ ( x y ) f i ( x ) ( 1 u ( x ) ) d x ,
(3.2)

where K σ takes larger values at the points near the center point y, and decreases to 0 as x goes away from y. Therefore, f i 1 (y), f i 2 (y) are allowed to vary in space.

Furthermore, for any given f i 1 , f i 2 , model (3.1) can be converted into a simpler form. That is,

min u g B V [ 0 , 1 ] ( Ω ) E 1 ( u ) = Ω g ( x ) | u | d x + Ω ( i = 1 d λ i 1 Ω K σ ( x y ) ( f i ( x ) f i 1 ( y ) ) 2 d y ) u ( x ) d x Ω ( i = 1 d λ i 2 Ω K σ ( x y ) ( f i ( x ) f i 2 ( y ) ) 2 d y ) u ( x ) d x .
(3.3)

If u is limited to a characteristic function 1 Ω c , energy functional (3.3) can be changed into the following form:

E 1 ( u ) = Ω g d s + Ω c i = 1 d ( λ i 1 Ω K σ ( x y ) ( f i ( x ) f i 1 ( y ) ) 2 d y ) d x + Ω Ω c i = 1 d ( λ i 2 Ω K σ ( x y ) ( f i ( x ) f i 2 ( y ) ) 2 d y ) d x + C ,
(3.4)

where C is a constant.

In this case, model (3.3) is equal to the following constrained minimization problem:

min c c gds,

when approximating f i with spatially varying fitting functions f i 1 , f i 2 .

The above analysis shows that our new model uses not only the edge detector which contains information concerning the boundaries of objects, but also the spatially varying fitting functions f i 1 (y), f i 2 (y) which are used to approximate the image intensities and avoid existence of the local minimizers to energy functional (3.3).

3.1 Mathematical results

In [11, 14], the proof of existence of models was not given. In the following, we state existence of the minimizer to energy functional (3.3) and analyze the property of it.

Theorem 1 For any given f i 1 (x), f i 2 (x) L (Ω) (i=1,,d, where d=1or3), there exists a function ugB V [ 0 , 1 ] (Ω) minimizing the energy functional E 1 in (3.3).

Proof Let

r(x)= i = 1 d ( λ i 1 Ω K σ ( x y ) ( f i ( x ) f i 1 ( y ) ) 2 d y λ i 2 Ω K σ ( x y ) ( f i ( x ) f i 2 ( y ) ) 2 d y ) .

Since f i L (Ω), we get r(x) L (Ω). Since ugB V [ 0 , 1 ] (Ω), | Ω r(x)udx| M 1 <, then we have

E1(u)= Ω g(x)|u|dx+ Ω r(x)udx M 1 .

Assume infE1=β M 1 and { u n } is the minimizing sequence of (3.3) in gB V [ 0 , 1 ] (Ω), i.e., lim n E1( u n )=β. So, there is a positive constant M 2 such that

| E 1 ( u n ) | = | | u n | g B V + Ω r ( x ) u n d x | < M 2 .

If d=1, from (2.2) we can obtain g(x) 1 1 + c f L ( Ω ) 2 with c being a positive constant. Since f L (Ω), g 1 1 + C 1 where C 1 is a positive constant.

If d=3, the structure tensor metric g i j is symmetric positive and ∧ is the largest eigenvalue of g i j . Thus

trace ( g i j ) = 2 + R x 2 + R y 2 + G x 2 + G y 2 + B x 2 + B y 2 2 + c 1 f 1 L ( Ω ) 2 + c 2 f 2 L ( Ω ) 2 + c 3 f 3 L ( Ω ) 2 ,

where c i 0 (i=1,2,3). Since f i L (Ω) (i=1,2,3), g 1 1 + C 2 , where C 2 is a positive constant.

In these two cases, we all obtain gδ (δ= 1 1 + C 1 or 1 1 + C 2 ). Then

δ | u n | B V M 2 + | Ω r ( x ) u n d x | M 2 + M 1 = M 3 .

So, | u n | B V is bounded.

Since { u n }gB V [ 0 , 1 ] (Ω)={x:u(x)[0,1] for every xΩ}gBV(Ω), the sequence { u n } has a bounded BV-norm.

Thus, there is a subsequence, also denoted by { u n }, and u BV(Ω) such that u n u strongly in L 1 (Ω). Moreover, according to the formula u n u in L 1 (Ω), we know that there is a subsequence, also denoted by { u n }, satisfying lim n u n (x)= u (x) a.e. for xΩ. Since u n (x)[0,1] for any xΩ, u (x)[0,1] a.e. for xΩ.

Assume Ω 0 Ω, s.t. m( Ω 0 )=0 and u (x)[0,1], lim n u n (x)= u (x) for any xΩ Ω 0 Ω. Let

u ¯ ={ u if  x Ω Ω 0 , 1 if  x Ω 0 .

Then

Ω | u n u ¯ |dx= Ω Ω 0 | u n u ¯ |dx= Ω Ω 0 | u n u |dx= Ω | u n u |dx.

That is, u n u ¯ strongly in L 1 (Ω) and u ¯ (x)[0,1] for every xΩ.

Furthermore, by the lower semi-continuity for the gBV space, we get

| u ¯ | g B V lim n inf | u n | g B V .
(3.5)

So, u ¯ gB V [ 0 , 1 ] (Ω). According to the dominated convergence theorem, we know

Ω r(x) u ¯ dx= lim n Ω r(x) u n dx.
(3.6)

These formulas (3.5)-(3.6) imply the weak lower semi-continuity of the energy functional E 1

E1( u ¯ )β= lim n infE1( u n ).

Therefore u ¯ gB V [ 0 , 1 ] (Ω) and u ¯ is a minimum of the energy functional E 1. □

Similar to [11, 15], we can obtain the property of minimizers to energy functional (3.3).

Theorem 2 Let f i (x) (i=1,,d), g(x)[0,1]. For any given f i 1 (x), f i 2 (x) (i=1,,d), if u(x) is any minimum of the energy functional E 1 defined in (3.3), then for almost every μ[0,1], the characteristic function 1 Ω c = 1 { x : u ( x ) > μ } is a global minimum of the functional E 1 where c is the boundary of the set Ω c .

In addition, according to the above theorem, we know Ω c ={x:u(x)>μ} is a minimizer of the following minimization problem:

min c Ω g d s + Ω c i = 1 d ( λ i 1 Ω K σ ( x y ) ( f i ( x ) f i 1 ( y ) ) 2 d y ) d x + Ω Ω c i = 1 d ( λ i 2 Ω K σ ( x y ) ( f i ( x ) f i 2 ( y ) ) 2 d y ) d x .

3.2 Numerical implementation

In the numerical algorithm, we do not deal with the new variation model (3.1) directly since too many equations need to be computed. In order to improve computational efficiency, we use the algorithm framework of the paper [14] to deal with our model. That is, we minimize the energy functional E by alternating the following steps:

  1. (1)

    Considering u fixed, compute f i 1 and f i 2 by using formula (3.2);

  2. (2)

    Considering f i 1 and f i 2 fixed, update u by using the iterative schemes of minimization problem (3.3).

When a steady state is found, the final segmentation is obtained by thresholding u at any level in [0,1] (in our experiments, we choose μ=0.5).

In the following, we give the iterative schemes of minimization problem (3.3). To solve this minimization problem, we firstly change it into the following unconstrained minimization problem:

min u g B V ( Ω ) E 2 = Ω g ( x ) | u | d x + Ω α ν ( u ) d x + Ω [ i = 1 d ( λ i 1 Ω K σ ( x y ) ( f i ( x ) f i 1 ( y ) ) 2 d y ) ] u ( x ) d x Ω [ i = 1 d ( λ i 2 Ω K σ ( x y ) ( f i ( x ) f i 2 ( y ) ) 2 d y ) ] u ( x ) d x ,
(3.7)

where ν(u)=max{0,2|u0.5|1} is an exact penalty function provided that the constant α is chosen large enough. The energy functional E 2 is convex, so E 2 does not possess local minimizers. Hence, any minimizer of E 2 is global.

Based on [1620], we use a convex regularization as follows:

min u , v Ω [ i = 1 d ( λ i 1 Ω K σ ( x y ) ( f i ( x ) f i 1 ( y ) ) 2 d y ) ] v d x + Ω g ( x ) | u | d x + 1 2 θ u v 2 Ω [ i = 1 d ( λ i 2 Ω K σ ( x y ) ( f i ( x ) f i 2 ( y ) ) 2 d y ) ] v + α ν ( v ) d x ,

where θ is chosen to be small. Since this functional is convex, its minimum can be computed by minimizing this functional w.r.t. u and v separately. That is,

  1. (1)

    v being fixed, we search for u as a solution of

    min u Ω g(x)|u|dx+ 1 2 θ u v 2 ,
    (3.8)
  2. (2)

    u being fixed, we search for v as a solution of

    min v Ω [ i = 1 d ( λ i 1 Ω K σ ( x y ) ( f i ( x ) f i 1 ( y ) ) 2 d y ) ] v d x + 1 2 θ u v 2 Ω [ i = 1 d ( λ i 2 Ω K σ ( x y ) ( f i ( x ) f i 2 ( y ) ) 2 d y ) ] v + α ν ( v ) d x .
    (3.9)

According to [20], we know the solution of (3.8) can be given by

u=vθdiv p ,
(3.10)

where p =( p 1 , p 2 ) is given by

g(x)(θdiv p v) | ( θ div p v ) | p =0.

The previous equation can be solved by the fixed point method

p n + 1 = p n + δ t ( div p n v / θ ) 1 + δ t g ( x ) | ( div p n v / θ ) | , p 0 =(0,0).
(3.11)

Moreover, the solution of (3.9) is given by

v=min { max { u ( x ) θ r ( x ) , 0 } , 1 } ,
(3.12)

where

r(x)= i = 1 d ( λ i 1 Ω K σ ( x y ) ( f i ( x ) f i 1 ( y ) ) 2 d y λ i 2 Ω K σ ( x y ) ( f i ( x ) f i 2 ( y ) ) 2 d y ) .

3.3 Experimental results

The proposed variational model can be applied to both gray-scale and color images. Firstly, we compare our new model with the GAC model in Figure 1. According to Figures 1c, d, we see that our proposed model can segment all the edges accurately. This result is hard to achieve by using the GAC model. Then we compare our proposed model with the model in [11] in Figures 2 and 3. Figures 2a and 3a are the original gray-scale images. The final active contours and u got by using our new model are displayed in Figures 2c, d and Figures 3c, d, respectively. Figures 2b and 3b show the active contours obtained by using the model in [11]. From these experiment results, we find that our model can segment the entire object more accurately and keep more details. Finally, we use our new model for segmentation of color images in Figures 4, 5, 6. Figure 4a is the noisy image with the variance 0.01. Figures 5a and 6a are complex images. According to Figures 4b, c, 5b, c, and 6b, c, we see that in all the three cases the experimental results are very good and can correspond to the actual needs.

Figure 1
figure 1

Segmentation of the image of fluorescent cells. (a) The original image. (b) The result obtained by using the GAC model. (c) and (d) The final active contour and u obtained by using our new model (θ=0.1, β=50/ 255 2 , δt=1/8, σ=2, λ 11 = λ 12 =0.001, iteration times=40).

Figure 2
figure 2

Segmentation of the image of a liver. (a) The original image. (b) The result obtained by using the model in [11]. (c) and (d) The final active contour and u obtained by using our new model (θ=0.1, β=50/ 255 2 , δt=1/8, σ=2, λ 11 = λ 12 =0.001, iteration times=100).

Figure 3
figure 3

Segmentation of the image of a cameraman. (a) The original image. (b) The result obtained by using the model in [11]. (c) and (d) The final active contour and u obtained by using our new model (θ=0.1, β=50/ 255 2 , δt=1/8, σ=4, λ 11 = λ 12 =0.001, iteration times=200).

Figure 4
figure 4

Segmentation of a noisy color image. (a) The noisy image. (b) and (c) The final active contour and u obtained by using our new model (θ=0.1, β=50/ 255 2 , δt=1/8, σ=5, λ i 1 = λ i 2 =0.0003, i=1,2,3, iteration times=100).

Figure 5
figure 5

Segmentation of a color image. (a) The color image. (b) and (c) The final active contour and u obtained by using our new model (θ=1/8, β=50/ 255 2 , δt=1/8, σ=5, λ i 1 = λ i 2 =0.0015, i=1,2,3, iteration times=300).

Figure 6
figure 6

Segmentation of a color image. (a) The color image. (b) and (c) The final active contour and u obtained by using our new model (θ=1/8, β=50/ 255 2 , δt=1/8, σ=8, λ i 1 = λ i 2 =0.0003, i=1,2,3, iteration times=400).

4 Conclusion

This paper describes a new model for segmentation of gray-scale and color images. This model is based on the GAC model, the region-scalable fitting model, the weighted bounded variation model and the active contour model based on the Mumford-Shah model. Compared with other active contour models, our new model cannot only make full use of advantages of both edge-based and region-based models, but also keep more accurate overall message of the segmented objects. Our numerical results confirm the effectiveness of our algorithm. Moreover, we investigate the new model mathematically and establish the existence of the minimum to the new energy functional.