Skip to main content
added 11 characters in body
Source Link
Royi
  • 20.5k
  • 4
  • 199
  • 240

The full code is available on my StackExchange Signal Processing Q75471 GitHub RepositoryStackExchange Signal Processing Q75471 GitHub Repository (Look at the SignalProcessing\Q75471 folder).

The full code is available on my StackExchange Signal Processing Q75471 GitHub Repository (Look at the SignalProcessing\Q75471 folder).

Source Link
Royi
  • 20.5k
  • 4
  • 199
  • 240

Remark: This is adapted from How to Solve Image Deblurring with Total Variation Prior Using ADMM?

Formulation of the Problem

I am solving the problem under the following assumptions:

  • The blurring operator is Linear and Spatially Invariant (Hence applied by convolution).
  • The blurring operator is known.
  • There is a measurement noise.

So the model is:

$$ \boldsymbol{y} = H \boldsymbol{x} + \boldsymbol{n} $$

Where $ H $ is the matrix form of the blurring kernel, $ \boldsymbol{n} $ is AWGN noise and $ \boldsymbol{x} $ is the reference image to be estimated.
In the model, we assume that $ D \boldsymbol{x} \sim \text{Exponential} \left( \lambda \right) $ (See Exponential Distribution).

Hence the optimization problem (Equivalent of the MAP Estimator) is given by:

$$ \arg \min_{\boldsymbol{x}} \frac{1}{2} {\left\| H \boldsymbol{x} - \boldsymbol{y} \right\|}_{2}^{2} + \lambda \operatorname{TV} \left( \boldsymbol{x} \right) = \arg \min_{x} \frac{1}{2} {\left\| H \boldsymbol{x} - \boldsymbol{y} \right\|}_{2}^{2} + \lambda {\left\| D \boldsymbol{x} \right\|}_{1} $$

Pay attention that this model makes sense only when noise is added as otherwise the TV term only smoothens the output. So the regularization of the TV allows to control between inversing the blurring operator and smoothing the noise.

Solution by ADMM

The ADMM problem will be formulated as:

$$ $$

$$\begin{aligned} \arg \min_{\boldsymbol{x}, \boldsymbol{z}} \quad & \frac{1}{2} {\left\| H \boldsymbol{x} - \boldsymbol{y} \right\|}_{2}^{2} + \lambda {\left\| \boldsymbol{z} \right\|}_{1} \\ \text{subject to} \quad & D \boldsymbol{x} = \boldsymbol{z} \end{aligned}$$

The ADMM will have 3 steps:

  1. vX = mC \ (vY + (paramRho * mD.' * (vZ - vU)));.
  2. vZ = ProxL1(mD * vX + vU, paramLambda / paramRho);.
  3. vU = vU + mD * vX - vZ;.

Where mC = decomposition(mH.' * mH + paramRho * (mD.' * mD), 'chol'); (That's the difference from How to Solve Image Denoising with Total Variation Prior Using ADMM?).
The parameter paramRho is the parameter of the ADMM solver.

I coded this solution in a MATLAB function - SolveLsTvAdmm().
I compared it to a reference by CVX:

enter image description here enter image description here

In the above the noise level was 3 / 255 (Image was scaled to the range [0, 1]) and the blurring operator was Box Blur with radius of 2.
I didn't optimize the paramLambda to its optimal value. So one could get better results. Pay attention that for this low level of paramLambda and small size of an image the ADMM solver is slower then the direct solver of CVX.

The full code is available on my StackExchange Signal Processing Q75471 GitHub Repository.

The TV Term

In the code above I used the Anisotropic version of the Total Variation model (You may see What Does the Total Variation Norm Mean in the Context of Image Processing and The Meaning of the Terms Isotropic and Anisotropic in the Total Variation Framework).
If you're specifically after the Isotropic variation of the TV Norm then you'll have to replace the Prox Operator in my code and the derivation of the gradient.
Some resources on doing just that: