Code covered by the BSD License  

Highlights from
Statistical Learning Toolbox

from Statistical Learning Toolbox by Dahua Lin
Functions for statistical learning, pattern recognition and computer vision, covering many topics.

Description of slgaborbands
Home > sltoolbox > imgproc > slgaborbands.m

slgaborbands

PURPOSE ^

SLGABORBANDS Generates a set of Gabor kernels

SYNOPSIS ^

function FB = slgaborbands(w, scales, orientations)

DESCRIPTION ^

SLGABORBANDS Generates a set of Gabor kernels

 $ Syntax $
   - FB = slgaborbands(w, scales, radians)

 $ Arguments $
   - w:                   the kernel window size is wxw
   - scales:              the scales (number of scales is m)
   - orientations:        the orientations (number of orientations is o)
   - FB:                  the array of filter banks

 $ Description $
   - Generates a set of complex filter banks for Gabor, with the 
     scales and orientations of the filter specified. If there are
     m scales and n orientations, it will product an w x w x m x n
     array containing m x n kernels.

 $ References $
   - C. Liu and H. Wechsler, ''Gabor Feature Based Classification Using the
   Enhanced Fisher Linear Discriminant Model for Face Recognition'', IEEE
   Trans. on Imag. Proc, Vol. 11, No. 4, Apr, 2002.

 $ History $
   - Created by Dahua Lin on Feb 25th, 2006.
   - Modified by Dahua Lin on Aug 4th, 2006.

CROSS-REFERENCE INFORMATION ^

This function calls:
This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function FB = slgaborbands(w, scales, orientations)
0002 %SLGABORBANDS Generates a set of Gabor kernels
0003 %
0004 % $ Syntax $
0005 %   - FB = slgaborbands(w, scales, radians)
0006 %
0007 % $ Arguments $
0008 %   - w:                   the kernel window size is wxw
0009 %   - scales:              the scales (number of scales is m)
0010 %   - orientations:        the orientations (number of orientations is o)
0011 %   - FB:                  the array of filter banks
0012 %
0013 % $ Description $
0014 %   - Generates a set of complex filter banks for Gabor, with the
0015 %     scales and orientations of the filter specified. If there are
0016 %     m scales and n orientations, it will product an w x w x m x n
0017 %     array containing m x n kernels.
0018 %
0019 % $ References $
0020 %   - C. Liu and H. Wechsler, ''Gabor Feature Based Classification Using the
0021 %   Enhanced Fisher Linear Discriminant Model for Face Recognition'', IEEE
0022 %   Trans. on Imag. Proc, Vol. 11, No. 4, Apr, 2002.
0023 %
0024 % $ History $
0025 %   - Created by Dahua Lin on Feb 25th, 2006.
0026 %   - Modified by Dahua Lin on Aug 4th, 2006.
0027 %
0028 
0029 
0030 m = length(scales);
0031 n = length(orientations);
0032 FB = zeros(w, w, m, n);
0033 
0034 for i = 1 : m
0035     for j = 1 : n
0036         FB(:,:,i,j) = single_gabor_kernel(w, scales(i), orientations(j));
0037     end
0038 end
0039 
0040 function M = single_gabor_kernel(w, v, u)
0041 % v - scale, u - orientation
0042 
0043 mincoord = fix(- w / 2);
0044 coords = mincoord + (0 : w-1);
0045 [X, Y] = meshgrid(coords, coords);
0046 
0047 kmax = pi / 2;
0048 f = sqrt(2);
0049 sigma = 2 * pi;
0050 
0051 k_v = kmax / f^v;
0052 phi_u = pi * u / 8; 
0053 k_uv = k_v * exp(i * phi_u);
0054 
0055 F1 = (k_v^2) / (sigma^2) * exp(-k_v^2 * abs(X.^2 + Y.^2) / (2*sigma^2)) ;
0056 F2 = exp(i * (real(k_uv) * X + imag(k_uv) * Y)) - exp(-sigma^2/2);
0057 M = F1 .* F2;
0058 
0059 
0060 
0061 
0062 
0063

Generated on Wed 20-Sep-2006 12:43:11 by m2html © 2003

Contact us at files@mathworks.com