ghallak/jpeg-python

1-d dct transform not 2-d

sibosutd opened this issue · 1 comments

Hi Gaith,
I noticed in your jpeg repo that dct transformation code is not right,
dct_matrix = fftpack.dct(block, norm='ortho')
since the fftpack.dct() function is only 1D DCT instead of 2D DCT as in JPEG compression.
It should be implemented as follows,

def dct2(image):
    return fftpack.dct(fftpack.dct(image.T, norm='ortho').T, norm='ortho')
dct_matrix = dct2(block)

And similar for inverse dct transform..

@sibosutd Got that fixed here: 2fe1bd2.

Thank you for letting me know!