Notice: unless you need a non-Euclidean gradient scheme,
you may want to consider the more efficient \verb+tvdenoise2+ module
for TV denoising.

\medskip

This module computes the image $out$ that minimizes the energy
functional proposed by Rudin, Osher and 
Fatemi~\cite{rudin.osher.ea:nonlinear}\cite{rudin.osher:total},
$$E(out) = \int (out -ref)^2 + W \cdot \int |\nabla_{eps}(out)|.$$
This energy is the combination of a fidelity term ($L^2$ square error)
and regularity term (the total variation).
\index{denoising!total variation} 
\index{total variation!denoising} 
The regularity term is obtained from the local estimate of the gradient norm
$$|\nabla_{eps}(u)| = \sqrt{eps + p \cdot 
\frac{\displaystyle (a-d)^2+(b-a)^2+(c-b)^2+(d-a)^2}2
+ (1-p)\cdot \frac{\displaystyle (b-d)^2+(c-a)^2}2},$$
where the local images values are 
\begin{eqnarray*}
a &=& u(x,y), \\
b &=& u(x+1,y), \\
c &=& u(x+1,y+1), \\
d &=& u(x,y+1),
\end{eqnarray*}
and $p$ is any positive weight specified by the \verb+-p+ option (default
value is $p=1/2$).

\medskip

An explicit 
gradient descent algorithm, starting with image $in$, is applied with an 
initial step $s$.
The stopping criterion may be specified through a relative distance
between successive images (\verb+-e+ option, default value is 0.02)
or directly with a fixed number of iterations (\verb+-n+ option).

\medskip

At each step, if the energy does not decrease, then $s$ is multiplied by
$0.8$ and the iteration is tried with this new value instead (unless
$s$ goes beyond $10^{-20}$ times the initial step, in which case the
program terminates). If the \verb+-c+ option is set, then this automatic
step reduction process is not applied and any energy decrease
causes the program to terminate immediately.

\medskip

If $ref$ is not specified, then $ref=in$ is assumed. 
Other options are straightforward.

\medskip

Example of use:
\begin{verbatim}
fnoise -g 10 fimage noisy
cview noisy &
tvdenoise -W 20 noisy denoised
cview denoised &
\end{verbatim}


\medskip

The \verb+-w+ option is no longer valid, due to the convention change on
$lambda$ (the weight now applies to the regularization term and not any more
to the fidelity term). Compatibility with this previous option is ensured
by replacing \verb+-w+ $w$ by \verb+-W+ $lambda$ with $lambda=1/w$.
