scipy.ndimage.

fourier_shift#

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

多维傅里叶移位滤波器。

该数组与移位操作的傅里叶变换相乘。

参数:
input类数组

输入数组。

shift浮点数或序列

用于滤波的框的大小。如果为浮点数,则所有轴的 shift 相同。如果为序列,则 shift 必须包含每个轴的一个值。

n整数,可选

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

axis整数,可选

实数变换的轴。

outputndarray,可选

如果给定,则将输入移位的结果放置在此数组中。

返回:
fourier_shiftndarray

移位后的输入。

示例

>>> from scipy import ndimage, datasets
>>> import matplotlib.pyplot as plt
>>> import numpy.fft
>>> fig, (ax1, ax2) = plt.subplots(1, 2)
>>> plt.gray()  # show the filtered result in grayscale
>>> ascent = datasets.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