我的 Python 代码,专为计算傅立叶变换而设计,无法完成任务。
def fouriertransform(result): #function for FTM computation
for filename in glob.iglob('*.tif'):
imgfourier = scipy.misc.imread(filename, flatten = True)
image = np.array([imgfourier])#make an array as np
arr = np.abs(np.fft.fftshift(np.fft.fft2(image)))**2
with open('сomput.csv', 'wb') as csvfile:
for elem in arr.flat[:50]:
writer = csv.writer(csvfile, .....)
writer.writerow([('{}\t'.format(elem))])
回溯(最近一次通话最后):
File "C:\Python27\lib\site-packages\numpy\fft\fftpack.py", line 524, in _raw_fftnd
a = function(a, n=s[ii], axis=axes[ii])
File "C:\Python27\lib\site-packages\numpy\fft\fftpack.py", line 164, in fft
return _raw_fft(a, n, axis, fftpack.cffti, fftpack.cfftf, _fft_cache)
File "C:\Python27\lib\site-packages\numpy\fft\fftpack.py", line 75, in _raw_fft
r = work_function(a, wsave)
内存错误
图像很大 90 MB,如果它以某种方式适用于 1-5 MB 图像,如何解决问题?
谢谢