DCT VI
- Updated2025-07-30
- 2 minute(s) read
Computes the Discrete Cosine Transform (DCT) of the input sequence X. Wire data to the X input to determine the polymorphic instance to use or manually select the instance.

1D DCT
The one-dimensional Discrete Cosine Transform DCT {X} of a sequence X is defined by the following equations:
and
where N is the length of X,
xn is the nth element of X, yk is the kth element of DCT {X}.This VI applies a fast DCT algorithm instead of calculating the Discrete Cosine Transform directly. LabVIEW implements this fast DCT algorithm using an FFT technique.
2D DCT
The two-dimensional Discrete Cosine Transform DCT {X} of a matrix X is defined by the following equation:
where M and N are the number of rows and columns, respectively, of the input matrix X,
x(m,n) is the element of X with row number m and column number n, y(u,v) is the element of DCT {X} with row number u and column number v.This VI performs a two-dimensional DCT using the following two steps:
- Perform a one-dimensional DCT row-by-row on the input matrix X. The output is Y'.
- Perform a one-dimensional DCT column-by-column on Y'. The output is DCT {X}.
Examples
Refer to the following example files included with LabVIEW.
- labview\examples\Signal Processing\Transforms\Image Compression with DCT.vi