denoise2: Total Variation Denoising for Image

Description Usage Arguments Value Data format Algorithms for TV-L1 problem Algorithms for TV-L2 problem References Examples

View source: R/denoise2.R

Description

Given an image f, it solves an optimization of the form,

u^* = argmin_u E(u,f)+λ 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

1
2
3
4
5
6
7
denoise2(
  data,
  lambda = 1,
  niter = 100,
  method = c("TVL1.PrimalDual", "TVL2.PrimalDual", "TVL2.FiniteDifference"),
  normalize = FALSE
)

Arguments

data

standard 2d or 3d array.

lambda

regularization parameter (positive real number).

niter

total number of iterations.

method

indicating problem and algorithm combination.

normalize

a logical; TRUE to make the range in [0,1], or FALSE otherwise.

Value

denoised array as same size of data.

Data format

An input data can be either (1) 2-dimensional matrix representaing grayscale image, or (2) 3-dimensional array for color image.

Algorithms for TV-L1 problem

The cost function for TV-L2 problem is

min_u |u-f|_1 + λ |\nabla u|

where for a given 2-dimensional array, |\nabla u| = ∑ sqrt(u_x^2 + u_y^2) Algorithms (in conjunction with model type) for this problems are

"TVL1.PrimalDual"

Primal-Dual algorithm.

Algorithms for TV-L2 problem

The cost function for TV-L2 problem is

min_u |u-f|_2^2 + λ |\nabla u|

and algorithms (in conjunction with model type) for this problems are

"TVL2.PrimalDual"

Primal-Dual algorithm.

"TVL2.FiniteDifference"

Finite Difference scheme with fixed point iteration.

References

\insertRef

rudin_nonlinear_1992tvR

\insertRef

chambolle_first-order_2011tvR

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
## Not run: 
## Load grey-scale 'lena' data
data(lena128)

## Add white noise
sinfo   <- dim(lena128)   # get the size information
xnoised <- lena128 + array(rnorm(128*128, sd=10), sinfo)

## apply denoising models
xproc1 <- denoise2(xnoised, lambda=10, method="TVL2.FiniteDifference")
xproc2 <- denoise2(xnoised, lambda=10, method="TVL1.PrimalDual")

## compare
gcol = gray(0:256/256)
opar <- par(no.readonly=TRUE)
par(mfrow=c(2,2), pty="s")
image(lena128, main="original", col=gcol)
image(xnoised, main="noised", col=gcol)
image(xproc1, main="TVL2.FiniteDifference", col=gcol)
image(xproc2, main="TVL1.PrimalDual", col=gcol)
par(opar)

## End(Not run)

tvR documentation built on Aug. 23, 2021, 1:08 a.m.