根據(jù)matlab的人臉識(shí)別源代碼_第1頁
根據(jù)matlab的人臉識(shí)別源代碼_第2頁
根據(jù)matlab的人臉識(shí)別源代碼_第3頁
根據(jù)matlab的人臉識(shí)別源代碼_第4頁
根據(jù)matlab的人臉識(shí)別源代碼_第5頁
已閱讀5頁,還剩11頁未讀 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡介

1、function varargout = FR_Processed_histogram(varargin)%這種算法是基于直方圖處理的方法%The histogram of image is calculated and then bin formation is done on the%basis of mean of successive graylevels frequencies. The training is done on odd images of 40 subjects (200 images out of 400 images)%The results of the imp

2、lemented algorithm is 99.75 (recognition fails on image number 4 of subject 17)mfilename, .gui_Singleton = 1;gui_State = struct('gui_Name','gui_Singleton', gui_Singleton, .'gui_OpeningFcn',FR_Processed_histogram_OpeningFcn.,.'gui_OutputFcn',FR_Processed_histogram_Outp

3、utFcn.,.'gui_LayoutFcn', , .'gui_Callback', );if nargin && ischar(varargin1)gui_State.gui_Callback = str2func(varargin1);endif n argoutvarargout1: nargout = gui_mai nfcn( gui_State, varargi n:);elsegui_mai nfcn( gui_State, vararg in :);end% End in itializati on code - DO NOT

4、EDIT% - Executes just before FR_P rocessed_histogram is made visible.function FR_Processed_histogram_OpeningFcn(hObjecteventdata, han dles, vararg in)% This fun cti on has no out put args, see Outpu tFc n.% hObjecthan dle to figure% eventdatareserved - to be defined in a future version ofMATLAB% han

5、 dlesstructure with han dles and user data (see GUIDATA)% vararg incomma nd line argume nts to FR_P rocessed_histogram(see VARARGIN)% Choose default comma nd lineout putforFR_P rocessed_histogramhan dles.out put = hObject;% Up date han dies structureguidata(hObject, han dies);% UIWAIT makes FR_P roc

6、essed_histogram wait for user response (see UIRESUME)% uiwait(ha ndles.figure1);global totai_sub train_img sub_img max_hist_level bin_num form_bin _num;totai_sub = 40;train _img = 200;sub_img = 10;max_hist_ievei = 256;bin_num = 9;form_b in_num = 29;% - Out puts from this fun cti on are returned to t

7、he comma nd line.function varargout = FR_Processed_histogram_OutputFcn(hObject, eve ntdata, han dles)% varargout cell array for retu rning out put args (seeVARARGOUT);% hObjecthan die to figure% eve ntdatareserved - to be defined in a future version ofMATLAB% han dlesstructure with han dles and user

8、 data (see GUIDATA)% Get default comma nd line out put from han dles structurevarargout1 = han dles.out put;% - Executes on butt on p ress in train_butt on.fun cti on train_butt on_ Callback(hObject, eve ntdata, han dles)% hObjecthan dle to train_butt on (see GCBO)% eventdatareserved - to be defined

9、 in a future version ofMATLAB% han dlesstructure with han dles and user data (see GUIDATA)global tra in_p rocessed_b in;global total_sub train_img sub_img max_hist_level bin_numform_bin _num;train_ processed_bi n( form_bin_ nu m,train_img) = 0;K = 1;train_hist_img = zeros(max_hist_level, train_img);

10、for Z=1:1:total subfor X=1:2:sub_img %train on odd number of images ofeach subjectI = imread( strcat('ORLS',int2str(Z),'',int2str(X), '.bmp');rows cols = size(I);for i=1:1:rowsfor j=1:1:colsif( I(i,j) = 0 )K)train_hist_img(max_hist_level,train_hist_img(max_hist_level, K) + 1;

11、elsetrain_hist_img(I(i,j), K) = train_hist_img(I(i,j), K)+ 1;endendendK = K + 1;endendr c = size(train_hist_img);sum = 0;for i=1:1:cK = 1;for j=1:1:rif( (mod(j,b in_nu m) = 0 )sum = sum + train_hist_img(j,i);train _p rocessed_bi n( K,i) = sum/b in_num;K = K + 1;sum = 0;elsesum = sum + train_hist_img

12、(j,i);endend train _p rocessed_bi n( K,i) = sum/b in_num;enddis play ('Tra ining Don e')save 'trai n' train _p rocessed_bin% - Executes on butt on p ress in Test in g_butt on.fun cti on Testi ng_butt on _Callback(hObject, eve ntdata, han dies)% hObjecthan dle to Test in g_butt on (se

13、e GCBO)% eve ntdatareserved - to be defined in a future version ofMATLAB% han diesstructure with han dies and user data (see GUIDATA)global train_img max_hist_level bin_num form_bin_ num;global tra in_p rocessed_b in;global file name p ath name Iload 'trai n'test_hist_img(max_hist_level) = 0

14、;test_ processedin( form_b in_num)二 0;rows cols = size(I);for i=1:1:rowsfor j=1:1:colsif( I(i,j) = 0 )test_hist_img(max_hist_level)test_hist_img(max_hist_level) + 1;elsetest_hist_img(l(i,j) = test_hist_img(l(i,j) + 1;endendendr c = size(test_hist_img);sum = 0;K = 1;for j=1:1:cif( (mod(j,b in_nu m) =

15、 0 )sum = sum + test_hist_img(j);test_ processed_bi n(K) = sum/b in_num;K = K + 1;sum = 0;elsesum = sum + test_hist_img(j);endendtest_ processed_bi n(K) = sum/b in_num;sum = 0;K = 1;for y=1:1:train_imgfor z=1:1:form bin numsumsum + abs( test_ processedin(z)train_p rocessed_b in( z,y);end img_bin_his

16、t_sum(K,1) = sum;sum = 0;K = K + 1;endte mp M二 mi n(img_bin_hist_sum);M = ceil(M/5);getStri ng_start=strfi nd( path name'S');getStri ng_start=getStri ng_start(e nd)+1;getStri ng_en d=strfi nd(p ath name;');getStri ng_en d=getStri ng_en d(e nd)-1;subjecti ndex二str2 num(p ath name(getStri

17、ng_start:getStri ng_en d);if (subject in dex = M)axes (ha ndles.axes3) %image no: 5 is show n for visualizati on purp ose imshow(imread(STRCAT('ORLS', nu m2str(M),'5.bm p') msgbox ( 'Correctly Recog ni zed);elsedis play ( 'Error=>Testi ng Image of Subject >>num2str(s

18、ubjectindex) ' matches with the image of subject >>num2str(M)axes (ha ndles.axes3) %image no: 5 is show n for visualizati on purp ose imshow(imread(STRCAT( 'ORLS', num2str(M),'5.bm p') msgbox ( ' In correctly Recog ni zed');enddis play('Test ing Done) fun cti on

19、 box_Callback(hObject, eve ntdata, han dles)% hObjecthan dle to box (see GCBO) % eventdata reserved - to be defined in a future version ofMATLAB% han dlesstructure with han dles and user data (see GUIDATA)% Hin ts: get(hObject,'Stri ng') returns contents of box as textstr2double(get(hObject,

20、'Stri ng') returns contents of boxas a double% - Executes duri ng object creati on, after sett ing all prop erties.fun cti on box_CreateFc n( hObject, eve ntdata, han dles) get(0,'defaultUico ntrolBackgrou ndColor')% hObjecthandle to box (see GCBO)% eventdatareserved - to be defined

21、in a future version ofMATLAB% han dlesempty - han dles not created un til after all CreateFc nscalled% Hi nt: edit con trols usually have a white backgro und on Win dows.See ISPC and COMP UTER.ifispc &&isequal(get(hObject:Backgro un dColor'),set(hObject,'Backgrou ndColor','white');end% - Executes on butt on p ress in Inpu t_lmage_butt on.fun cti on Inpu t_lmage_butt on _Callback(hObject, eve ntdata, han dies)% hObjecthan dle to Inpu t_lma

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論