
# The total variation prior

Computes the total variation prior with $p$-norm coupling of a $\M$-valued data set $x\colon\Grid\to\M$, where the pixel grid $\Grid$ is of size ${\vect{n}}$, $\vect{n} = (n_1,\ldots,n_m)\in\mathbb N^m$.

Let $N_{\vect{k}} = \bigl\{\vect{l} : \vect{l}+\vect{e}_j,\ j\in\{1,\ldots,m\}\bigr\}\cap G$ be the set of forward neighbors, then this function computes

where $p\geq1$ and $\varepsilon>0$ is a relacation that is by default set to $0$. This relacation is applied to each summand $( d_{\M}(x_{\vect{k}},x_{\vect{l}}) + \varepsilon^2 )^{\frac{1}{2}}$ for $p=1$.

### Optional Parameters

epsilon $(0)$
relax the TV (especially for $p=1$ by replacing any distance by $\sqrt{ d^2(\cdot,\cdot)+\varepsilon^2 }$ and for $p>1$ each inner sum (over $N_{\vect{k}}$) is relaxed to avoid subgradients in constant areas.
p $(0)$
denotes the outer coupling of the differences
weights $(1)$ for each item of $x$
introduces a weight that is muliplied to any term, i.e. if weights is zero this the corresponding data item is ignored.
Sum (true)
setting this value to false ommits the outer sum and returns the TV value per pixel. This is used in the computation of the gradTV.

### Matlab Documentation

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
% TV(M,x) compute all TV with a p-norm coupling of forward distance terms.
%
% INPUT
%   M      :  a manifold
%   x      : data (size [manDims,dataDims])
%
% OPTIONAL
%   'p'      : (p=1) compute TV with p-norm coupling in the dimensions of
%              the data, i.e. anisotropic TV for p=1 and isotropic for p=2
%  'epsilon' : compute the gradient of the epsilon-relaxed TV
%  'weights' : (ones(dataDims) exclude certain data points from all