function varargout = FaceRecognitionDemo(varargin)
% FACERECOGNITIONDEMO M-file for FaceRecognitionDemo.fig
% FACERECOGNITIONDEMO, by itself, creates a new FACERECOGNITIONDEMO or raises the existing
% singleton*.
%
% H = FACERECOGNITIONDEMO returns the handle to a new FACERECOGNITIONDEMO or the handle to
% the existing singleton*.
%
% FACERECOGNITIONDEMO('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in FACERECOGNITIONDEMO.M with the given input arguments.
%
% FACERECOGNITIONDEMO('Property','Value',...) creates a new FACERECOGNITIONDEMO or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before FaceRecognitionDemo_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to FaceRecognitionDemo_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help FaceRecognitionDemo
% Last Modified by GUIDE v2.5 17-Apr-2019 23:52:52
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @FaceRecognitionDemo_OpeningFcn, ...
'gui_OutputFcn', @FaceRecognitionDemo_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Executes just before FaceRecognitionDemo is made visible.
function FaceRecognitionDemo_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% 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 command line arguments to FaceRecognitionDemo (see VARARGIN)
% Choose default command line output for FaceRecognitionDemo
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes FaceRecognitionDemo wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = FaceRecognitionDemo_OutputFcn(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)
% Get default command line output from handles structure
varargout{1} = handles.output;
% --- Executes on button press in selectPCA.
function selectPCA_Callback(hObject, eventdata, handles)
% hObject handle to selectPCA (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
set(handles.selectPCA,'value',1);
% Hint: get(hObject,'Value') returns toggle state of selectPCA
% --- Executes on button press in clickBeginSim.
function clickBeginSim_Callback(hObject, eventdata, handles)
% hObject handle to clickBeginSim (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
if get(handles.selectPCA,'value')
gMetholdSelect=1;
end
if get(handles.selectSinglaImageRec,'value')
gOneImgOrRate=1;
end
if get(handles.selectRecogRate,'value')
gOneImgOrRate=2;
end
gTrainNum = str2double(get(handles.inputTrainNum,'string'));
if gTrainNum<=0 || gTrainNum>10
disp('error!');
end
%% face detect
if gOneImgOrRate == 1%检测单幅图片
%
if gMetholdSelect==1%
pic = double(handles.pic);
testImgData=reshape(pic,size(pic,1)*size(pic,2),1);
trainPcaData = handles.trainPcaData;
ImageIndex = recognizeSingleImgPCA(trainPcaData,testImgData);
RealIndex = ceil(ImageIndex/gTrainNum);
end
path = strcat('att_faces\s',num2str(RealIndex));
matchImg=imread(strcat(path,'\',num2str(2),'.pgm'));
axes(handles.axes2);
imshow(matchImg);
title('从人脸库中匹配出的人脸图像');
end
if gOneImgOrRate == 2%计算识别概率
if gMetholdSelect == 1
processPCARecognizeRate(handles);
end
end
% --- Executes on button press in selectRecogRate.
function selectRecogRate_Callback(hObject, eventdata, handles)
% hObject handle to selectRecogRate (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
set(handles.selectSinglaImageRec,'value',0);
set(handles.selectRecogRate,'value',1);
set(handles.inputTrainNum,'Enable','off');
set(handles.buttonTrainSamples,'Enable','off');
set(handles.buttonSelectImg,'Enable','off');
% Hint: get(hObject,'Value') returns toggle state of selectRecogRate
% --- Executes on button press in selectSinglaImageRec.
function selectSinglaImageRec_Callback(hObject, eventdata, handles)
% hObject handle to selectSinglaImageRec (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
set(handles.selectSinglaImageRec,'value',1);
set(handles.selectRecogRate,'value',0);
set(handles.inputTrainNum,'Enable','on');
set(handles.buttonTrainSamples,'Enable','on');
set(handles.buttonSelectImg,'Enable','on');
% Hint: get(hObject,'Value') returns toggle state of selectSinglaImageRec
function inputTrainNum_Callback(hObject, eventdata, handles)
% hObject handle to inputTrainNum (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of inputTrainNum as text
% str2double(get(hObject,'String')) returns contents of inputTrainNum as a double
% --- Executes during object creation, after setting all properties.
function inputTrainNum_CreateFcn(hObject, eventdata, handles)
% hObject handle to inputTrainNum (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on button press in buttonSelectImg.
function buttonSelectImg_Callback(hObject, eventdata, handles)
% hObject handle to buttonSelectImg (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%打开文件对话框
[filename,pathname]=uigetfile({ '*.*','All Files(*.*)';}, '选择文件');
if isequal([filename,pathname],[0,0])
return
else
%读取图片
picPath = fullfile(pathname,filename);
pic = imread(picPath);
handles.pic = pic;
end
axes(handles.axes1);
imshow(handles.pic);
title('待识别的人脸图像');
% Update handles structure
guidata(hObject, handles);
% --- Executes on button press in buttonTrainSamples.
function buttonTrainSamples_Callback(hObject, eventdata, handles)
% hObject handle to buttonTrainSamples (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%%
if get(handles.selectPCA,'value')
gMetholdSelect=1;
end
gTrainNum = str2double(get(handles.inputTrainNum,'string'));
if gTrainNum<=0 || gTrainNum>10
di
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
1、实现效果:见链接:https://soaringlee.blog.csdn.net/article/details/117384009 2、基于PCA和SVM的表情识别系统设计的matlab实现,并采用matlab GUI界面实现。 3、适用于计算机,电子信息工程等专业的大学生毕业设计。 4、支持答疑:有问题可以订阅博主的《实用毕业设计》专栏(附链接 :https://blog.csdn.net/soaringlee_fighting/category_9288245.html)或者直接购买资源后咨询博主。
资源推荐
资源详情
资源评论
收起资源包目录
基于PCA和SVM的表情识别系统设计的matlabGUI界面实现 (406个子文件)
FaceRecognitionDemo.fig 9KB
FaceRecognitionDemo.m 9KB
recognizeRateImgPCA.m 1KB
recognizeSingleImgPCA.m 1KB
getPCATrainTest.m 671B
trainSingleImgPCA.m 447B
5.pgm 10KB
10.pgm 10KB
2.pgm 10KB
1.pgm 10KB
4.pgm 10KB
6.pgm 10KB
3.pgm 10KB
9.pgm 10KB
8.pgm 10KB
7.pgm 10KB
5.pgm 10KB
10.pgm 10KB
2.pgm 10KB
1.pgm 10KB
4.pgm 10KB
6.pgm 10KB
3.pgm 10KB
9.pgm 10KB
8.pgm 10KB
7.pgm 10KB
5.pgm 10KB
10.pgm 10KB
2.pgm 10KB
1.pgm 10KB
4.pgm 10KB
6.pgm 10KB
3.pgm 10KB
9.pgm 10KB
8.pgm 10KB
7.pgm 10KB
5.pgm 10KB
10.pgm 10KB
2.pgm 10KB
1.pgm 10KB
4.pgm 10KB
6.pgm 10KB
3.pgm 10KB
9.pgm 10KB
8.pgm 10KB
7.pgm 10KB
5.pgm 10KB
10.pgm 10KB
2.pgm 10KB
1.pgm 10KB
4.pgm 10KB
6.pgm 10KB
3.pgm 10KB
9.pgm 10KB
8.pgm 10KB
7.pgm 10KB
5.pgm 10KB
10.pgm 10KB
2.pgm 10KB
1.pgm 10KB
4.pgm 10KB
6.pgm 10KB
3.pgm 10KB
9.pgm 10KB
8.pgm 10KB
7.pgm 10KB
5.pgm 10KB
10.pgm 10KB
2.pgm 10KB
1.pgm 10KB
4.pgm 10KB
6.pgm 10KB
3.pgm 10KB
9.pgm 10KB
8.pgm 10KB
7.pgm 10KB
5.pgm 10KB
10.pgm 10KB
2.pgm 10KB
1.pgm 10KB
4.pgm 10KB
6.pgm 10KB
3.pgm 10KB
9.pgm 10KB
8.pgm 10KB
7.pgm 10KB
5.pgm 10KB
10.pgm 10KB
2.pgm 10KB
1.pgm 10KB
4.pgm 10KB
6.pgm 10KB
3.pgm 10KB
9.pgm 10KB
8.pgm 10KB
7.pgm 10KB
5.pgm 10KB
10.pgm 10KB
2.pgm 10KB
1.pgm 10KB
共 406 条
- 1
- 2
- 3
- 4
- 5
资源评论
飞翔的鲲
- 粉丝: 7513
- 资源: 105
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功