dask_image.ndfourier 包

dask_image.ndfourier 包

dask_image.ndfourier.fourier_gaussian(image, sigma, n=- 1, axis=- 1)[源码]

多维高斯傅里叶滤波器。

该数组与高斯核的傅里叶变换相乘。

参数
  • image (array_like) – 输入图像。

  • sigma (float or sequence) – 高斯核的 sigma。如果是浮点数,则 sigma 对所有轴相同。如果是序列,则 sigma 必须包含每个轴的一个值。

  • n (int, optional) – 如果 n 为负数(默认),则假定图像是复数 fft 的结果。如果 n 大于或等于零,则假定图像是实数 fft 的结果,并且 n 给出在实数变换方向上变换之前的数组长度。

  • axis (int, optional) – 实数变换的轴。

返回值

fourier_gaussian

返回类型

Dask 数组

示例

>>> from scipy import ndimage, misc
>>> import numpy.fft
>>> import matplotlib.pyplot as plt
>>> fig, (ax1, ax2) = plt.subplots(1, 2)
>>> plt.gray()  # show the filtered result in grayscale
>>> ascent = misc.ascent()
>>> image = numpy.fft.fft2(ascent)
>>> result = ndimage.fourier_gaussian(image, sigma=4)
>>> result = numpy.fft.ifft2(result)
>>> ax1.imshow(ascent)
dask_image.ndfourier.fourier_shift(image, shift, n=- 1, axis=- 1)[源码]

多维傅里叶移位滤波器。

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

参数
  • image (array_like) – 输入图像。

  • shift (float or sequence) – 用于滤波的框的大小。如果是浮点数,则 shift 对所有轴相同。如果是序列,则 shift 必须包含每个轴的一个值。

  • n (int, optional) – 如果 n 为负数(默认),则假定图像是复数 fft 的结果。如果 n 大于或等于零,则假定图像是实数 fft 的结果,并且 n 给出在实数变换方向上变换之前的数组长度。

  • axis (int, optional) – 实数变换的轴。

返回值

fourier_shift

返回类型

Dask 数组

示例

>>> 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()
>>> image = numpy.fft.fft2(ascent)
>>> result = ndimage.fourier_shift(image, shift=200)
>>> result = numpy.fft.ifft2(result)
>>> ax1.imshow(ascent)
>>> ax2.imshow(result.real)  # the imaginary part is an artifact
>>> plt.show()
dask_image.ndfourier.fourier_uniform(image, size, n=- 1, axis=- 1)[源码]

多维均匀傅里叶滤波器。

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

参数
  • image (array_like) – 输入图像。

  • size (float or sequence) – 用于滤波的框的大小。如果是浮点数,则 size 对所有轴相同。如果是序列,则 size 必须包含每个轴的一个值。

  • n (int, optional) – 如果 n 为负数(默认),则假定图像是复数 fft 的结果。如果 n 大于或等于零,则假定图像是实数 fft 的结果,并且 n 给出在实数变换方向上变换之前的数组长度。

  • axis (int, optional) – 实数变换的轴。

返回值

fourier_uniform – 滤波后的图像。如果 output 作为参数给出,则返回 None。

返回类型

Dask 数组

示例

>>> from scipy import ndimage, misc
>>> import numpy.fft
>>> import matplotlib.pyplot as plt
>>> fig, (ax1, ax2) = plt.subplots(1, 2)
>>> plt.gray()  # show the filtered result in grayscale
>>> ascent = misc.ascent()
>>> image = numpy.fft.fft2(ascent)
>>> result = ndimage.fourier_uniform(image, size=20)
>>> result = numpy.fft.ifft2(result)
>>> ax1.imshow(ascent)
>>> ax2.imshow(result.real)  # the imaginary part is an artifact
>>> plt.show()