2

There are two alternative methods to compute DCT and its inverse in MATLAB. One is dct2/idct2 and the other is the transformation matrix computed by dctmtx. Why is there an alternative way based on matrix multiplications making use of dctmtx?

Eitan T
  • 32,660
  • 14
  • 72
  • 109
rcp
  • 111
  • 1
  • 2
  • 3

1 Answers1

4

"If A is square, the two-dimensional DCT of A can 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."

Where D = dctmtx(n)

Source: http://www.mathworks.com/help/toolbox/images/ref/dctmtx.html

Adam27X
  • 889
  • 1
  • 7
  • 16
  • 3
    The weird thing is, it is not completely true. Using matlab `dct2` and the `D*I*D'` method gives slightly different results. – Maurits Nov 28 '12 at 20:03