import scipy
from scipy import*
from scipy.fftpack import*
from scipy.fftpack import fft, ifft, fft2
def fouriertransform(self): #function for Fourier transform computation
for filename in glob.iglob ('*.tif'):
imgfourier = scipy.misc.imread(filename) #read the image
arrayfourier = numpy.array([imgfourier])#make an array
# Take the fourier transform of the image.
fone = fftpack.fft(arrayfourier)
# Now shift so that low spatial frequencies are in the center.
ftwo = fftpack.fftshift(fone)
# the 2D power spectrum is:
psd2D = np.abs(ftwo)**2
L = psd2D
np.set_printoptions(threshold=3)
#np.set_printoptions(precision = 3, threshold = None, edgeitems = None, linewidth = 3, suppress = True, nanstr = None, infstr = None, formatter = None)
for subarray in L:
for array in subarray:
for array in subarray:
for elem in array:
print '%3.10f\n' % elem
グローバル名 fftpack が定義されていません。なにが問題ですか?