Solution (source code)

= Solution

A rigorous <Mumford–Shah functional> permits nonsmooth <image signals> and free discontinuities. One classical admissible class consists of relatively closed countably rectifiable sets $K\subset\Omega$ with finite <Hausdorff measure> $\mathcal H^1(K)$, and $u\in W^{1,2}(\Omega\setminus K)\cap L^\infty(\Omega)$ with finite energy. No exterior boundary values are prescribed. For an existence argument, use the equivalent relaxed class
$$
\mathcal A=\{u\in SBV(\Omega):|u|\leq M,\ \nabla u\in L^2(\Omega),\
\mathcal H^1(J_u)<\infty\},\qquad M=\|g\|_\infty.
$$
A <special bounded-variation space> excludes the <Cantor part of a bounded-variation derivative> of the <derivative>: $Du=\nabla u\,dx+[u]\nu_u\mathcal H^1\!\lfloor J_u$. The <jump set of a bounded-variation function> $J_u$ is the relaxed <image edge> set. Clipping to $[-M,M]$ decreases squared fidelity, does not increase the <gradient> term, and does not create jumps, so this bound loses no <minimizers>.

Take a <minimizing sequence> and compare with a constant <image signal>. Its $L^2$ <gradient> <norms> and jump lengths are bounded. Also
$$
|Du_j|(\Omega)\leq|\Omega|^{1/2}\|\nabla u_j\|_2
+2M\mathcal H^1(J_{u_j}),
$$
so the sequence is bounded in $BV$. The <SBV compactness theorem> for bounded values, superlinear <gradient> growth and bounded jump <measure> yields an $L^1$ limit in $SBV$, <weak convergence> of <gradients> in $L^2$, and <lower semicontinuity> of both the Dirichlet term and the jump <measure>. The uniform value bound upgrades convergence to $L^2$, so fidelity converges. This proves \b[existence of a relaxed <minimizer>]. <Essential closedness of Mumford–Shah jump sets> then supplies a relatively closed representative $K=\overline{J_u}\cap\Omega$, without added length, and $u\in W^{1,2}(\Omega\setminus K)$. This completes the outline for the classical pair problem. Arbitrary Hausdorff convergence of <image edge> sets alone is not an adequate substitute for these <compactness> and regularity results. No uniqueness is claimed for segmentation.

As $\alpha\to\infty$ with $\beta$ fixed, bounded energy forces $\nabla u\to0$ in $L^2$. The reduced <piecewise-constant Mumford–Shah problem> is
$$
\boxed{\min_{u\in SBV,\,\nabla u=0}\left\{
\int_\Omega(u-g)^2dx+\beta\mathcal H^1(J_u)\right\}.}
$$
Equivalently, use a <Caccioppoli partition> $\{E_i\}$ of the <image signal> domain and constants $c_i$:
$$
\min_{\{E_i\},\{c_i\}}\left\{
\sum_i\int_{E_i}(c_i-g)^2dx+\frac\beta2\sum_i\operatorname{Per}(E_i;\Omega)\right\}.
$$
The relative perimeter counts only interior boundaries, and the factor one half counts each interface once. Adjacent equal-valued regions can be merged, removing unnecessary boundaries.

For fixed $K$, let $E_i$ be its positive-area regions. Minimization over $u$ reduces to independent scalar least-squares fits:
$$
\boxed{c_i=\frac1{|E_i|}\int_{E_i}g\,dx.}
$$
The minimized fidelity is $\int_\Omega g^2-\sum_i(\int_{E_i}g)^2/|E_i|$. Thus <region means in piecewise-constant segmentation> give the optimal grey values for a fixed segmentation.

For a fixed full spatial function $u$, the <image edge> set must contain its jumps; any extra curve only adds length. The optimal choice is its essential jump set, with a relatively closed representative when appropriate. There is no independent relocation of boundaries while that full function is held fixed. A different common alternating step fixes the values $c_i$ but allows the labels $E_i$ to move. It minimizes the fidelity-plus-perimeter partition <functional> above. Without the perimeter term each point takes its nearest grey value; with it, interface length is penalized. At a smooth interface between two labels, outward normal displacement of $E_i$ has first variation
$$
\int_\Gamma\left[(c_i-g)^2-(c_j-g)^2+\beta\kappa\right]V\,ds,
$$
where $\kappa=\operatorname{div}_\Gamma\nu_i$ is positive for an outward normal to a circle. The stationary <segmentation interface curvature balance> is
$$
\boxed{\beta\kappa=(c_j-g)^2-(c_i-g)^2.}
$$
This is the geometric interpretation of optimizing boundaries with fixed grey levels, and distinguishes it from fixing the whole spatial <image signal>.

As $\beta\to\infty$ with $\alpha$ fixed, a constant competitor bounds the minimum independently of $\beta$, forcing $\mathcal H^1(J_u)\to0$. <compactness> in the relaxed formulation leaves no jump or <Cantor part of a bounded-variation derivative>, so the limit is in $W^{1,2}(\Omega)$ on the connected rectangle. The reduced <edge-free Mumford–Shah limit> is
$$
\boxed{\min_{u\in H^1(\Omega)}\left\{
\int_\Omega(u-g)^2dx+\alpha\int_\Omega|\nabla u|^2dx\right\}.}
$$
A set of zero length can be omitted; this does not impose a zero <image signal> or a Dirichlet boundary value. Comparison with any fixed $H^1$ competitor and <lower semicontinuity> justify the limit minimization.

For completeness, the <bilinear form> $B(u,v)=\int uv+\alpha\int\nabla u\cdot\nabla v$ on $H^1(\Omega)$ is continuous and coercive, with $B(u,u)\geq\min(1,\alpha)\|u\|_{H^1}^2$. The right-hand side $\int gv$ is bounded because $g\in L^2$ on the bounded rectangle. The <Lax-Milgram theorem> gives a unique $u$ satisfying
$$
\int_\Omega uv+\alpha\int_\Omega\nabla u\cdot\nabla v=\int_\Omega gv
\quad(v\in H^1(\Omega)).
$$
It is the unique <minimizer> by strict convexity. Formally,
$$
\boxed{u-\alpha\Delta u=g\quad\hbox{in }\Omega,\qquad
\partial_\nu u=0\quad\hbox{on }\partial\Omega,}
$$
with the Neumann condition understood through this weak formulation. Equivalently, subtracting the weak equation shows that the energy increase at $u+v$ is $\|v\|_2^2+\alpha\|\nabla v\|_2^2>0$ for nonzero $v$.