Discrete cosine transform matrix

`D = dctmtx(n)`

`D = dctmtx(n)`

returns the `n`

-by-`n`

DCT
(discrete cosine transform) matrix. `D*A`

is the
DCT of the columns of `A`

and `D'*A`

is
the inverse DCT of the columns of `A`

(when `A`

is `n`

-by-`n`

).

`n`

is an integer scalar of class `double`

. `D`

is
returned as a matrix of class `double`

.

A = im2double(imread('rice.png')); D = dctmtx(size(A,1)); dct = D*A*D'; figure, imshow(dct)

Was this topic helpful?