DCT2D

class colibri.recovery.terms.transforms.DCT2D(norm='ortho')[source]

Bases: object

2D Discrete Cosine Transform

The 2D DCT is defined as:

\[X(u,v) = \frac{2}{\sqrt{MN}} \sum_{x=0}^{M-1} \sum_{y=0}^{N-1} x(u) y(v) f(x,y) \cos\left(\frac{(2x+1)u\pi}{2M}\right) \cos\left(\frac{(2y+1)v\pi}{2N}\right)\]

The 2D DCT is a separable transform, and can be computed as two 1D DCTs along the rows and columns of the image.

Parameters:

norm (str, optional) – The normalization to be applied to the transform. Defaults to ‘ortho’.

Returns:

The 2D DCT of the input image.

Return type:

torch.Tensor

Initializes the DCT2D class.

Parameters:

norm (str, optional) – The normalization to be applied to the transform. Defaults to ‘ortho’.

forward(x)[source]

Computes the 2D DCT of the input image.

Parameters:

x (torch.Tensor) – The input image.

Returns:

The 2D DCT of the input image.

Return type:

torch.Tensor

inverse(x)[source]

Computes the inverse 2D DCT of the input image.

Parameters:

x (torch.Tensor) – The input image.

Returns:

The inverse 2D DCT of the input image.

Return type:

torch.Tensor

Examples using DCT2D:

Demo FISTA.

Demo FISTA.

Demo PnP.

Demo PnP.