# Deriving the Euler-Lagrange Equations for the Chan-Vese Model

I am reading the Chan-Vese paper "An Active Contour Model without Edges" and IPOL tutorial "Chan-Vese Segmentation" by Pascal Getreuer. The energy for this model is given by: $$E(\varphi) = {\mu \int_{\Omega} \delta(\varphi(x)) | \nabla \varphi(x)|dx} + \nu\int_{\Omega} H(\varphi(x)) dx \;+$$ $$\lambda_1\int_{\Omega}|f - c_1| H(\varphi(x))+\lambda_2\int_{\Omega}|f - c_2|(1 - H(\varphi(x))dx$$ Above, $\mu, \nu, \lambda_1, \lambda_2$ are real parameters, $c_1, c_2$ are constants determined for segmentation, $-1 \leq \varphi(x) \leq 1$ is the level-set function in which $\varphi(x) = 0$ specifies the interface, $f$ is the original image, $H$ is the heavyside function in 1 dimension centered at $0$ and $\delta = H'$. The Euler-Lagrange equations can be derived by inspecting the following derivative: $$\left.\frac{d}{d\epsilon} E(\varphi(x) + \epsilon \eta(x))\right|_{t = 0}$$ for some test function $\eta(x)$. Writing the Euler-Lagrange Equations as a gradient descent both papers claim: $$\begin{cases} \frac{d\varphi}{dt} = \delta(\varphi(x))\left[\mathrm{div}\left( \frac{\nabla \varphi}{\mu |\nabla \varphi|}\right) - \nu - \lambda_1(f- c_1)^2 + \lambda_2(f-c_2)^2\right]\\ \frac{\delta(\phi(x))}{|\nabla \varphi|} \nabla \varphi \cdot \mathbf{n} = 0 & x \in \partial \Omega. \end{cases}$$ My problem is coming from the differentiation of $${\int_{\Omega} \delta(\varphi(x)) | \nabla \varphi(x)|dx}.$$ in the variation of the energy. It should look like: $$\int_{\Omega} \underbrace{\left(\frac{d}{d\epsilon} \delta( \varphi (x) + \epsilon \eta(x) )\right)|\nabla \varphi(x)|}_{(*)} + \underbrace{\delta(\varphi(x)) \left(\frac{d}{d\epsilon}|\nabla\varphi(x) + \epsilon \nabla\eta(x)|\right)}_{(**)}.$$ Now, $(**)$ gives us the curvature/divergence term in the Euler-Lagrange equations as well as the boundary condition after applying Green's first identity. However, I don't understand how one might argue in this case why $(*)$ goes to 0 or why, for practical considerations, we can just ignore it.

## 2 Answers

Thanks to Luminita Vese, who responded to this question via email. I will post the answer here. Let $\varphi_\epsilon(x) = \varphi(x) + \epsilon\eta(x)$ for some test function $\eta(x)$.

\begin{eqnarray} \int_{\Omega} \frac{d}{d\epsilon} \left[ \delta(\varphi_\epsilon(x)) |\nabla (\varphi_\epsilon(x))|\right]dx &=& \int_{\Omega} \left[\frac d{d\epsilon} \delta(\varphi_\epsilon(x))\right] |\nabla (\varphi(x))|+ \delta(\varphi(x)) \left[\frac{d}{d\epsilon}|\nabla (\varphi_\epsilon(x))|\right]dx\\ &=&\int_\Omega \delta'(\varphi(x))\eta(x) |\nabla \varphi(x)| + \delta(\varphi(x))\left[\frac{d}{d\epsilon} \sqrt{\left<\nabla\varphi_\epsilon(x), \nabla\varphi_\epsilon(x)\right>}\right]dx\\ &=&\int_\Omega \delta'(\varphi(x))\eta(x) |\nabla \varphi(x)| + \delta(\varphi(x))\left[ \frac{\frac{d}{d\epsilon}{\left<\nabla\varphi_\epsilon(x), \nabla \varphi_\epsilon(x)\right>}}{2|\nabla(\varphi(x)|}\right]dx\\ &=&\int_\Omega \delta'(\varphi(x))\eta(x) |\nabla \varphi(x)| \\ &\quad&+ \delta(\varphi(x))\left[ \frac{{\left<\nabla\varphi (x), \nabla \eta(x)\right>}}{|\nabla(\varphi(x)|}\right]\\ &=&\int_\Omega \delta'(\varphi(x))\eta(x) |\nabla \varphi(x)| \\ &\quad&+ \frac{{\left<\delta(\varphi(x))\nabla\varphi (x), \nabla \eta(x)\right>}}{|\nabla(\varphi(x)|}dx \quad (*)\\ &=&\int_{\Omega}\delta'(\varphi(x))\eta(x)|\nabla \varphi(x)|\\ &\quad&-\delta(\varphi(x))\mathrm{div}\left(\frac{\nabla \varphi}{|\nabla \varphi|}\right) \eta(x) \\ &\quad&- \delta'(\varphi(x))\frac{|\nabla(\varphi(x))|^2}{|\nabla \varphi(x)|}\eta(x)dx\quad(**)\\ &=&-\int_{\Omega}\delta(\varphi(x))\mathrm{div}\left(\frac{\nabla \varphi}{|\nabla \varphi|}\right) \eta(x) dx \end{eqnarray} Above, I am writing $\left< \cdot , \cdot \right>$ to denote the vector inner product, From (*) to (**), Green's first identity was applied as well as the product rule for divergence.

I am working on this paper aswell, I noticed a few discontinuities in your notation as you seem to mix applying the boundary condition $\epsilon=0$. I post them here for future reference. \begin{eqnarray} \int_{\Omega} \frac{d}{d\epsilon} \left[ \delta(\varphi_{\epsilon}(x)) |\nabla (\varphi_{\epsilon}(x))|\right]dx &=& \int_{\Omega} \left[\frac d{d\epsilon} \delta(\varphi_{\epsilon}(x))\right] |\nabla (\varphi_{\color{red}{\epsilon}}(x))|+ \delta(\varphi_{\color{red}{\epsilon}}(x)) \left[\frac{d}{d\epsilon}|\nabla (\varphi_\epsilon(x))|\right]dx\\ &=&\int_\Omega \delta'(\varphi_{\color{red}{\epsilon}}(x))\eta(x) |\nabla \varphi_{\color{red}{\epsilon}}(x)| + \delta(\varphi_{\color{red}{\epsilon}}(x))\left[\frac{d}{d\epsilon} \sqrt{\left<\nabla\varphi_\epsilon(x), \nabla\varphi_\epsilon(x)\right>}\right]dx\\ &=&\int_\Omega \delta'(\varphi_{\color{red}{\epsilon}}(x))\eta(x) |\nabla \varphi_{\color{red}{\epsilon}}(x)| + \delta(\varphi_{\color{red}{\epsilon}}(x))\left[ \frac{\frac{d}{d\epsilon}{\left<\nabla\varphi_\epsilon(x), \nabla \varphi_\epsilon(x)\right>}}{2|\nabla(\varphi_{\color{red}{\epsilon}}(x)|}\right]dx\\ &=&\int_\Omega \delta'(\varphi_{\color{red}{\epsilon}}(x))\eta(x) |\nabla \varphi_{\color{red}{\epsilon}}(x)| \\ &\quad&+ \delta(\varphi_{\color{red}{\epsilon}}(x))\left[ \frac{{\left<\nabla\varphi (x), \nabla \eta(x)\right>}\color{red}{+\epsilon\left <\nabla \eta (x),\nabla \eta (x)\right >}}{|\nabla(\varphi_{\color{red}{\epsilon}}(x)|}\right] \end{eqnarray} Now applying the boundary condition $\epsilon=0$ returns your fourth Right Hand Side \begin{eqnarray} \dots&=&\int_\Omega \delta'(\varphi(x))\eta(x) |\nabla \varphi(x)| \\ &\quad&+ \delta(\varphi(x))\left[ \frac{{\left<\nabla\varphi (x), \nabla \eta(x)\right>}}{|\nabla(\varphi(x)|}\right]\\ &=&\int_\Omega \delta'(\varphi(x))\eta(x) |\nabla \varphi(x)| \\ &\quad&+ \frac{{\left<\delta(\varphi(x))\nabla\varphi (x), \nabla \eta(x)\right>}}{|\nabla(\varphi(x)|}dx \quad (*)\\ &=&\int_{\Omega}\delta'(\varphi(x))\eta(x)|\nabla \varphi(x)|\\ &\quad&-\delta(\varphi(x))\mathrm{div}\left(\frac{\nabla \varphi}{|\nabla \varphi|}\right) \eta(x) \\ &\quad&- \delta'(\varphi(x))\frac{|\nabla(\varphi(x))|^2}{|\nabla \varphi(x)|}\eta(x)dx\quad(**)\\ &=&-\int_{\Omega}\delta(\varphi(x))\mathrm{div}\left(\frac{\nabla \varphi}{|\nabla \varphi|}\right) \eta(x) dx \end{eqnarray}