scipy.ndimage.

fourier_shift#

scipy.ndimage.fourier_shift(input, shift, n=-1, axis=-1, output=None)[原始碼]#

多維傅立葉位移濾波器。

陣列會與位移運算的傅立葉轉換相乘。

參數:
inputarray_like

輸入陣列。

shiftfloat 或 sequence

用於濾波的方框大小。如果為 float,則 shift 對於所有軸都相同。如果為 sequence,則 shift 必須包含每個軸的值。

nint,選用

如果 n 為負數(預設),則輸入會被假設為複數 fft 的結果。如果 n 大於或等於零,則輸入會被假設為實數 fft 的結果,且 n 給出沿實數轉換方向轉換前的陣列長度。

axisint,選用

實數轉換的軸。

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