1
votes

I have a project of FPK (Finger-Knuckle-Print) and one of the steps after cutting the interesting part of the finger is to filter the image by using Gabor filter.

For a few (full) days now I've been trying to make the filter bank and filtering the image from the formula and write it as Matlab code.

I read a lot about the parameter's value, but I'm confused, what value should I take?

What is the process that I need to do?

Should I use conv2 or imfilter (symmetric or covn)?

Thanks

Image of the Formula

2

2 Answers

-1
votes

you extract high frequency information in image. The necessary condition of high filter, the sum of filter gb(x,y) is 0 (x=0..N-1 , y=0..N-1) (N=3,5,7.. or windows 3x3 or 5x5 or 7x7 or 9x9 or 11x11, ...31x31). gb(x,y) is your filter, the value of filter is real (your choice the cos or sin, your result is dephased PI/2 compared sin, no need to use complex Gabor filter). It's very simple.It's high passe oriented filter.

%   See http://en.wikipedia.org/wiki/Gabor_filter.
x_theta=x*cos(theta)+y*sin(theta);
y_theta=-x*sin(theta)+y*cos(theta);

gb= exp(-.5*(x_theta.^2/sigma_x^2+y_theta.^2/sigma_y^2)).*cos(2*pi/lambda*x_theta+psi);

Def

 C = conv2(A, B) performs the 2-D convolution of matrices A and B.
 If [ma,na] = size(A), [mb,nb] = size(B), and [mc,nc] = size(C), then
 mc = max([ma+mb-1,ma,mb]) and nc = max([na+nb-1,na,nb]).

ma,na size of filter not same size of mb and nb. ma

Example, if you have the image 128x128 pixel resolution, the filter size is only na<128, and ma<128. The filter should not be very large.

Or filter2 Two-dimensional digital filter. Y = filter2(B,X,SHAPE) filters the data in X with the 2-D FIR filter in the matrix B. The result, Y, is computed using 2-D correlation and is the same size as X (SHAPE is 'same'). is same thing, but the B is the filter. I choice the second. SHAPE value is,

            'same'  - (default) returns the central part of the 
                     correlation that is the same size as X.
            'valid' - returns only those parts of the correlation
            that are computed without the zero-padded
            edges, size(Y) < size(X).
            'full'  - returns the full 2-D correlation, 
            size(Y) > size(X).
-1
votes
  %Read the original gray input image
      image=imread('cameraman.jpg');
  %convert it to gray scale
      image=double(image);
  %show the image
      figure(1);
      imshow(image);
      title('Input Image');

      %Gabor filter size 7x7 and orientation 90 degree
       %declare the variables
      gamma=0.3; %aspect ratio
      psi=0; %phase 
      theta=pi/2; %orientation you can change theta 0°, 45°, 90°,180° but   value is in radian..
      bw=2.8; %bandwidth or effective width
      lambda=3.5; % wavelength
      pi=180;

      N=9; % size of filter 
       Cx=ceil(N/2);
       Cy=ceil(N/2);   
       [x,y] = meshgrid(N-Cx:N+Cx,N-Cy:N+Cy);
       x_theta=(x-Cx)*cos(theta)+(y-Cy)*sin(theta);  % scalair value 
       y_theta=-(x-Cx)*sin(theta)+(y-Cy)*cos(theta); % scalair value
       % calculate Gabor filter 
        gb= exp(-(x_theta.^2/2*bw^2+ gamma^2*y_theta.^2/2*bw^2)).*cos(2*pi/lambda*x_theta+psi);
       image_gb=conv2(image,gb,'same');
      imshow(image_gb);
      title('filtered image');

Gb is the filter to use in conv2 or filter2. The size of Gb is NxN example 7x7 or 9x9 or 11x11 (odd or even filter). You can optimize you code with meshgrid.. http://en.wikipedia.org/wiki/Gabor_filter