scipy.ndimage.

fourier_uniform#

scipy.ndimage.fourier_uniform(input, size, n=-1, axis=-1, output=None)[source]#

多維均勻傅立葉濾波器。

此陣列會與給定大小的方框的傅立葉轉換相乘。

參數:
inputarray_like

輸入陣列。

sizefloat or sequence

用於濾波的方框大小。如果為浮點數,則 size 對於所有軸都相同。如果為序列,則 size 必須包含每個軸一個值。

nint, optional

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

axisint, optional

實數轉換的軸。

outputndarray, optional

如果給定,則濾波輸入的結果會放置在此陣列中。

回傳值:
fourier_uniformndarray

經過濾波的輸入。

範例

>>> from scipy import ndimage, datasets
>>> import numpy.fft
>>> import matplotlib.pyplot as plt
>>> 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_uniform(input_, size=20)
>>> result = numpy.fft.ifft2(result)
>>> ax1.imshow(ascent)
>>> ax2.imshow(result.real)  # the imaginary part is an artifact
>>> plt.show()
../../_images/scipy-ndimage-fourier_uniform-1.png