Consider the following:

im = double(imread('lena.bmp'));
subplot(1,3,1), imshow(im,[]), title('original');
t1 = dct2(im);
subplot(1,3,2), imshow(log(abs(t1)+1),[]), title('DCT transform');
t2 = dct2(t1);
subplot(1,3,3), imshow(t2,[]), title('DCT(DCT) transform');

the output is shown below:

enter image description here

Could anyone explain why the result of the second order DCT is similar to the original image?

Thanks in advance!

P.S. The same thing happens with every 2N'th DCT.


It's beacuse the inverse discrete fourier transform (DCT) is almost identical to the forward DCT. So taking twice the transform will be similar to the original signal. In fact if you provide which DCT type (DCT-I, DCT-II etc) you have used, one can show the effect more explicitly.

  • $\begingroup$ I am very new in signal processing, so I do not know what are these types of DCT and cannot say which one Matlab uses. I'll search about that (it would be great, if you could give any good resources to begin with), and thanks for the help! $\endgroup$ – Cortez Nix Oct 15 '16 at 20:12
  • 1
    $\begingroup$ DCT types I,II,III and IV exist, based on the symmetry of extended sequence formation (you may search DCT inside dsp.se). Most famous is TYPE-II that my matlab version also uses in dct() function... You can find its forward and inverse equations from wiki DCT search. $\endgroup$ – Fat32 Oct 15 '16 at 20:39
  • $\begingroup$ Maybe it is worth adding that the DCT matrix is orthogonal ($D^{-1}=D^T$). So the inverse transform is the transposed of the forward transform. One may investigate it in Matlab by D=dctmtx(N) where N is the matrix size. $\endgroup$ – msm Oct 15 '16 at 23:07
  • 1
    $\begingroup$ @msm That's for sure an important property of the DCT transform which is also another manisfestation that the inverse transform is closely reated to the forward transform. $\endgroup$ – Fat32 Oct 16 '16 at 9:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.