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

📄 fpextractdemo.m

📁 简单的指纹识别算法代码,带测试图片.非商业代码.
💻 M
📖 第 1 页 / 共 3 页
字号:
function fpextractdemo(action, varargin)
%	FPEXTRACTDEMO Fingerprint extracting the features on DEMO API program
%   Cheng Long Adam Wang, September 2002
%   
%   $Revision: 1.0 $  $Date: 2002.10.2  $
%   $Revision: 2.0 $  $Date: 2003.11.29 $    by Luigi Rosa
%                                            email:   luigi.rosa@tiscali.it 
%                                            mobile:  +393403463208
%                                            website: http://utenti.lycos.it/matlab
%
%   Modified:
%   - new GUI
%   - 8 Gabor filters 0 22.5 45 67.5 90 112.5 135 157.5 degree
%   - Convolution is performed in frequency domain
%   - DataBase
%   - Fingerprint matching
%   - Error management
%
% Input fingerprint should be 256 x 256 grayscale bmp image
% 8-bit grayscale image @ 500 dpi.
% If these conditions are not verified some parameters in m-functions
% should be changed in a proper way.
%  
%   Options:
%     - Centralize:    calculate the center point and the binarized image
%     - Crop:          image cropping
%     - Sectorize:     visualize the circular sectors
%     - Normalize:     normalize input image
%     - Gabor filters: visualize the Gabor filters
%     - Convolute:     compute convolution of input image and Gabor filters
%     - Features:      FingerCodes visualization
%     - FingerCode:    add the input fingerprint to Database
%     - Check:         fingerprint matching
%
%
% A crucial step in fingerprint recognition is center point determination. 
% If any error occurs while cropping image you can use the auxiliary m-file
% "vedicentro.m": it visualizes the input fingerprint and the center point
% calculated by the m-function "centralizing.m"
%
%
%   References
%
%   Cheng Long Adam Wang, researcher
%   Fingerprint Recognition System
%   http://home.kimo.com.tw/carouse9/FRS.htm
%
%   A. K. Jain, S. Prabhakar, and S. Pankanti, "A Filterbank-based Representation for 
%   Classification and Matching of Fingerprints", International Joint Conference on 
%   Neural Networks (IJCNN), pp. 3284-3285, Washington DC, July 10-16, 1999. 
%   http://www.cse.msu.edu/~prabhaka/publications.html
%
%   "Fingerprint Classification and Matching Using a Filterbank", Salil Prabhakar
%   A DISSERTATION Submitted to Michigan State University in partial fulfillment 
%   of the requirements for the degree of DOCTOR OF PHILOSOPHY, Computer 
%   Science & Engineering, 2001
%   http://biometrics.cse.msu.edu/SalilThesis.pdf
%
%   Final Report 18-551 (Spring 1999) Fingerprint Recognition Group Number 19
%   Markus Adhiwiyogo, Samuel Chong, Joseph Huang, Weechoon Teo
%   http://www.ece.cmu.edu/~ee551/Old_projects/projects/s99_19/finalreport.html
%
%   Type "fpextractdemo" on MATLAB prompt to start fingerprint processing.
%


%--------------------------------------------------------------------------
if nargin<1,
    action='InitializeFPEXTRACTDEMO';
end;

feval(action,varargin{:})
return;

%%%
%%%  Sub-function - InitializeFPEXTRACTDEMO
%%%

function InitializeFPEXTRACTDEMO()

% If fpextractdemo is already running, bring it to the foreground
h = findobj(allchild(0), 'tag', 'Extracting FingerPrint Features Demo');
if ~isempty(h)
    figure(h(1))
    return
end

screenD = get(0, 'ScreenDepth');
if screenD>8
    grayres=256;
else
    grayres=128;
end


FpextractDemoFig = figure( ...
    'Name','Extracting FingerPrint Features Demo', ...
    'NumberTitle','off', 'HandleVisibility', 'on', ...
    'tag', 'Extracting FingerPrint Features Demo', ...
    'Visible','off', 'Resize', 'off',...
    'BusyAction','Queue','Interruptible','off', ...
    'Color', [.8 .8 .8], ...
    'IntegerHandle', 'off', ...
    'Colormap', gray(grayres));

figpos = get(FpextractDemoFig, 'position');
figpos(3:4) = [1050 525];
% Adjust the size of the figure window
horizDecorations = 10;  % resize controls, etc.
vertDecorations = 45;   % title bar, etc.
screenSize = get(0,'ScreenSize');

dx = screenSize(3) - figpos(1) - figpos(3) - horizDecorations;
dy = screenSize(4) - figpos(2) - figpos(4) - vertDecorations;
if (dx < 0)
    figpos(1) = max(5,figpos(1) + dx);
end
if (dy < 0)
    figpos(2) = max(5,figpos(2) + dy);
end
set(FpextractDemoFig, 'position', figpos);

rows = figpos(4); 
cols = figpos(3);

% Colors
bgcolor = [0.45 0.45 0.45];  % Background color for frames
wdcolor = [.8 .8 .8];  % Window color
fgcolor = [1 1 1];  % For text

hs = (cols-(6*175)) / 5;        % Horizantal Spacing
vs = (rows)/8;                  % Vertical Spacing

%====================================
% Parameters for all buttons and menus

Std.Interruptible = 'off';
Std.BusyAction = 'queue';

% Defaults for image axes
Ax = Std;
Ax.Units = 'Pixels';
Ax.Parent = FpextractDemoFig;
Ax.ydir = 'reverse';
Ax.XLim = [.5 128.5];
Ax.YLim = [.5 128.5];
Ax.CLim = [0 1];
Ax.XTick = [];
Ax.YTick = [];

Img = Std;
Img.CData = [];
Img.Xdata = [1 128];
Img.Ydata = [1 128];
Img.CDataMapping = 'Scaled';
Img.Erasemode = 'none';

Ctl = Std;
Ctl.Units = 'Pixels';
Ctl.Parent = FpextractDemoFig;

Btn = Ctl;
Btn.Style = 'pushbutton';
Btn.Enable = 'off';

Edit = Ctl;
Edit.Style = 'edit';
Edit.HorizontalAlignment = 'right';
Edit.BackgroundColor = 'white';
Edit.ForegroundColor = 'black';

Menu = Ctl;
Menu.Style = 'Popupmenu';

Text = Ctl;
Text.Style = 'text';
Text.HorizontalAlignment = 'left';
Text.BackgroundColor = bgcolor;
Text.ForegroundColor = fgcolor;

%================================
% 0 degree Component 
ud.hComponent1Axes = axes(Ax, ...
    'Position', [0*vs/6 5*vs-vs/6 175 175]);
title('0 degree Component');
ud.hComponent1Image = image(Img, ...
    'Parent', ud.hComponent1Axes);
%================================
% Original FingerPrint 
ud.hOriginalAxes = axes(Ax, ...
    'Position', [cols/2-128 5*vs-vs/6-81 256 256]);
title('Original FingerPrint');
ud.hOriginalImage = image(Img, ...
    'Parent', ud.hOriginalAxes);
ud.OriginalImageIsStale = 1;

%================================
% 157.5 degree Component 
ud.hComponent8Axes = axes(Ax, ...
    'Position', [cols-175 5*vs-vs/6 175 175]);
title('157.5 degree Component');
ud.hComponent8Image = image(Img, ...
    'Parent', ud.hComponent8Axes);
%=================================
% 22.5 degree Component 
ud.hComponent2Axes = axes(Ax, ...
    'Position', [hs vs/2 175 175]);
title('22.5 degree Component');
ud.hComponent2Image = image(Img, ...
    'Parent', ud.hComponent2Axes);
%================================
% 45 degree Component 
ud.hComponent3Axes = axes(Ax, ...
    'Position', [2*hs+1*175 vs/2 175 175]);
title('45 degree Component');
ud.hComponent3Image = image(Img, ...
    'Parent', ud.hComponent3Axes);
%================================
% 67.5 degree Component 
ud.hComponent4Axes = axes(Ax, ...
    'Position', [3*hs+2*175 vs/2 175 175]);
title('67.5 degree Component');
ud.hComponent4Image = image(Img, ...
    'Parent', ud.hComponent4Axes);
%=================================
% 90 degree Component 
ud.hComponent5Axes = axes(Ax, ...
    'Position', [4*hs+3*175 vs/2 175 175]);
title('90 degree Component');
ud.hComponent5Image = image(Img, ...
    'Parent', ud.hComponent5Axes);
%=================================
% 112.5 degree Component 
ud.hComponent6Axes = axes(Ax, ...
    'Position', [5*hs+4*175 vs/2 175 175]);
title('112.5 degree Component');
ud.hComponent6Image = image(Img, ...
    'Parent', ud.hComponent6Axes);
%=================================
% 135 degree Component 
ud.hComponent7Axes = axes(Ax, ...
    'Position', [6*hs+5*175 vs/2 175 175]);
title('135 degree Component');
ud.hComponent7Image = image(Img, ...
    'Parent', ud.hComponent7Axes);
%=================================
%  The frame
ud.hControlFrame = uicontrol(Std, ...
    'Parent', FpextractDemoFig, ...
    'Style', 'Frame', ...
    'Units', 'pixels', ...
    'Position', [vs/6 5*vs-vs/6-81 200 vs+vs/8], ...
    'BackgroundColor', bgcolor);
%====================================
% Image popup menu
ud.hImgPop = uicontrol(Menu, ...
    'Position',[vs/6+vs/8 5*vs-2*vs/3+7 180 vs/16], ...
    'String','Whorl|Twin loop|Left loop|Right loop|Other image', ...
    'Callback','fpextractdemo(''LoadNewImage'')');
% Text label for Image Menu Popup
uicontrol( Text, ...
    'Position',[vs/6+vs/8 5*vs-vs/6-vs/3-2 180 vs/4], ...
    'String','Select a type of fingerprint:');
%====================================
% Extracting Step popup menu
ud.hSelectStepPop = uicontrol(Menu, ...
    'Position',[vs/6+vs/8 4*vs-7 120 vs/16], ...
    'String','Centralize|Crop|Sectorize|Normalize|Gabor filters|Convolute|Features|FingerCode|Check', ...
    'Callback','fpextractdemo(''SelectExtractingStep'')');
% Text label for Extracting Step Menu Popup
uicontrol( Text, ...
    'Position',[vs/6+vs/8 4*vs-4 90 vs/4], ...
    'String','Select step to:');
%====================================
%  Frame for Info and Close
ud.hInfoCloseFrame = uicontrol(Std, ...
    'Parent', FpextractDemoFig, ...
    'Style', 'Frame', ...
    'Units', 'pixels', ...
    'Position', [3*hs+2*175 2 vs/2+2*175 vs/2-4], ...
    'BackgroundColor', bgcolor);

%====================================
% Buttons - Info and Close
ud.hInfo=uicontrol(Btn, ...
    'Position',[3*hs+2*175+vs/2 7 vs/8+135-vs/2 vs/4], ...
    'String','Info', ...
    'Callback','helpwin fpextractdemo');

ud.hClose=uicontrol(Btn, ...
    'Position',[4*hs+3*175+vs/2 7 vs/8+135-vs/2 vs/4], ...
    'String','Close', ...
    'Callback','close(gcbf)');
%====================================
% Status bar
ud.hStatus = uicontrol(Std, ...
    'Parent', FpextractDemoFig, ...
    'Style','text', ...
    'Units','pixels', ...
    'Position',[hs vs/8 2*175-vs/8 vs/4], ...
    'Foreground', [.8 0 0], ...
    'Background',wdcolor, ...
    'Horiz','center', ...
    'Tag', 'Status', ...
    'String','Initializing fpextractdemo...');

set(FpextractDemoFig, 'UserData', ud);
set(FpextractDemoFig, 'visible','on','HandleVisibility','callback');
set([ud.hInfo ud.hClose], 'Enable', 'on');

LoadNewImage(FpextractDemoFig);
SelectExtractingStep(FpextractDemoFig);
return

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%
%%%  Sub-Function - LoadNewImage
%%%

function LoadNewImage(DemoFig)
% Load a new image from a mat-file

if nargin<1
    DemoFig = gcbf;
end

set(DemoFig,'Pointer','watch');
ud=get(DemoFig,'Userdata');
v = get(ud.hImgPop,{'value','String'});
name = deblank(v{2}(v{1},:));
drawnow

⌨️ 快捷键说明

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