scipy.ndimage.

fourier_uniform#

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

多维均匀傅里叶滤波器。

该数组与给定大小的盒子的傅里叶变换相乘。

参数:
input类数组

输入数组。

size浮点数或序列

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

n整型,可选

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

axis整型,可选

实数变换的轴。

outputndarray,可选

如果给出,滤波结果将存放在此数组中。

返回:
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