资源描述:
《基于PCA的人脸识别.doc》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、本文基于PCA算法,实现人脸识别。首先,我们来看一下测试结果:由于本文只是简单地对训练人脸进行降维处理,并没有考虑其他影响因素,所以识别率相对来说比较低。下面给出具体代码:functionvarargout=FaceRec(varargin)%FACERECM-fileforFaceRec.fig%FACEREC,byitself,createsanewFACERECorraisestheexisting%singleton*.%%H=FACERECreturnsthehandletoanewFACERECorthehandleto%theexistingsingleto
2、n*.%%FACEREC('CALLBACK',hObject,eventData,handles,...)callsthelocal%functionnamedCALLBACKinFACEREC.Mwiththegiveninputarguments.%%FACEREC('Property','Value',...)createsanewFACERECorraisesthe%existingsingleton*.Startingfromtheleft,propertyvaluepairsare%appliedtotheGUIbeforeFaceRec_OpeningFc
3、ngetscalled.An%unrecognizedpropertynameorinvalidvaluemakespropertyapplication%stop.AllinputsarepassedtoFaceRec_OpeningFcnviavarargin.%%*SeeGUIOptionsonGUIDE'sToolsmenu.Choose"GUIallowsonlyone%instancetorun(singleton)".%%Seealso:GUIDE,GUIDATA,GUIHANDLES%Edittheabovetexttomodifytheresponset
4、ohelpFaceRec%LastModifiedbyGUIDEv2.529-Nov-201319:23:02%Begininitializationcode-DONOTEDITgui_Singleton=1;gui_State=struct('gui_Name',mfilename,...'gui_Singleton',gui_Singleton,...'gui_OpeningFcn',@FaceRec_OpeningFcn,...'gui_OutputFcn',@FaceRec_OutputFcn,...'gui_LayoutFcn',[],...'gui_Callb
5、ack',[]);ifnargin&&ischar(varargin{1})gui_State.gui_Callback=str2func(varargin{1});endifnargout[varargout{1:nargout}]=gui_mainfcn(gui_State,varargin{:});elsegui_mainfcn(gui_State,varargin{:});end%Endinitializationcode-DONOTEDIT%---ExecutesjustbeforeFaceRecismadevisible.functionFaceRec_Ope
6、ningFcn(hObject,eventdata,handles,varargin)%Thisfunctionhasnooutputargs,seeOutputFcn.%hObjecthandletofigure%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)%varargincommandlineargumentstoFaceRec(seeVARARGIN)set(handles.axes1,'xtick',
7、[],'ytick',[])set(handles.axes2,'xtick',[],'ytick',[])%ChoosedefaultcommandlineoutputforFaceRechandles.output=hObject;%Updatehandlesstructureguidata(hObject,handles);%UIWAITmakesFaceRecwaitforuserresponse(seeUIRESUME)%uiwait(handles.figure1);%---Outputsfromthisfunct