gabor filter:
function result = gaborkernel2d(lambda, sigma, theta, phi, gamma, bandwidth)
% VERSION 2004-04-05
% CREATED BY: N. Petkov and M.B. Wieling, Groningen University
%
% GABORKERNEL2D(LAMBDA, SIGMA, THETA, PHI, GAMMA, BANDWIDTH)
% fills a (2N+1)*(2N+1) matrix with the values of a 2D Gabor function. N is computed from SIGMA.
% LAMBDA - preferred wavelength (period of the cosine factor) [in pixels]
% SIGMA - standard deviation of the Gaussian factor [in pixels]
% THETA - preferred orientation [in radians]; can be a 1D array
% PHI - phase offset [in radians] of the cosine factor; can be a 1D array
% GAMMA - spatial aspect ratio (of the x- and y-axis of the Gaussian elipse)
% BANDWIDTH - spatial frequency bandwidth at half response,
% BANDWIDTH, SIGMA and LAMBDA are interdependent. To use BANDWIDTH,
% the input value of one of SIGMA or LAMBDA must be 0. Otherwise BANDWIDTH i