Reputation: 1151
I checked with dct
function in Matlab but it only implemented DCT along the columns for a matrix input:
>> help dct
If X is a matrix, the DCT operation is applied to each
column.
Is there a function that can perform 2D DCT in Matlab, or are there some algorithms that can apply dct
, make some transform, then obtain the 2D DCT?
Upvotes: 1
Views: 2202
Reputation: 8476
According to Wikipedia, "Multidimensional variants of the various DCT types follow straightforwardly from the one-dimensional definitions: they are simply a separable product (equivalently, a composition) of DCTs along each dimension."
Following this, you should be able to get the 2d-DCT by computing
dct(dct(A.').')
There's also dct2
in the Image Processing Toolbox, and the core of the implementation is
b = dct(a, mpad);
if m > 1 && n > 1, b = dct(b.', npad).'; end
Upvotes: 3