scipy.ndimage.fourier_shift

scipy.ndimage.fourier_shift(input, shift, n=- 1, axis=- 1, output=None)[源代码]

多维傅里叶移位过滤。

该阵列与移位运算的傅里叶变换相乘。

参数
inputarray_like

输入数组。

shift浮点或序列

用于筛选的框的大小。如果是花车, shift 对于所有轴都是相同的。如果序列, shift 必须为每个轴包含一个值。

n整型,可选

如果 n 为负(默认),则假设输入是复数FFT的结果。如果 n 大于或等于零,则假定输入是实数FFT的结果,并且 n 给出变换前沿实际变换方向的数组长度。

axis整型,可选

真实变换的轴。

outputndarray,可选

如果给定,则将移位输入的结果放入此数组中。在这种情况下不返回任何内容。

退货
fourier_shiftndarray

转换后的输入。

示例

>>> from scipy import ndimage, misc
>>> import matplotlib.pyplot as plt
>>> import numpy.fft
>>> fig, (ax1, ax2) = plt.subplots(1, 2)
>>> plt.gray()  # show the filtered result in grayscale
>>> ascent = misc.ascent()
>>> input_ = numpy.fft.fft2(ascent)
>>> result = ndimage.fourier_shift(input_, shift=200)
>>> result = numpy.fft.ifft2(result)
>>> ax1.imshow(ascent)
>>> ax2.imshow(result.real)  # the imaginary part is an artifact
>>> plt.show()
../../_images/scipy-ndimage-fourier_shift-1.png