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.
According to conclusions in [24], the nonconvex functional may provide better or sharper edges than the convex functional does. In the smoothing phase of our method, the following edgepreserving denoising model is considered
min\{E(u)=\frac{1}{\alpha}{\int}_{\mathrm{\Omega}}{\mathrm{\nabla}u}^{\alpha}\phantom{\rule{0.2em}{0ex}}dx+\lambda {\int}_{\mathrm{\Omega}}{uf}^{2}\phantom{\rule{0.2em}{0ex}}dx\},
(2.1)
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.
By density, we may always find a sequence of step functions {\tilde{u}}_{n} such that
{\tilde{u}}_{n}\le {f}_{{L}^{\mathrm{\infty}}},\phantom{\rule{2em}{0ex}}\underset{n\to +\mathrm{\infty}}{lim}{{\tilde{u}}_{n}f}_{{L}^{2}(\mathrm{\Omega})}=0.
In fact, we can find a partition a={x}_{0}<{x}_{1}<\cdots <{x}_{n}=b such that {\tilde{u}}_{n} is the constant {\tilde{u}}_{n,i} on each interval ({x}_{i},{x}_{i}), {h}_{n}={max}_{i}({x}_{i}{x}_{i1})<1 with {lim}_{n\to +\mathrm{\infty}}{h}_{n}=0. Let us set {\sigma}_{i}={x}_{i}{x}_{i1}. Next, we define a sequence of continuous functions {u}_{n} by
{u}_{n}(x)=\{\begin{array}{ll}{\tilde{u}}_{n}& \text{if}x\in [{x}_{i1},{x}_{i}{\sigma}_{i}^{2/(1\alpha )}],\\ \frac{{\tilde{u}}_{n,i+1}{\tilde{u}}_{n,i}}{{\sigma}_{i}^{2/(1\alpha )}}(x{x}_{i})+{\tilde{u}}_{n,i+1}& \text{if}x\in [{x}_{i}{\sigma}_{i}^{2/(1\alpha )},{x}_{i}].\end{array}
Note that
\begin{array}{rl}{{\tilde{u}}_{n}{u}_{n}}_{{L}^{2}(\mathrm{\Omega})}^{2}& =\sum _{i=1}^{n}{\int}_{{x}_{i}{\sigma}_{i}^{2/(1\alpha )}}^{{x}_{i}}{({\tilde{u}}_{n,i+1}{\tilde{u}}_{n,i})}^{2}{(\frac{x{x}_{i}}{{\sigma}_{i}^{2/(1\alpha )}}+1)}^{2}\phantom{\rule{0.2em}{0ex}}dx\\ \le \frac{4}{3}{f}_{{L}^{\mathrm{\infty}}(\mathrm{\Omega})}^{2}\sum _{i=1}^{n}{\sigma}_{i}^{2/(1\alpha )}\\ \le \frac{4}{3}{f}_{{L}^{\mathrm{\infty}}(\mathrm{\Omega})}^{2}{h}_{n}^{(1+\alpha )/(1\alpha )}\sum _{i=1}^{n}{\sigma}_{i}\\ =\frac{4}{3}{f}_{{L}^{\mathrm{\infty}}(\mathrm{\Omega})}^{2}(ba){h}_{n}^{(1+\alpha )/(1\alpha )},\end{array}
and therefore,
\underset{n\to +\mathrm{\infty}}{lim}{{\tilde{u}}_{n}{u}_{n}}_{{L}^{2}(\mathrm{\Omega})}=0.
Since
{{u}_{n}f}_{{L}^{2}(\mathrm{\Omega})}\le {{\tilde{u}}_{n}{u}_{n}}_{{L}^{2}(\mathrm{\Omega})}+{{\tilde{u}}_{n}f}_{{L}^{2}(\mathrm{\Omega})},
and then taking the limit on both sides yields
\underset{n\to +\mathrm{\infty}}{lim}{{u}_{n}f}_{{L}^{2}(\mathrm{\Omega})}=0.
Moreover,
\begin{array}{rl}\frac{1}{\alpha}{\int}_{a}^{b}{\mathrm{\nabla}u}^{\alpha}\phantom{\rule{0.2em}{0ex}}dx& =\frac{1}{\alpha}\sum _{i=1}^{n}{\int}_{{x}_{i}{\sigma}_{i}^{2/(1\alpha )}}^{{x}_{i}}\frac{{({\tilde{u}}_{n,i+1}{\tilde{u}}_{n,i})}^{\alpha}}{{\sigma}_{i}^{2\alpha /(1\alpha )}}\phantom{\rule{0.2em}{0ex}}dx\\ \le \frac{1}{\alpha}{2}^{\alpha}{f}_{{L}^{\mathrm{\infty}}(\mathrm{\Omega})}^{\alpha}\sum _{i=1}^{n}{\sigma}_{i}^{2}\le \frac{1}{\alpha}{2}^{\alpha}{f}_{{L}^{\mathrm{\infty}}(\mathrm{\Omega})}^{\alpha}{h}_{n}\sum _{i=1}^{n}{\sigma}_{i}\\ =\frac{1}{\alpha}{2}^{\alpha}{f}_{{L}^{\mathrm{\infty}}(\mathrm{\Omega})}^{\alpha}{h}_{n}(ba).\end{array}
Thus
\underset{n\to +\mathrm{\infty}}{lim}\frac{1}{\alpha}{\int}_{a}^{b}{\mathrm{\nabla}u}^{\alpha}\phantom{\rule{0.2em}{0ex}}dx=0,
and finally,
0\le \underset{u\in {W}^{1,2}(\mathrm{\Omega})}{inf}E(u)\le \underset{n\to +\mathrm{\infty}}{lim}E({u}_{n})=0,
i.e.,
\underset{u\in {W}^{1,2}(\mathrm{\Omega})}{inf}E(u)=0.
Now, if there exists a minimizer u\in {W}^{1,2}(\mathrm{\Omega}), then necessarily E(u)=0, which implies
\begin{array}{c}{\int}_{a}^{b}{uf}^{2}\phantom{\rule{0.2em}{0ex}}dx=0\phantom{\rule{1em}{0ex}}\iff \phantom{\rule{1em}{0ex}}u=f\phantom{\rule{1em}{0ex}}\text{a.e.},\hfill \\ \frac{1}{\alpha}{\int}_{a}^{b}{\mathrm{\nabla}u}^{2}\phantom{\rule{0.2em}{0ex}}dx=0\phantom{\rule{1em}{0ex}}\iff \phantom{\rule{1em}{0ex}}{u}^{\prime}=0\phantom{\rule{1em}{0ex}}\text{a.e.}\hfill \end{array}
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}). □
Remark 2.1 As we all know, if the region Ω is bounded,
{W}^{1,2}(\mathrm{\Omega})\subset {W}^{1,1}(\mathrm{\Omega})\subset BV(\mathrm{\Omega}),
then
\underset{u\in {W}^{1,2}(\mathrm{\Omega})}{inf}E(u)\ge \underset{u\in {W}^{1,1}(\mathrm{\Omega})}{inf}E(u)\ge \underset{u\in BV(\mathrm{\Omega})}{inf}E(u).
Note that E(u)\ge 0, and therefore
\underset{u\in BV(\mathrm{\Omega})}{inf}E(u)=0.
However, we cannot obtain any information about the minimizer of E(u) in BV(\mathrm{\Omega}).
From the EulerLagrange equation for (2.1), we can obtain the following diffusion equation:
\frac{\partial u}{\partial t}=div\left({\mathrm{\nabla}u}^{\alpha 2}\mathrm{\nabla}u\right)\lambda (uf),\phantom{\rule{1em}{0ex}}(x,t)\in \mathrm{\Omega}\times T,
(2.2)
u(x,0)=f,\phantom{\rule{1em}{0ex}}x\in \mathrm{\Omega},
(2.3)
\frac{\partial u}{\partial \overrightarrow{n}}{}_{\partial \mathrm{\Omega}}=0,\phantom{\rule{1em}{0ex}}(x,t)\in \partial \mathrm{\Omega}\times T.
(2.4)
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
First let us review the following ChanVese minimal variance criterion
F({c}_{1},{c}_{2},\varphi )={\int}_{\mathrm{\Omega}}{(u{c}_{1})}^{2}H(\varphi )\phantom{\rule{0.2em}{0ex}}dx\phantom{\rule{0.2em}{0ex}}dy+{\int}_{\mathrm{\Omega}}{(u{c}_{2})}^{2}(1H(\varphi ))\phantom{\rule{0.2em}{0ex}}dx\phantom{\rule{0.2em}{0ex}}dy.
(2.5)
Assume that the smooth image u is the solution from diffusion equations (2.2)(2.4). Let {\chi}_{K}=\{(x,y);u(x,y)<K\} be the Klevel set of u. It is clear that for the noise image, \partial {\chi}_{K} is disorderly and irregular; while for the smooth image, \partial {\chi}_{K} is smooth and regular. These basic facts are illustrated in Figure 1, where some \partial {\chi}_{K} are very close to the real edges of the original image.
Hence, the levelset function can be replaced by the image gray function u in the ChanVese minimal variance criterion [2], and the new model is as follows:
\mathcal{F}(K)={\int}_{\mathrm{\Omega}}{(u{c}_{1})}^{2}H(uK)\phantom{\rule{0.2em}{0ex}}dx\phantom{\rule{0.2em}{0ex}}dy+{\int}_{\mathrm{\Omega}}{(u{c}_{2})}^{2}(1H(uK))\phantom{\rule{0.2em}{0ex}}dx\phantom{\rule{0.2em}{0ex}}dy,
(2.6)
where
{c}_{1}=\frac{{\int}_{\mathrm{\Omega}}uH(uK)\phantom{\rule{0.2em}{0ex}}dx}{{\int}_{\mathrm{\Omega}}H(uK)\phantom{\rule{0.2em}{0ex}}dx},\phantom{\rule{2em}{0ex}}{c}_{2}=\frac{{\int}_{\mathrm{\Omega}}u(1H(uK))\phantom{\rule{0.2em}{0ex}}dx}{{\int}_{\mathrm{\Omega}}(1H(uK))\phantom{\rule{0.2em}{0ex}}dx},
(2.7)
and the Heaviside function H
H(z)=\{\begin{array}{cc}1\hfill & \text{if}z\ge 0,\hfill \\ 0\hfill & \text{if}z0.\hfill \end{array}
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\}.
Notice that
\mathcal{F}(K)={\int}_{\mathrm{\Omega}}{u}^{2}\phantom{\rule{0.2em}{0ex}}dx{c}_{1}^{2}{\int}_{\mathrm{\Omega}}H(uK)\phantom{\rule{0.2em}{0ex}}dx{c}_{2}^{2}{\int}_{\mathrm{\Omega}}(1H(uK))\phantom{\rule{0.2em}{0ex}}dx,
(2.8)
{c}_{1}{\int}_{\mathrm{\Omega}}H(uK)\phantom{\rule{0.2em}{0ex}}dx+{c}_{2}{\int}_{\mathrm{\Omega}}(1H(uK))\phantom{\rule{0.2em}{0ex}}dx={\int}_{\mathrm{\Omega}}f\phantom{\rule{0.2em}{0ex}}dx,
(2.9)
for {K}_{m}={min}_{x\in \mathrm{\Omega}}u,
F({K}_{m})={\int}_{\mathrm{\Omega}}{(u{c}_{1})}^{2}\phantom{\rule{0.2em}{0ex}}dx,\phantom{\rule{2em}{0ex}}{c}_{1}=\overline{u}=\frac{1}{\mathrm{\Omega}}{\int}_{\mathrm{\Omega}}u\phantom{\rule{0.2em}{0ex}}dx,
and for {K}_{M}={max}_{x\in \mathrm{\Omega}}u,
F({K}_{M})={\int}_{\mathrm{\Omega}}{(u{c}_{2})}^{2}\phantom{\rule{0.2em}{0ex}}dx,\phantom{\rule{2em}{0ex}}{c}_{2}=\overline{u}=\frac{1}{\mathrm{\Omega}}{\int}_{\mathrm{\Omega}}u\phantom{\rule{0.2em}{0ex}}dx.
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.
Proof If f\in {L}^{2}(\mathrm{\Omega}), u\in {C}^{1}(\mathrm{\Omega}) and \mathcal{F}(K)\in C[{K}_{m},{K}_{M}], there exists the minimizer {K}^{\ast}\in [{K}_{m},{K}_{M}] of \mathcal{F}(K). Noted that g(\alpha )={\int}_{\mathrm{\Omega}}{(u\alpha )}^{2}\phantom{\rule{0.2em}{0ex}}dx get the minimal at \alpha =\overline{u}, and then
\begin{array}{r}{\int}_{\mathrm{\Omega}}{(u{c}_{1})}^{2}H(uK)\phantom{\rule{0.2em}{0ex}}dx\le {\int}_{\mathrm{\Omega}}{(u\overline{u})}^{2}H(uK)\phantom{\rule{0.2em}{0ex}}dx,\\ {\int}_{\mathrm{\Omega}}{(u{c}_{2})}^{2}(1H(uK))\phantom{\rule{0.2em}{0ex}}dx\le {\int}_{\mathrm{\Omega}}{(u\overline{u})}^{2}(1H(uK))\phantom{\rule{0.2em}{0ex}}dx.\end{array}
Hence
\mathcal{F}(K)\le \mathcal{F}({K}_{M})=\mathcal{F}({K}_{m})\phantom{\rule{1em}{0ex}}\text{for}K\in [{K}_{m},{K}_{M}],
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. □
For any images we can always obtain the function F(K). Figure 2(d) shows the function F(K) for the image in Figure 2(a). From the figure, we can see that F(K) has the global minimizer and has several local minimizers.
Based on the new model (2.6), the twophase algorithm is sketched below.
Algorithm 2.1

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)
Let {u}_{i,j}, for (i,j)\in D\equiv \{1,\dots ,M\}\times \{1,\dots ,N\}, be the gray level of a true MbyN image u at pixel location (i,j), and let [{K}_{m},{K}_{M}] be the range of the smooth image u, i.e., {K}_{m}\le {u}_{i,j}\le {K}_{M}. Let {D}_{1}\subset D and {D}_{2}=D\mathrm{\setminus}{D}_{1}, and then the image u is divided into two regions. Instead H(\varphi ) by {D}_{1}, and (1H(\varphi )) by {D}_{2}, respectively. Then minimizing the energy (2.5) is changed into minimize
F({c}_{1},{c}_{2},{D}_{1},{D}_{2})=\sum _{(i,j)\in {D}_{1}}{({u}_{i,j}{c}_{1})}^{2}+\sum _{(i,j)\in {D}_{2}}{({u}_{i,j}{c}_{2})}^{2},
(2.10)
with
{c}_{1}=\frac{{\sum}_{(i,j)\in {D}_{1}}{u}_{i,j}}{{D}_{1}},\phantom{\rule{2em}{0ex}}{c}_{2}=\frac{{\sum}_{(i,j)\in {D}_{2}}{u}_{i,j}}{{D}_{2}},
(2.11)
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)
The Kdiscrete gray level set {D}^{K}, which is the set of pixel location (i,j), is defined as follows
{D}^{K}\triangleq \{(i,j):{u}_{i,j}<K\},
where {u}_{i,j} is the gray level of the image u at pixel location (i,j).
For any K\in [{K}_{m},{K}_{M}], the image u is divided into two subregions, i.e., {D}_{1}^{K}\triangleq \{(k,l):{u}_{k,l}<K\} and {D}_{2}^{K}\triangleq \{(k,l):{u}_{k,l}\ge K\}. Then {D}_{2}^{K}=D\mathrm{\setminus}{D}_{1}^{K}. Let \mathcal{A}\triangleq \{({D}_{1}^{K},{D}_{2}^{K}),K\in [{K}_{m},{K}_{M}]\}, and then the element number {N}_{\mathcal{A}} of the set \mathcal{A} is {N}_{\mathcal{A}}={K}_{M}{K}_{m}+1 which is less than 256 in general. Then minimizing the energy (2.6) is changed into minimize
\mathcal{F}(K)=\sum _{(i,j)\in {D}_{1}^{K}}{({u}_{i,j}{c}_{1})}^{2}+\sum _{(i,j)\in {D}_{2}^{K}}{({u}_{i,j}{c}_{2})}^{2},\phantom{\rule{1em}{0ex}}\text{for}({D}_{1}^{K},{D}_{2}^{K})\in \mathcal{A}
(2.12)
with
{c}_{1}=\frac{{\sum}_{(i,j)\in {D}_{1}^{K}}{u}_{i,j}}{{D}_{1}^{K}},\phantom{\rule{2em}{0ex}}{c}_{2}=\frac{{\sum}_{(i,j)\in {D}_{2}^{K}}{u}_{i,j}}{{D}_{2}^{K}}.
(2.13)
Theorem 2.3
\underset{({D}_{1},{D}_{2}),{D}_{1}\subset D}{min}F({c}_{1},{c}_{2},{D}_{1},{D}_{2})=\underset{({D}_{1}^{K},{D}_{2}^{K})\in \mathcal{A}}{min}\mathcal{F}(K).
(2.14)
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}.
From Theorem 2.2, there exist two subdomains {D}_{1}^{\ast} and {D}_{2}^{\ast} such that
F({c}_{1}^{\ast},{c}_{2}^{\ast},{D}_{1}^{\ast},{D}_{2}^{\ast})=\underset{({D}_{1},{D}_{2}),{D}_{1}\subset D}{min}F({c}_{1},{c}_{2},{D}_{1},{D}_{2}).
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}.
Having compared the energy F({c}_{1}^{\ast},{c}_{2}^{\ast},{D}_{1}^{\ast},{D}_{2}^{\ast}) and F({c}_{1}^{\prime},{c}_{2}^{\prime},{D}_{1}^{\prime},{D}_{2}^{\prime}), we get
\begin{array}{r}F({c}_{1}^{\ast},{c}_{2}^{\ast},{D}_{1}^{\ast},{D}_{2}^{\ast})F({c}_{1}^{\prime},{c}_{2}^{\prime},{D}_{1}^{\prime},{D}_{2}^{\prime})\\ \phantom{\rule{1em}{0ex}}=\sum _{(i,j)\in {D}_{1}^{\ast}}{({u}_{i,j}{c}_{1}^{\ast})}^{2}+\sum _{(i,j)\in {D}_{2}^{\ast}}{({u}_{i,j}{c}_{2}^{\ast})}^{2}\\ \phantom{\rule{2em}{0ex}}\sum _{(i,j)\in {D}_{1}^{\prime}}{({u}_{i,j}{c}_{1}^{\prime})}^{2}\sum _{(i,j)\in {D}_{2}^{\prime}}{({u}_{i,j}{c}_{2}^{\prime})}^{2}\\ \phantom{\rule{1em}{0ex}}=\left{D}_{1}^{\ast}\right{{c}_{1}^{\ast}}^{2}\left{D}_{2}^{\ast}\right{{c}_{2}^{\ast}}^{2}+\left{D}_{1}^{\prime}\right{{c}^{\prime}}_{1}^{2}+\left{D}_{2}^{\prime}\right{{c}^{\prime}}_{2}^{2}\\ \phantom{\rule{1em}{0ex}}=\left{D}_{1}^{\ast}\right({c}_{1}^{\prime}+{c}_{1}^{\ast})({c}_{1}^{\prime}{c}_{1}^{\ast})+\left{D}_{2}^{\ast}\right({c}_{2}^{\prime}+{c}_{2}^{\ast})({c}_{2}^{\prime}{c}_{2}^{\ast})\\ \phantom{\rule{1em}{0ex}}=({c}_{1}^{\prime}+{c}_{1}^{\ast})({u}_{{i}_{2},{j}_{2}}{u}_{{i}_{1},{j}_{1}})+({c}_{2}^{\prime}+{c}_{2}^{\ast})({u}_{{i}_{1},{j}_{1}}{u}_{{i}_{2},{j}_{2}})\\ \phantom{\rule{1em}{0ex}}=({c}_{1}^{\prime}+{c}_{1}^{\ast}{c}_{2}^{\prime}{c}_{2}^{\ast})({u}_{{i}_{2},{j}_{2}}{u}_{{i}_{1},{j}_{1}}).\end{array}
Since {c}_{1}\le {c}_{2}, we have
{c}_{1}^{\prime}+{c}_{1}{c}_{2}^{\prime}{c}_{2}=2{c}_{1}\frac{{u}_{{i}_{1},{j}_{1}}{u}_{{i}_{2},{j}_{2}}}{{D}_{1}}2{c}_{2}+\frac{{u}_{{i}_{2},{j}_{2}}{u}_{{i}_{1},{j}_{1}}}{{D}_{2}}<0.
So we get
F({c}_{1},{c}_{2},{D}_{1},{D}_{2})>F({c}_{1}^{\prime},{c}_{2}^{\prime},{D}_{1}^{\prime},{D}_{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. □
From (2.8) and (2.9), we can easily see that
\begin{array}{rl}F({c}_{1},{c}_{2},{D}_{1},{D}_{2})& =\sum _{(i,j)\in {D}_{1}}{({u}_{i,j}{c}_{1})}^{2}+\sum _{(i,j)\in {D}_{2}}{({u}_{i,j}{c}_{2})}^{2}\\ =\sum _{(i,j)\in D}{u}_{i,j}^{2}{D}_{1}{c}_{1}^{2}{D}_{2}{c}_{2}^{2}.\end{array}
(2.15)
Hence we have the following.
Theorem 2.4
{min}_{({D}_{1}^{K},{D}_{2}^{K})\in \mathcal{A}}\mathcal{F}(K)
is equivalent to
\underset{({D}_{1}^{K},{D}_{2}^{K})\in \mathcal{A}}{max}\{E(K)\triangleq \left{D}_{1}^{K}\right{c}_{1}^{2}+\left{D}_{2}^{K}\right{c}_{2}^{2}\},
(2.16)
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.
Algorithm 2.2
The method of maximizing the following functional
E

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.