문제

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?

도움이 되었습니까?

해결책

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
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top