viqa.utils.gabor_convolve¶
- viqa.utils.gabor_convolve(img, scales_num: int, orientations_num: int, min_wavelength=3, wavelength_scaling=3, bandwidth_param=0.55, d_theta_on_sigma=1.5)[source]¶
Compute Log Gabor filter responses.
- Parameters:
img (np.ndarray) – Image to be filtered
scales_num (int) – Number of wavelet scales
orientations_num (int) – Number of filter orientations
min_wavelength (int, default=3) – Wavelength of smallest scale filter, maximum frequency is set by this value, should be >= 3
wavelength_scaling (int, default=3) – Scaling factor between successive filters
bandwidth_param (float, default=0.55) – Ratio of standard deviation of the Gaussian describing log Gabor filter’s transfer function in the frequency domain to the filter’s center frequency (0.74 for 1 octave bandwidth, 0.55 for 2 octave bandwidth, 0.41 for 3 octave bandwidth)
d_theta_on_sigma (float, default=1.5) – Ratio of angular interval between filter orientations and standard deviation of angular Gaussian spreading function, a value of 1.5 results in approximately the minimum overlap needed to get even spectral coverage
- Returns:
Log Gabor filtered image
- Return type:
np.ndarray
Notes
Even spectral coverage and independence of filter output are dependent on bandwidth_param vs wavelength_scaling. Some experimental values:
0.85 <–> 1.3
0.74 <–> 1.6 (1 octave bandwidth)
0.65 <–> 2.1
0.55 <–> 3.0 (2 octave bandwidth)
Additionally d_theta_on_sigma should be set to 1.5 for approximately the minimum overlap needed to get even spectral coverage.
For more information see [1]. This code was originally written in Matlab by Peter Kovesi and adapted by Eric Larson. The adaption by Eric Larson is available under [2].
References
Examples
>>> import numpy as np >>> from viqa.utils import gabor_convolve >>> img = np.random.rand(128, 128) >>> res = gabor_convolve(img, scales_num=3, orientations_num=4)