Learn R Programming

tvR (version 0.3.3)

denoise1: Total Variation Denoising for Signal

Description

Given a 1-dimensional signal f, it solves an optimization of the form, $$u^* = argmin_u E(u,f)+\lambda V(u)$$ where \(E(u,f)\) is fidelity term and \(V(u)\) is total variation regularization term. The naming convention of a parameter method is <problem type> + <name of algorithm>. For more details, see the section below.

Usage

denoise1(signal, lambda = 1, niter = 100, method = c("TVL2.IC", "TVL2.MM"))

Value

a vector of same length as input signal.

Arguments

signal

vector of noisy signal.

lambda

regularization parameter (positive real number).

niter

total number of iterations.

method

indicating problem and algorithm combination.

Algorithms for TV-L2 problem

The cost function for TV-L2 problem is $$min_u \frac{1}{2} |u-f|_2^2 + \lambda |\nabla u|$$ where for a given 1-dimensional vector, \(|\nabla u| = \sum |u_{i+1}-u_{i}|\). Algorithms (in conjunction with model type) for this problems are

"TVL2.IC"

Iterative Clipping algorithm.

"TVL2.MM"

Majorization-Minorization algorithm.

The codes are translated from MATLAB scripts by Ivan Selesnick.

References

rudin_nonlinear_1992tvR

selesnick_convex_2015tvR

Examples

Run this code
# \donttest{
## generate a stepped signal
x = rep(sample(1:5,10,replace=TRUE), each=50)

## add some additive white noise
xnoised = x + rnorm(length(x), sd=0.25)

## apply denoising process
xproc1 = denoise1(xnoised, method = "TVL2.IC")
xproc2 = denoise1(xnoised, method = "TVL2.MM")

## plot noisy and denoised signals
plot(xnoised, pch=19, cex=0.1, main="Noisy signal")
lines(xproc1, col="blue", lwd=2)
lines(xproc2, col="red", lwd=2)
legend("bottomleft",legend=c("Noisy","TVL2.IC","TVL2.MM"),
col=c("black","blue","red"),#' lty = c("solid", "solid", "solid"),
lwd = c(0, 2, 2), pch = c(19, NA, NA),
pt.cex = c(1, NA, NA), inset = 0.05)
# }

Run the code above in your browser using DataLab