mrpro.utils.filters.gabor_filters_2d
- mrpro.utils.filters.gabor_filters_2d(n_filters: int, kernel_size: tuple, sigma: float = 2.0, frequency: float = 0.25) Tensor
Generate a bank of two-dimensional Gabor filters.
The filters consist of a Gaussian envelope modulated by a sinusoidal carrier. The orientations are uniformly distributed over the interval [0, pi), while the spatial frequency and Gaussian width are shared across all filters. Each filter is centered, zero-mean, and normalized to unit L2 norm.
- Parameters:
n_filters (
int) – Number of Gabor filters to generate.kernel_size (
tuple) – size of the 2D kernel(kernel_size_y, kernel_size_x).sigma (
float, default:2.0) – Standard deviation of the Gaussian envelope, in pixels.frequency (
float, default:0.25) – Spatial frequency of the sinusoidal carrier, in cycles per pixel.
- Returns:
Gabor filter bank with shape
(n_filters, ky, kx). Each filter has zero mean and unit L2 norm.
Notes
The orientation of filter
iis given bytheta_i = i * pi / n_filters,such that the orientations uniformly cover 180 degrees. Orientations differing by 180 degrees are omitted because they produce equivalent real-valued cosine Gabor filters.