gpt4 book ai didi

opencv - FFTPACK Scipy 全局名称未正确定义。怎么修?

转载 作者:行者123 更新时间:2023-12-02 17:51:55 26 4
gpt4 key购买 nike

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 未定义。怎么了?

最佳答案

您的任何导入变体都没有将名称命名为 fftpack进入你的模块的命名空间。这样做:

from scipy import fftpack

关于opencv - FFTPACK Scipy 全局名称未正确定义。怎么修?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18363023/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com