Expand description
Fourier-domain filters, following scipy.ndimage: fourier_gaussian, fourier_uniform,
fourier_ellipsoid and fourier_shift.
By the convolution theorem, convolving an image with a kernel multiplies its discrete Fourier
transform by the kernel’s transform. These functions take a spectrum (the output of a 2D FFT,
or of a real FFT along the rows) and multiply it by a transfer function given in closed form:
a Gaussian, a box (sinc), a disc or ellipse (the Airy pattern, 2 J₁(x)/x), or a phase ramp
(a shift by any fraction of a pixel). The cost is that of the FFTs, whatever the kernel size,
and the convolution is circular: the image is treated as periodic.
See the book entry Fourier-domain filters.
Enums§
- Spectrum
- What kind of spectrum a Fourier filter receives (SciPy’s
nargument withaxis = -1).
Functions§
- fourier_
ellipsoid - A uniform ellipse with axes
size = (rows, columns)pixels (a disc when they are equal): multiplies by2 J₁(x)/xwithx = π √((s_r f_r)² + (s_c f_c)²), the Airy pattern. - fourier_
filter - Filters a real image in the Fourier domain: a 2D FFT, the given filter on the full spectrum,
and the real part of the inverse FFT. For example,
fourier_filter(&image, |s| fourier_gaussian(s, (2.0, 2.0), Spectrum::Full)). - fourier_
gaussian - Gaussian smoothing with standard deviations
sigma = (rows, columns)in pixels: multiplies byexp(−2π² (σ_r² f_r² + σ_c² f_c²)), the Fourier transform of the continuous Gaussian. - fourier_
shift - A shift by
shift = (rows, columns)pixels, which need not be whole: multiplies by the phase rampexp(−2πi (s_r f_r + s_c f_c)). Content moves towards larger indices for positive shifts, wrapping round the edges. - fourier_
uniform - A box (moving average) of
size = (rows, columns)pixels: multiplies bysinc(s_r f_r) sinc(s_c f_c), withsinc(x) = sin(πx)/(πx). - frequencies
- The frequencies (cycles per sample) of the rows and columns of a spectrum of shape
dim.