Discrete cosine transform matrix
D = dctmtx(n)
D = dctmtx(n) returns the
(discrete cosine transform) matrix.
D*A is the
DCT of the columns of
the inverse DCT of the columns of
n is an integer scalar of class
returned as a matrix of class
A = im2double(imread('rice.png')); D = dctmtx(size(A,1)); dct = D*A*D'; figure, imshow(dct)
A is square, the two-dimensional DCT of
be computed as
D*A*D'. This computation is sometimes
faster than using
dct2, especially if you are computing
a large number of small DCTs, because
D needs to
be determined only once.
For example, in JPEG compression, the DCT of each 8-by-8 block
is computed. To perform this computation, use
D, and then calculate each DCT using
each 8-by-8 block). This is faster than calling
each individual block.