基于matlab的人脸识别源代码Word格式文档下载.docx

上传人:b****6 文档编号:21520723 上传时间:2023-01-30 格式:DOCX 页数:8 大小:16.22KB
下载 相关 举报
基于matlab的人脸识别源代码Word格式文档下载.docx_第1页
第1页 / 共8页
基于matlab的人脸识别源代码Word格式文档下载.docx_第2页
第2页 / 共8页
基于matlab的人脸识别源代码Word格式文档下载.docx_第3页
第3页 / 共8页
基于matlab的人脸识别源代码Word格式文档下载.docx_第4页
第4页 / 共8页
基于matlab的人脸识别源代码Word格式文档下载.docx_第5页
第5页 / 共8页
点击查看更多>>
下载资源
资源描述

基于matlab的人脸识别源代码Word格式文档下载.docx

《基于matlab的人脸识别源代码Word格式文档下载.docx》由会员分享,可在线阅读,更多相关《基于matlab的人脸识别源代码Word格式文档下载.docx(8页珍藏版)》请在冰豆网上搜索。

基于matlab的人脸识别源代码Word格式文档下载.docx

,[],...

'

gui_Callback'

[]);

ifnargin&

&

ischar(varargin{1})

gui_State.gui_Callback=str2func(varargin{1});

end

ifnargout

[varargout{1:

nargout}]=gui_mainfcn(gui_State,varargin{:

});

else

gui_mainfcn(gui_State,varargin{:

%Endinitializationcode-DONOTEDIT

%--------------------------------------------------------------------------

%---ExecutesjustbeforeFR_Processed_histogramismadevisible.

functionFR_Processed_histogram_OpeningFcn(hObject,eventdata,handles,varargin)

%Thisfunctionhasnooutputargs,seeOutputFcn.

%hObjecthandletofigure

%eventdatareserved-tobedefinedinafutureversionofMATLAB

%handlesstructurewithhandlesanduserdata(seeGUIDATA)

%varargincommandlineargumentstoFR_Processed_histogram(seeVARARGIN)

%ChoosedefaultcommandlineoutputforFR_Processed_histogram

handles.output=hObject;

%Updatehandlesstructure

guidata(hObject,handles);

%UIWAITmakesFR_Processed_histogramwaitforuserresponse(seeUIRESUME)

%uiwait(handles.figure1);

globaltotal_subtrain_imgsub_imgmax_hist_levelbin_numform_bin_num;

total_sub=40;

train_img=200;

sub_img=10;

max_hist_level=256;

bin_num=9;

form_bin_num=29;

%---Outputsfromthisfunctionarereturnedtothecommandline.

functionvarargout=FR_Processed_histogram_OutputFcn(hObject,eventdata,handles)

%varargoutcellarrayforreturningoutputargs(seeVARARGOUT);

%Getdefaultcommandlineoutputfromhandlesstructure

varargout{1}=handles.output;

%---Executesonbuttonpressintrain_button.

functiontrain_button_Callback(hObject,eventdata,handles)

%hObjecthandletotrain_button(seeGCBO)

globaltrain_processed_bin;

train_processed_bin(form_bin_num,train_img)=0;

K=1;

train_hist_img=zeros(max_hist_level,train_img);

forZ=1:

1:

total_sub

forX=1:

2:

sub_img%%%trainonoddnumberofimagesofeachsubject

I=imread(strcat('

ORL\S'

int2str(Z),'

\'

int2str(X),'

.bmp'

));

[rowscols]=size(I);

fori=1:

rows

forj=1:

cols

if(I(i,j)==0)

train_hist_img(max_hist_level,K)=train_hist_img(max_hist_level,K)+1;

else

train_hist_img(I(i,j),K)=train_hist_img(I(i,j),K)+1;

end

end

K=K+1;

[rc]=size(train_hist_img);

sum=0;

fori=1:

c

K=1;

r

if((mod(j,bin_num))==0)

sum=sum+train_hist_img(j,i);

train_processed_bin(K,i)=sum/bin_num;

sum=0;

display('

TrainingDone'

save'

train'

train_processed_bin;

%---ExecutesonbuttonpressinTesting_button.

functionTesting_button_Callback(hObject,eventdata,handles)

%hObjecthandletoTesting_button(seeGCBO)

globaltrain_imgmax_hist_levelbin_numform_bin_num;

globalfilenamepathnameI

load'

test_hist_img(max_hist_level)=0;

test_processed_bin(form_bin_num)=0;

test_hist_img(max_hist_level)=test_hist_img(max_hist_level)+1;

test_hist_img(I(i,j))=test_hist_img(I(i,j))+1;

[rc]=size(test_hist_img);

c

sum=sum+test_hist_img(j);

test_processed_bin(K)=sum/bin_num;

fory=1:

train_img

forz=1:

form_bin_num

sum=sum+abs(test_processed_bin(z)-train_processed_bin(z,y));

img_bin_hist_sum(K,1)=sum;

[tempM]=min(img_bin_hist_sum);

M=ceil(M/5);

getString_start=strfind(pathname,'

S'

);

getString_start=getString_start(end)+1;

getString_end=strfind(pathname,'

getString_end=getString_end(end)-1;

subjectindex=str2num(pathname(getString_start:

getString_end));

if(subjectindex==M)

axes(handles.axes3)

%imageno:

5isshownforvisualizationpurpose

imshow(imread(STRCAT('

num2str(M),'

\5.bmp'

)))

msgbox('

CorrectlyRecognized'

display(['

Error==>

TestingImageofSubject>

>

'

num2str(subjectindex)'

matcheswiththeimageofsubject>

num2str(M)])

IncorrectlyRecognized'

display('

TestingDone'

functionbox_Callback(hObject,eventdata,handles)

%hObjecthandletobox(seeGCBO)

%Hints:

get(hObject,'

String'

)returnscontentsofboxastext

%str2double(get(hObject,'

))returnscontentsofboxasadouble

%---Executesduringobjectcreation,aftersettingallproperties.

functionbox_CreateFcn(hObject,eventdata,handles)

%handlesempty-handlesnotcreateduntilafterallCreateFcnscalled

%Hint:

editcontrolsusuallyhaveawhitebackgroundonWindows.

%SeeISPCandCOMPUTER.

ifispc&

isequal(get(hObject,'

BackgroundColor'

),get(0,'

defaultUicontrolBackgroundColor'

))

set(hObject,'

'

white'

%---ExecutesonbuttonpressinInput_Image_button.

functionInput_Image_button_Callback(hObject,eventdata,handles)

%hObjecthandletoInput_Image_button(seeGCBO)

[filename,pathname]=uigetfile('

*.bmp'

'

TestImage'

axes(handles.axes1)

imgpath=STRCAT(pathname,filename);

I=imread(imgpath);

imshow(I)

functionaxes3_CreateFcn(hObject,eventdata,handles)

%hObjecthandletoaxes3(seeGCBO)

placecodeinOpeningFcntopopulateaxes3

%ProgrammedbyUsmanQayyum

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 解决方案 > 学习计划

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1