function varargout = untitled(varargin)
% UNTITLED MATLAB code for untitled.fig
% UNTITLED, by itself, creates a new UNTITLED or raises the existing
% singleton*.
%
% H = UNTITLED returns the handle to a new UNTITLED or the handle to
% the existing singleton*.
%
% UNTITLED('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in UNTITLED.M with the given input arguments.
%
% UNTITLED('Property','Value',...) creates a new UNTITLED or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before untitled_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to untitled_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 untitled
% Last Modified by GUIDE v2.5 10-Jul-2017 20:49:19
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @untitled_OpeningFcn, ...
'gui_OutputFcn', @untitled_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 untitled is made visible.
function untitled_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 untitled (see VARARGIN)
% Choose default command line output for untitled
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes untitled wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = untitled_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 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)
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)
%1.“测试图片”按钮
%% 读取待查找图片
global im;%由于要在两个按钮函数中使用,故使用全局变量
[filename, pathname]=...
uigetfile({'*.pgm'},'选择图片');
str = [pathname, filename];%合成路径+文件名
im = imread(str);%读取图片
axes( handles.axes1);%使用第一个axes
imshow(im);title('待查找')%显示图片
% --- 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)
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)
%2.“匹配照片”按钮
%% PCA人脸识别
global im;
xunlian=[];%训练图像矩阵
%%%%%%%%%%%%%%提取图片
for i=1:40
for j=1:10
a=imread(strcat('人脸识别课设\Data\ORL\s',num2str(i),'\',num2str(j),'.pgm'));
b=a(1:112*92); % b是行矢量1×N,其中N=10304
b=double(b);
xunlian=[xunlian; b]; % xunlian是一个M * N矩阵,每一行数据一张图片,M=200
end;
end;
xunlian=xunlian'; %每一列为一张图片
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%’
X=zeros(10304,40);%初始化变量X,训练样本中元素由每个人的平均图像向量组成
for i=1:40
Yangben=xunlian(:,10*(i-1)+1: 10*(i-1)+5);%把样本集xunlian中的每个人的前五张图片组成训练集
X(:,i)=mean(Yangben,2);%求得每个人的平均图像向量
end
meanvetor=mean(X,2);%求得总体的平均图像向量
for i=1:40
X(:,i)=X(:,i)-meanvetor;%求得训练集,由每个人平均图像向量减去总体平均图像向量得到
end
pmetrix=X'*X; %求X’*X,应用的原理是奇异值分解的推论
[vet vetvalue]=eig(pmetrix);%求特征值和特征向量
vet=fliplr(vet);
vetvalue=fliplr(vetvalue);%对特征值由大到小排列,相应的特征向量也进行变换
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%55
Cvetvalue=sum(vetvalue);
Ctotal=sum(Cvetvalue,2);
for i=1:40
parttotal=sum(Cvetvalue(1:i),2);
ratio=parttotal/Ctotal;
if ratio>0.99
break;
end
end
%选择最大的前n个特征值,由这些值的和在总特征值中占得比例大于99%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
U=X*vet;
U=orth(U);%应用奇异值分解的推论得到正交化的特征脸
A= U(:,1:i)';%选择前n个特征值对应的特征向量组成特征脸
y= A*X;%求训练集中各图像在特征脸空间中的坐标
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
a=im;
b=a(1:10304);
b=double(b);
b=b';
ceshi=b -meanvetor;%待识别图像减去总体平均图像向量
zbceshi=A*ceshi;%求得其在特征脸空间的坐标
for k=1:40
wucha=zbceshi-y(:,k);
wuchametrix(:,k)=wucha'*wucha;
end %计算该坐标与训练集中各图像坐标之间的距离
[h,I]=min(wuchametrix); %最近邻法进行人脸识别
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
path = strcat('人脸识别课设\Data\ORL\s',num2str(I));
matchImg=imread(strcat(path,'\',num2str(1),'.pgm'));%识别为某个人后,输出此人的第一张图
axes(handles.axes2);
imshow(matchImg);
title('从人脸库中匹配出的人脸图像');
没有合适的资源?快使用搜索试试~ 我知道了~
新建文件夹.rar_face recognition_人脸 签到_人脸签到_人脸识别系统_签到系统
共401个文件
png:399个
fig:1个
m:1个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 135 浏览量
2022-07-14
23:52:52
上传
评论
收藏 8.66MB RAR 举报
温馨提示
人脸识别的签到系统的设计,人脸图库以及程序
资源详情
资源评论
资源推荐
收起资源包目录
新建文件夹.rar_face recognition_人脸 签到_人脸签到_人脸识别系统_签到系统 (401个子文件)
untitled.fig 6KB
untitled (1).m 6KB
1.png 686KB
9.png 683KB
2.png 668KB
10.png 647KB
3.png 646KB
8.png 640KB
7.png 628KB
6.png 605KB
5.png 547KB
4.png 520KB
10.png 8KB
4.png 8KB
6.png 7KB
5.png 7KB
2.png 7KB
2.png 7KB
5.png 7KB
4.png 7KB
7.png 7KB
9.png 7KB
8.png 7KB
3.png 7KB
5.png 7KB
2.png 7KB
10.png 7KB
6.png 7KB
1.png 7KB
4.png 7KB
7.png 7KB
6.png 7KB
8.png 7KB
4.png 7KB
5.png 7KB
1.png 7KB
8.png 7KB
9.png 7KB
10.png 7KB
2.png 7KB
6.png 7KB
2.png 7KB
1.png 7KB
2.png 7KB
3.png 7KB
7.png 7KB
3.png 7KB
1.png 7KB
5.png 7KB
5.png 7KB
3.png 7KB
2.png 7KB
8.png 7KB
5.png 7KB
10.png 7KB
4.png 7KB
3.png 7KB
10.png 7KB
6.png 7KB
7.png 7KB
1.png 7KB
4.png 7KB
7.png 7KB
5.png 7KB
9.png 7KB
1.png 7KB
9.png 7KB
4.png 7KB
5.png 7KB
9.png 7KB
10.png 7KB
1.png 7KB
8.png 7KB
2.png 7KB
9.png 7KB
3.png 7KB
4.png 7KB
4.png 7KB
7.png 7KB
4.png 7KB
6.png 7KB
10.png 7KB
5.png 7KB
5.png 7KB
3.png 7KB
5.png 7KB
2.png 7KB
8.png 7KB
7.png 7KB
3.png 7KB
10.png 7KB
7.png 7KB
6.png 7KB
10.png 7KB
9.png 7KB
9.png 7KB
8.png 7KB
3.png 7KB
9.png 7KB
10.png 7KB
共 401 条
- 1
- 2
- 3
- 4
- 5
小波思基
- 粉丝: 70
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0