代码可以从我的ubuntu11.04上的.tiff
图像计算傅立叶变换。在WindowsXP上,它会产生内存错误。要改变什么?谢谢您。在
def fouriertransform(result): #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.
F1 = fftpack.fft2(arrayfourier)
# Now shift so that low spatial frequencies are in the center.
F2 = fftpack.fftshift(F1)
# the 2D power spectrum is:
psd2D = np.abs(F2)**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
错误输出为:
^{pr2}$
我试图运行您的代码,但我用^{} 函数替换了
mahotas.imread
,因为我没有该库,无法重现您的错误。在进一步说明:
scipy.misc.imread
函数代替mahotas
函数吗?我想问题可能就在那里imshow
函数来可视化结果可能会更好。在相关问题 更多 >
编程相关推荐