I took the image below:
Divided it into 8X8
tiles, did a 2D DCT transform on each tile and chopped them to only the first 30
coefficients on each axis. Now I'm trying to visualize the result as an image that will help my intuition on the DCT plane.
Problems:
- The DCT coefficient of
(0,0)
is way larger than all the others - I want to see a difference between positive and negative coefficients.
So far, the best transform I found is below:
def visualize_dct(d):
d = np.log(abs(d).clip(0.1))
maxi, mini = d.max(), d.min()
d = 255*(d - mini)/(maxi-mini)
return d
Which gave me the image below:
Full code here: http://nbviewer.ipython.org/github/ihadanny/my-py-notebooks/blob/master/img_processing_04.ipynb
Any better ideas?