2D and 3D Gabor Filter Creators
2D is fully functional.
3D is an really-really almost there implementation. It runs, and (should be) bug-free. Help is provided and code is well commented.
The last unimplemented aspect is the ability to "roll" (in addition to yaw and pitch) the 3D kernel. The math to implement it is in the code, and all you need to do is uncomment it. I didn't do it because I'm done with it and didn't feel like thinking about the math to create an appropriately-sized meshgrid.
Also included is the 2D version and a little no-frills utility to view 3D matrices.
This was created by heavily modifying 23253: gabor_fn.m by Gao Yang
>> help gabor3_fwb
Returns 3D gabor filter.
gb=GABOR_FWB(aspect,theta,bw,psi,sigma,sz)
[aspecta, aspectb]
= 2 element array giving aspect ratios for 2 minor axis
(eg: [0.5, 1], for major < minoraxis1, major = minoraxi2)
[theta,phi]
= yaw and pitch of major axis (0-2*pi)
roll isn't implemented, sorry.
bw = spatial bandwidth in pixels (decreasing fine detail,), (eg: >=1)
scales the frequency of the cosine modulation
psi, = phase shift, [optional, default: 0]
sigma = scales the falloff of the gaussian, (must be >=2) [default: = bw]
+ can set to 'auto' to maintain default functionality
[x y z] = size of gabor kernel created [optional, size set automatically
to 3 standard deviations of gaussian kernel]
example call: G = gabor3_fwb([1 1], [pi/4 pi/4], 10, 0, 20);
>> help gabor_fwb
Returns 2D or 3D gabor filter.
gb=gabor_fwb(aspect,theta,bw,psi,sigma,sz)
aspect = aspect ratio (ratio of x to y), (eg: 0.5, for major < minor axis)
theta = angle in rad of major axis, (0-2*pi)
bw = spatial bandwidth in pixels (decreasing fine detail,), (eg: >=1)
scales the frequency of the cosine modulation
psi = phase shift, [optional, default: 0]
sigma = scales the falloff of the gaussian, (must be >=2) [default: = bw]
+ can set to 'auto' to maintain default functionality
sz = size of gabor kernel created [optional, size set automatically
to 3 standard deviations of gaussian kernel]
>> help slice_slider
slice_slider(3d_volume) plots a 3d volume 1 slice at a time
on the current figure.
A slider bar allows you to slice through the volume.
Assumes that you want to look at the third dimension using
imagesc and the default colormap.
Fix it/make it better if you want to.
Cite As
Frederick Bryan (2024). 2D and 3D Gabor Filter Creators (https://www.mathworks.com/matlabcentral/fileexchange/42557-2d-and-3d-gabor-filter-creators), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
- Image Processing and Computer Vision > Image Processing Toolbox > 3-D Volumetric Image Processing >
- Image Processing and Computer Vision > Image Processing Toolbox > Image Segmentation and Analysis > Image Segmentation >
- Image Processing and Computer Vision > Image Processing Toolbox > Image Filtering and Enhancement > Image Filtering >
Tags
Acknowledgements
Inspired by: Gabor filter
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
Version | Published | Release Notes | |
---|---|---|---|
1.0.0.0 |