⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gaborpalm.m

📁 指纹识别系统设计全过程实现 matlab软件环境实现
💻 M
字号:
% function [output]=gaborpalm(imagein)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% this function is used to create gaborpalms and then gained the sampled matrix 
% wenchangzhi 2006/9/17
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% clear,close all;
clc;

A=[];
scale=5;  %  denote the scale of the gabor wavelet
orientation=4;  % denote the orientation of the gabor wavelet
kmax=pi/2;   % the highest frequency with the smallest kernel size
sigma=pi*2;  % the parameter :theta 
mask_size=128;  % for every kernel the size is 64*64% this is the size of Gabor mask
f=sqrt(2);   % f is the spacing factor
sig=sigma*sigma; % the squre of theta
offset=mask_size/2; 

% nargin=8;

imagein=double(imread('P_30_1.bmp'));
figure(3);
imshow(uint8(imagein));

k=1;
for v=0:(scale-1)
    for u=0:(orientation-1)
        kv=kmax/f^v;
        phiu=u*pi/4;
        kv_mag=kv*kv;
        gabor_kel=zeros(mask_size,mask_size);        
            for x=0:(mask_size-1)                  
                for y=0:(mask_size-1)                
                    i=x-offset;                
                    j=y-offset;                
                    mag=i*i+j*j;                
                    gabor_kel(x+1,y+1)=kv_mag/sig*exp(-0.5*kv_mag*mag/sig)*(exp(sqrt(-1)*kv*(i*cos(phiu)+j*sin(phiu))-exp(-1.0*sig/2.0)));                   
                end           %the gabor kernel      
            end    
%               result=abs(fftshift(ifft2((fft2(imagein)).*fft2(gabor_kel))));    % 与输入图像相卷积得到Gabopam    
             
              result=abs(ifft2(fft2(imagein).*fft2(fftshift(gabor_kerl))));    % 与输入图像相卷积得到Gabopam    

              figure(1);
              subplot(5,4,k);
              imshow(result,[]);
              figure(2);
              subplot(5,4,k);
              imshow(real(gabor_kel),[]);
              k=k+1;
              
              
%               result_sample=result(1:nargin:mask_size,1:nargin:mask_size);  %对得到的结果进行下采样,采样因子为4
%               
%               m=mean2(result_sample);
%               s=std2(result_sample);
%               result_norm=(result_sample-m)/s;  % 对得到的特征向量进行归一化
%               
%               result_norm=result_norm(1:end); % 变为1*256的行向量 
%               A=[A result_norm'];   %特征向量的长度为 20*256(20=4*5)
       end
end  
% output=A;


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -