1from PIL import Image
2import numpy as np
3import scipy.fftpack as fp
4
5## Functions to go from image to frequency-image and back
6im2freq = lambda data: fp.rfft(fp.rfft(data, axis=0),
7 axis=1)
8freq2im = lambda f: fp.irfft(fp.irfft(f, axis=1),
9 axis=0)