【文章內(nèi)容簡(jiǎn)介】
積分圖像分析法 檢測(cè)速度 較快, 滿足實(shí)時(shí)檢測(cè) 的 要求,檢測(cè)效率 相對(duì)較高 錯(cuò)誤報(bào)警數(shù) 與 檢測(cè)率 成反比 支撐向量法 具有更好的泛化能力 “非人臉”的復(fù)雜 造成支持向量數(shù)目 較多, 導(dǎo)致 運(yùn)算復(fù)雜度 變 大 運(yùn)用 matlab 軟件 仿真進(jìn)行人臉檢測(cè)定位實(shí)例: 人臉檢測(cè)定位程序: %%%%% Reading of a RGB image原始圖像 i=imread(39。F:\39。)。 I=rgb2gray(i)。 BW=im2bw(I)。 figure,imshow(BW) %%%%%%%%%%%%%%%%%%%%灰度圖像及均衡化灰度圖像 [n1 n2]=size(BW)。 r=floor(n1/10)。 c=floor(n2/10)。 x1=1。x2=r。 s=r*c。 for i=1:10 y1=1。y2=c。 for j=1:10 if (y2=c | y2=9*c) | (x1==1 | x2==r*10) loc=find(BW(x1:x2, y1:y2)==0)。 佳木斯大學(xué)學(xué)士學(xué)位論文 佳木斯大學(xué)信息電子技術(shù)學(xué)院 15 [o p]=size(loc)。 pr=o*100/s。 if pr=100 BW(x1:x2, y1:y2)=0。 r1=x1。r2=x2。s1=y1。s2=y2。 pr1=0。 end imshow(BW)。 end y1=y1+c。 y2=y2+c。 end x1=x1+r。 x2=x2+r。 end figure,imshow(BW) %%%%%%%%%%%%%%%%%%人臉定位 %%%%%%%%%%%%%%%%%% %%%%% L = bwlabel(BW,8)。 BB = regionprops(L, 39。BoundingBox39。)。 BB1=struct2cell(BB)。 BB2=cell2mat(BB1)。 [s1 s2]=size(BB2)。 mx=0。 for k=3:4:s21 p=BB2(1,k)*BB2(1,k+1)。 if pmx amp。 (BB2(1,k)/BB2(1,k+1)) 佳木斯大學(xué)學(xué)士學(xué)位論文 佳木斯大學(xué)信息電子技術(shù)學(xué)院 16 mx=p。 j=k。 end end figure,imshow(I)。 hold on。 rectangle(39。Position39。,[BB2(1,j2),BB2(1,j1),BB2(1,j),BB2(1,j)],39。EdgeColor39。,39。r39。 ) 佳木斯大學(xué)學(xué)士學(xué)位論文 佳木斯大學(xué)信息電子技術(shù)學(xué)院 17 匹配與識(shí)別 人臉 人別系統(tǒng)的最后一步是人臉識(shí)別。人臉識(shí)別,即通過(guò) 對(duì)所采集到的人臉圖像進(jìn)行一系列處理,提取待識(shí)別人臉圖像的特征信息,通過(guò)與已存人臉數(shù)據(jù)庫(kù)信息進(jìn)行 匹配 識(shí)別,確定待識(shí)別人臉圖像的基本信息。 運(yùn)行如下代碼: function varargout = faceCore(varargin) % FACECORE Mfile for % FACECORE, by itself, creates a new FACECORE or raises the existing % singleton*. % % H = FACECORE returns the handle to a new FACECORE or the handle to % the existing singleton*. % % FACECORE(39。CALLBACK39。,hObject,eventData,handles,...) calls the local % function named CALLBACK in with the given input arguments. % % FACECORE(39。Property39。,39。Value39。,...) creates a new FACECORE or raises the % existing singleton*. Starting from the left, property value pairs are % applied to the GUI before faceCore_OpeningFunction gets called. An % unrecognized property name or invalid value makes property application % stop. All inputs are passed to faceCore_OpeningF via varargin. 佳木斯大學(xué)學(xué)士學(xué)位論文 佳木斯大學(xué)信息電子技術(shù)學(xué)院 18 % % *See GUI Options on GUIDE39。s Tools menu. Choose GUI allows only one % instance to run (singleton). % % See also: GUIDE, GUIDATA, GUIHANDLES % Copyright 20202020 The MathWorks, Inc. % Edit the above text to modify the response to help faceCore % Last Modified by GUIDE 28May2020 10:21:26 % Begin initialization code DO NOT EDIT gui_Singleton = 1。 gui_State = struct(39。gui_Name39。, mfilename, ... 39。gui_Singleton39。, gui_Singleton, ... 39。gui_OpeningF39。, @faceCore_OpeningF, ... 39。gui_OutputF39。, @faceCore_OutputF, ... 39。gui_LayoutF39。, [] , ... 39。gui_Callback39。, [])。 if nargin amp。amp。 ischar(varargin{1}) = str2func(varargin{1})。 end if nargout [varargout{1:nargout}] = gui_mainf(gui_State, varargin{:})。 else gui_mainf(gui_State, varargin{:})。 佳木斯大學(xué)學(xué)士學(xué)位論文 佳木斯大學(xué)信息電子技術(shù)學(xué)院 19 end % End initialization code DO NOT EDIT % Executes just before faceCore is made visible. function faceCore_OpeningF(hObject, eventdata, handles, varargin) % This function has no output args, see OutputF. % hObject handle to figure % eventdata reserved to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % varargin mand line arguments to faceCore (see VARARGIN) % Choose default mand line output for faceCore = hObject。 % Update handles structure guidata(hObject, handles)。 % UIWAIT makes faceCore wait for user response (see UIRESUME) % uiwait()。 % Outputs from this function are returned to the mand line. function varargout = faceCore_OutputF(hObject, eventdata, handles) % varargout cell array for returning output args (see VARARGOUT)。 % hObject handle to figure % eventdata reserved to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) 佳木斯大學(xué)學(xué)士學(xué)位論文 佳木斯大學(xué)信息電子技術(shù)學(xué)院 20 % Get default mand line output from handles structure varargout{1} = 。 % Executes on button press in pushbutton1. function pushbutton1_Callback(hObject, eventdata, handles) % hObject handle to pushbutton1 (see GCBO) % eventdata reserved to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) global TrainDatabasePath 。 TrainDatabasePath = uigetdir(strcat(matlabroot,39。\work39。), 39。訓(xùn)練庫(kù)路徑選擇 ...39。 )。 % Executes on button press in pushbutton2. function pushbutton2_Callback(hObject, eventdata, handles) % hObject handle to pushbutton2 (see GCBO) % eventdata reserved to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) global TestDatabasePath。 TestDatabasePath = uigetdir(strcat(matlabroot,39。\work39。), 39。測(cè)試庫(kù)路徑選擇 ...39。)。 % Executes on button press in pushbutton3. %function pushbutton3_Callback(hObject, eventdata, handles) % hObject handle to pushbutton3 (see GCBO) % eventdata reserved to be defined in a future version of MATLAB