1
$\begingroup$

I would like to compare the sorted coefficients of the Discrete Cosine Transform with that of the Discrete Wavelet Transform using the Haar wavelets. From theory, the discrete wavelet transform offers more compaction of the coefficient energy into lower frequencies than the DCT. However in Mathematica I am getting the opposite result. Here is the image I am compressing:

enter image description here

here is the code

enter image description here enter image description here

TruckData = ImageData[GTruck];
partdata = Partition[TruckData, {8, 8}, {8, 8}, 1, 0];
t = Map[FourierDCT[#, 2] &, partdata];
coeffs = Sort[Flatten[t], Greater];

wtdata = DiscreteWaveletTransform[GTruck];
wcoeffs = Sort[Flatten[wtdata[Automatic, "Values"]], Greater];

ListLogPlot[{coeffs[[1 ;; 4000]], wcoeffs[[1 ;; 4000]]}, Joined -> True, 
  PlotLegends -> Automatic]

enter image description here

As can be seen, the top curve which corresponds to the DWT is of higher magnitude. The situation should be reversed.

Why is that?

$\endgroup$

Your Answer

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

Browse other questions tagged or ask your own question.