Code covered by the BSD License  

Highlights from
2D and 3D Gabor Filter Creators

4.0

4.0 | 2 ratings Rate this file 55 Downloads (last 30 days) File Size: 4.21 KB File ID: #42557
image thumbnail

2D and 3D Gabor Filter Creators

by

 

Can generate 2D or 3D Gabor filter kernels. Parameters enable almost any kernel to be created.

| Watch this File

File Information
Description

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.

Acknowledgements

Gabor Filter inspired this file.

Required Products Image Processing Toolbox
MATLAB release MATLAB 7.14 (R2012a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (2)
02 Sep 2014 Rahul

I don't think your multiplication of the frequency response is correct for 3D Gabor. To extend to 3D it should be:

exp(j2pi(Fsin(theta)cos(phi)x'+Fsin(theta)sin(phi)y'+Fcos(theta)z')]

http://www.sciencedirect.com/science/article/pii/S0262885605000934
Where F is the amplitude of the wave with frequency (x0,y0,z0).

27 Sep 2013 Tiger  

Contact us