DGtalTools  1.3.beta
imageProcessing/atv-u2-v0

Computes a piecewise smooth approximation of a grey-level or color image, by optimizing a variant of the Ambrosio-Tortorelli functional (with u a 2-form and v a 0-form).

Author(s) of this documentation: Jacques-Olivier Lachaud

Usage: atv-u2-v0 -i [input.pgm]

(for grey-level image restoration)

Usage: atv-u2-v0 -i [input.ppm]

(for color image restoration)

The Ambrosio-Tortorelli functional is a classical relaxation of the Mumford-Shah functional.

Given an input grayscale image, defined in an open bounded domain \( \Omega \), we represent its gray levels by a function \( g \in L^{\infty}(\Omega) \). In the Ambrosio-Tortorelli functional [1], one wants to find a function \( u \in SBV(\Omega) \) which is a smooth approximation of the input image \( g \). The Ambrosio-Tortorelli functional [1] is defined by

\[ \displaystyle AT_{\varepsilon}(u,v) = \int_\Omega \alpha |u-g|^2 + v^2 |\nabla u|^2 + \lambda \varepsilon |\nabla v|^2 + \frac{\lambda}{4 \varepsilon} |1-v|^2 dx, \]

for functions \( u,v \in W^{1,2}(\Omega)\) with \( 0 \leq v \leq 1 \). We use a variant here that reads as:

\[ \displaystyle ATV_{\varepsilon}(u,v) = \int_\Omega \alpha |u-g|^2 + v^2 |\nabla u|^2 + c \lambda \varepsilon |\Delta v|^2 + c \frac{\lambda}{\varepsilon} |1-v|^2 dx, \]

It \( \Gamma \)-converges to a length estimation multiplied by \(2 \sqrt{2}\), while having a smoother profile than the standard AT. The constant c is set to \(1/(2 \sqrt{2})\) to correct this estimation and to keep the same parameterization as AT.

In ATV functional, function \( v \) is a smooth approximation of the set of discontinuities, and takes value close to 0 in this set, while being close to 1 outside discontinuities. A remarkable property of this functional is that it \( \Gamma \)-converges to (a relaxation of) MS functional as \( \varepsilon \) tends to 0 (see [1]). The intuition is that a large \( \varepsilon \) induces a solution with a fuzzy set of discontinuities, which is then progressively narrowed to the crisp 1-dimensional set of discontinuites as \( \varepsilon \) goes to 0.

We discretize ATV with discrete calculus and we set \( u \) and \( g \) to live on the faces and \( v \) to live on the vertices and edges. Pixels are faces, so functions \( u \) and \( g \) are 2-forms since they represent the gray levels of each pixel. On the contrary, we set \( v \) in-between cells of non null measure, so in this case on vertices as a 0-form, and on edges by averaging with \( \mathbf{M} \). We call this formulation ATV20. The DEC reformulation is straightforward, except for the second term, where we use matrix \( \mathbf{M} \) to transport the 0-form \( v \) onto edges :

\[ \displaystyle ATV20(u,v) = \Sigma_{i=1}^n \alpha \langle u_i - g_i , u_i - g_i \rangle_2 + \langle \mathbf{M} v , \bar{\mathbf{\star}} \bar{\mathbf{d_0}} \mathbf{\star} u_i \rangle_1 ^2 \\ + c \lambda \varepsilon \langle \mathbf{L_0} v , \mathbf{L_0} v \rangle_1 + c \frac{\lambda}{4\varepsilon} \langle 1 - v , 1 - v \rangle_0. \]

For more comparisons and details, see Image restoration and inpainting with Ambrosio-Tortorelli functional

Allowed options are:

Positionals:
1 TEXT:FILE REQUIRED the input image PPM filename.
Options:
-h,--help Print this help message and exit
-i,--input TEXT:FILE REQUIRED the input image PPM filename.
-m,--inpainting-mask TEXT the input inpainting mask filename.
-o,--output TEXT=AT the output image basename.
-l,--lambda FLOAT the parameter lambda.
-M,--metric-average use metric average to smooth L1-metric.
-1,--lambda-1 FLOAT=0.3125 the initial parameter lambda (l1).
-2,--lambda-2 FLOAT=0.0005 the final parameter lambda (l2).
-q,--lambda-ratio FLOAT=1.41421 the division ratio for lambda from l1 to l2.
-a,--alpha FLOAT=1 the parameter alpha.
-e,--epsilon the initial and final parameter epsilon of AT functional at the same time.
--epsilon-1 FLOAT=2 the initial parameter epsilon.
--epsilon-2 FLOAT=0.25 the final parameter epsilon.
--epsilon-r FLOAT=2 sets the ratio between two consecutive epsilon values of AT functional.
-n,--nbiter INT=10 the maximum number of iterations.
--image-snr TEXT the input image without deterioration if you wish to compute the SNR.
-p,--pixel-size INT=1 the pixel size for outputing images (useful when one wants to see the discontinuities v on top of u).
-c,--color-v TEXT=0xff0000 the color chosen for displaying the singularities v (e.g. red is 0xff0000).
-v,--verbose INT=0 the verbose level (0: silent, 1: less silent, etc).

example:

./imageProcessing/atv-u2-v0 -i ../imageProcessing/Images/degrade-b04.pgm --image-snr ../imageProcessing/Images/degrade.pgm -a 0.05 --epsilon-1 4 --epsilon-2 0.25 -l 0.0075 -p 2 -c 0xff0000 -o degrade
Input image g Reconstructed image u Perfect image Reconstructed image u (with discontinuities v)
degrade-b04.png
Input image (noise = 0.4)
degrade-atv-a0.05000-l0.0075000-u.png
ATV20 alpha=0.05 lambda=0.0075
degrade.png
Perfect image
degrade-atv-a0.05000-l0.0075000-u-v.png
ATV20 alpha=0.05 lambda=0.0075
SNR of g = 21.9183 SNR of u = 34.3261 Perfect image SNR of u = 34.3261
Note
Other restoration examples, parameter analysis, and image inpainting examples may be found in Image restoration and inpainting with Ambrosio-Tortorelli functional.

[1] Luigi Ambrosio, and Vincenzo Maria Tortorelli. "Approximation of functional depending on jumps by elliptic functional via \(\Gamma\)ā€convergence." Communications on Pure and Applied Mathematics 43.8 (1990): 999-1036.

[2] Marion Foare, Jacques-Olivier Lachaud, and Hugues Talbot. "Image restoration and segmentation using the Ambrosio-Tortorelli functional and discrete calculus." In Proceedings of the IAPR International Conference on Pattern Recognition (ICPR2016), Cancun, Mexico, 2016.

[3] Marion Foare, Jacques-Olivier Lachaud, and Hugues Talbot. "Numerical implementation of the Ambrosio-Tortorelli functional using discrete calculus and application to image restoration and inpainting." In Proceedings of 1st Workshop on Reproducible Research In Pattern Recognition (RRPR 2016), Springer LNCS. To appear.

[4] Matteo Focardi. "On the variational approximation of free- discontinuity problems in the vectorial case." Mathematical Models and Methods in Applied Sciences 11.04 (2001): 663-684.