# Spatially Adaptive Regularization in Image Segmentation
## 1 Introduction  
Image segmentation is a fundamental problem in image processing and computer vision. Its goal is to divide the given image into regions that represent different objects in the scene, which can be identified taking into account different features. The research on image segmentation has made several advances in the last decades and various approaches have been developed to satisfy the requirements coming from different applications. In this work, we focus on variational models for image segmentation, which have been widely investigated, proving to be very effective on different images--see, e.g., [1; 2; 3; 4]. Other recent approaches to image segmentation include learning-based methods, which often exploit deep-learning techniques [5; 6; 7; 8]. However, in this case, a large amount of data must be available to train learning networks, thus making those approaches impractical in some applications. Roughly speaking, when a variational approach is used, the segmentation may be obtained by minimizing a cost functional that linearly combines regularization and data fidelity terms:  
\[\min_{u\in\Omega}\,E(u)\,\equiv\,F(u)+\lambda G(u), \tag{1}\]  
where \(u:\Omega\subset\mathbb{R}^{2}\to\mathbb{R}\) provides a representation of the segmentation and \(\lambda>0\) is a parameter that controls the weight of the fidelity term \(G\) versus the regularization term \(F\). A widely-used segmentationmodel is the two-phase partitioning model that was introduced by [PERSON], [PERSON], and [PERSON] [3], which we refer to as the CEN model:  
\[ \begin{array}{ll}\underset{u,c_{1},c_{2}}{\text{minimize}}&\int_{\Omega}| \
abla u|\,dx+\lambda\int_{\Omega}\Big{(}(c_{1}-\bar{u}(x))^{2}u(x)+(c_{2}-\bar{u }(x))^{2}(1-u(x))\Big{)}\,dx,\\ \text{s.t.}&0\leq u\leq 1,\\ &c_{1},c_{2}>0.\end{array}  \tag{2}\]  
Here, \(\bar{u}\) denotes the image to be segmented, which is assumed to take its values in \([0,1]\). The CEN model allows us to obtain one of the two domains defining the segmentation, \(\Sigma\) and \(\Omega\backslash\Sigma\), by setting  
\[\Sigma=\left\{x:u(x)>\alpha\right\}\text{ for a.e. }\alpha\in(0,1),\]  
where \(u\) is the solution of problem (2). Note that (2) is the result of a suitable relaxation of the Chan-Vese model [2] leading to a convex formulation of that problem for any given \((c_{1},c_{2})\). In this work, we start from a discrete version of the CEN model. Let  
\[\Theta=\left\{(i,j):0\leq i\leq m-1,\,0\leq j\leq n-1\right\}\]  
be a discretization of \(\Omega\) consisting of an \(m\times n\) grid of pixels and let  
\[|\
abla_{x}u|_{i,j}=|\delta_{x}^{+}u|_{i,j},\quad|\
abla_{y}u|_{i,j}=|\delta_{ y}^{+}u|_{i,j}\]  
where \(\delta_{x}^{+}\) and \(\delta_{y}^{+}\) are the forward finite-difference operators in the \(x\)- and \(y\)-directions, with unit spacing, and the values \(u_{i,j}\) with indices outside \(\Theta\) are defined by replication. We consider the following discrete version of (2) with anisotropic discrete total variation (TV):  
\[ \begin{array}{ll}\underset{u,c_{1},c_{2}}{\text{minimize}}&\sum_{i,j}\left( |\
abla_{x}u|_{i,j}+|\
abla_{y}u|_{i,j}\right)\,+\,\lambda\sum_{i,j}\left( \left(c_{1}-\bar{u}_{i,j}\right)^{2}u_{i,j}+\left(c_{2}-\bar{u}_{i,j}\right)^{ 2}(1-u_{i,j})\right),\\ \text{s.t.}&0\leq u_{i,j}\leq 1,\\ &c_{1},c_{2}>0.\end{array}  \tag{3}\]  
After the minimization problem (3) is solved, the segmentation is obtained by taking  
\[\Sigma=\left\{(i,j)\in\Theta:u_{i,j}>\alpha\right\}, \tag{4}\]  
for some \(\alpha\in(0,1)\). Problem (3) is usually solved by alternating the minimization with respect to \(u\) and the minimization with respect to \(c_{1}\) and \(c_{2}\). In the sequel, we denote \(E(u,c_{1},c_{2})\) the objective function in (3), and \(F(u)\) and \(G(u,c_{1},c_{2})\) its discrete regularization and fidelity terms, respectively. The selection of a parameter \(\lambda\) able to balance \(F(u)\) and \(G(u,c_{1},c_{2})\) and to produce a meaningful solution is a critical issue.