from pylab import *
from scipy.ndimage import filters
s = filters.gaussian_filter(randn(1024),2.0)
plot(s)
[<matplotlib.lines.Line2D at 0x3858d50>]
def DCT(N):
n=arange(N)
return array([cos(pi/N * (n+0.5) * k) for k in range(N)])
imshow(DCT(1024))
<matplotlib.image.AxesImage at 0x3945090>
def dct(s):
return dot(DCT(len(s)),s)
gray()
cs = DCT(1024)
imshow(dot(cs,cs.T))
print amin(dot(cs,cs.T)),amax(dot(cs,cs.T))
-2.70939609181e-11 1024.0
S = dct(s)
plot(S)
[<matplotlib.lines.Line2D at 0x456bfd0>]