This routine will return a cell array containing the Gabor filter bank. I wrote this routine to generate Gabor filter banks to enhance fingerprints for my AFIS project.
Agree with previous comments - this code needs comments and does not run without correcting deg2rad.
Also, filter size is incorrect if sigma_x and sigma_y are not equal.