<h2><center> Total variation denoising </center></h2>

### In this demo, we solve the following minimisation problem:

$$\begin{equation}
\underset{u}{\operatorname{argmin}} \frac{1}{2} \| u - g\|^{2}_{2} + \alpha \mathrm{TV}(u)
\end{equation}$$

where,

* g is a noisy data corrupted with Gaussian noise,
* TV stands for the Total variation regulariser.

To solve the above problem, we use the **Fast Gradient Projection (FGP)** algorithm, proposed in [BeckTeboulle](https://ieeexplore.ieee.org/document/5173518).


```python
# Import libraries
from cil.optimisation.functions import TotalVariation
from cil.utilities import dataexample, noise
from cil.utilities.display import show2D
```

    
    Bad key "text.kerning_factor" on line 4 in
    /home/vaggelis/miniconda3/envs/cil_binder_intel/lib/python3.7/site-packages/matplotlib/mpl-data/stylelib/_classic_test_patch.mplstyle.
    You probably need to get an updated matplotlibrc file from
    https://github.com/matplotlib/matplotlib/blob/v3.1.2/matplotlibrc.template
    or from the matplotlib source distribution


We load an image from the `dataexample` class. In this demo, we use the `CAMERA` image. 

Other options are: 

* `BOAT`
* `CAMERA`
* `PEPPERS`(color)
* `RESOLUTION_CHART` 
* `SIMPLE_PHANTOM_2D` 
* `RAINBOW` (color)


```python
# Load data
data = dataexample.CAMERA.get()

# Add gaussian noise
noisy_data = noise.gaussian(data, seed = 10, var = 0.02)
```

We use the **proximal method** of the **TotalVariation** class which implements the FGP algorithm.


```python
alpha = 0.15
TV = alpha * TotalVariation(max_iteration=100)
proxTV = TV.proximal(noisy_data, tau=1.0)
```

    Initialised GradientOperator with C backend running with  16  threads



```python
show2D([data, noisy_data, proxTV], 
       title=['Ground truth', 'Noisy Data (Gaussian)', 'Total variation'], 
       origin="upper", num_cols=3)
```

84265cdd25bf8cb0ecfb177a26341e5c6bbc042d
ipynb
Jupyter Notebook
binder/TotalVariationDenoising.ipynb
Sophilyplum/CIL-Demos
f1a2d4b7675540f5e56accb255a2ea66a1931079
Apache-2.0
2021-05-21T11:34:58.000Z
2021-12-05T14:06:17.000Z
binder/TotalVariationDenoising.ipynb
Sophilyplum/CIL-Demos
f1a2d4b7675540f5e56accb255a2ea66a1931079
Apache-2.0
2019-06-25T20:44:51.000Z
2021-05-07T12:25:32.000Z
binder/TotalVariationDenoising.ipynb
Sophilyplum/CIL-Demos
f1a2d4b7675540f5e56accb255a2ea66a1931079
Apache-2.0
2021-06-18T10:40:57.000Z
2021-11-09T10:32:22.000Z
Qwen/Qwen-72B
1. YES
2. YES