UtilsLite
Utilities for C++ programming
Loading...
Searching...
No Matches
Utils::TVD< Real > Class Template Reference

Class for performing Total Variation Denoising (TVD) on 1D signals. More...

#include <Utils_TVD.hh>

Static Public Member Functions

static void denoise (Integer N, Real const y[], Real lambda, Real x[])
 Denoises a 1D signal using total variation denoising.
 
static void denoise (Integer N, Real const y[], Integer incy, Real lambda, Real x[], Integer incx)
 Performs total variation denoising on a 1D signal.
 

Detailed Description

template<typename Real>
class Utils::TVD< Real >

Class for performing Total Variation Denoising (TVD) on 1D signals.

The TVD class implements algorithms for denoising signals by minimizing total variation. The primary method provided is denoise, which applies total variation denoising to a given input signal.

This algorithm minimizes the objective function defined as:

\[ \textrm{minimize}\quad \sum_k (y_k - x_k)^2 + \lambda \sum_k |x_{k+1}-x_k| \]

where \( y_k \) is the input signal, \( x_k \) is the denoised signal, and \( \lambda \) is a regularization parameter that controls the trade-off between data fidelity and smoothness of the result.

Note
This implementation is based on the work of:

| Laurent Condat. | A Direct Algorithm for 1D Total Variation Denoising. | IEEE Signal Processing Letters, | Institute of Electrical and Electronics Engineers, 2013, 20 (11), pp.1054-1057. | DOI: <10.1109/LSP.2013.2278339>. | Available at: https://hal.science/hal-00675043v4

Template Parameters
RealThe data type used for the computation (e.g., float, double).

Member Function Documentation

◆ denoise() [1/2]

template<typename Real>
void Utils::TVD< Real >::denoise ( Integer N,
Real const y[],
Integer incy,
Real lambda,
Real x[],
Integer incx )
static

Performs total variation denoising on a 1D signal.

This method minimizes the objective function defined as:

\[ \textrm{minimize}\quad \sum_k (y_k - x_k)^2 + \lambda \sum_k |x_{k+1}-x_k| \]

where \( y_k \) is the input signal, \( x_k \) is the denoised signal, and \( \lambda \) is a regularization parameter that controls the trade-off between data fidelity and smoothness of the result.

Parameters
NThe number of elements in the input signal.
yA pointer to the input signal array (size N).
incyThe increment between consecutive elements in the input array (y).
lambdaThe regularization parameter that controls the smoothness.
xA pointer to the output denoised signal array (size N).
incxThe increment between consecutive elements in the output array (x).

◆ denoise() [2/2]

template<typename Real>
static void Utils::TVD< Real >::denoise ( Integer N,
Real const y[],
Real lambda,
Real x[] )
inlinestatic

Denoises a 1D signal using total variation denoising.

This method is a convenience wrapper that calls the more detailed denoise method with a default increment of 1 for both the input and output arrays.

Parameters
NThe number of elements in the input signal.
yA pointer to the input signal array (size N).
lambdaThe regularization parameter that controls the smoothness.
xA pointer to the output denoised signal array (size N).

The documentation for this class was generated from the following files: