资源简介
基于pca实现人脸识别,是经典的人脸识别算法之一,有较好的识别效果

代码片段和文件信息
function [personpic] = pca_faces(TestPerTestPicNumRecFaces)
%此函数用基于PCA的方法实现人脸检测,采用特征脸实现。
%输入:
% TestPerTestPic:希望检测的第TestPer个人的第TestPic个脸应该选择任意人后五幅脸中的一幅作为测试图像
% NumRecFaces:希望得到的最相近的人脸数,小于10,默认为4
%输出:
% Person,Pic:检测到的最相近的几个第Person个人的第Pic个脸
if nargin == 2
NumRecFaces = 4;
end;
load Imgs %load the database
%choose the first five faces for one person as the training faces
TrainImgs = Imgs(:1:5);
for i=2:40
TrainImgs = [TrainImgs Imgs(:1+10*(i-1):5+10*(i-1))];
end
%run PCA to train
[VectorsValuesPsi] = pc_evectors(TrainImgs30); % Get top 30 PC evectors of Imgs
%show the eigenfaces
figure;
subplot(251)
pc_ev = reshape(Vectors(:1)wh)‘; % Get PC eigenvector 1
imagesc(pc_ev); colormap(gray(256)); axis off ;axis image
subplot(252)
pc_ev = reshape(Vectors(:2)wh)‘; % Get PC eigenvector 2
imagesc(pc_ev); colormap(gray(256)); axis off; axis image
subplot(253)
pc_ev = reshape(Vectors(:3)wh)‘; % Get PC eigenvector 3
imagesc(pc_ev); colormap(gray(256)); axis off; axis image
subplot(254)
pc_ev = reshape(Vectors(:4)wh)‘; % Get PC eigenvector 4
imagesc(pc_ev); colormap(gray(256)); axis off; axis image
subplot(255)
pc_ev = reshape(Vectors(:5)wh)‘; % Get PC eigenvector 5
imagesc(pc_ev); colormap(gray(256)); axis off; axis image
subplot(256)
pc_ev = reshape(Vectors(:6)wh)‘; % Get PC eigenvector 6
imagesc(pc_ev); colormap(gray(256)); axis off; axis image
subplot(257)
pc_ev = reshape(Vectors(:7)wh)‘; % Get PC eigenvector 7
imagesc(pc_ev); colormap(gray(256)); axis off; axis image
subplot(258)
pc_ev = reshape(Vectors(:8)wh)‘; % Get PC eigenvector 8
imagesc(pc_ev); colormap(gray(256)); axis off; axis image
subplot(259)
pc_ev = reshape(Vectors(:9)wh)‘; % Get PC eigenvector 9
imagesc(pc_ev); colormap(gray(256)); axis off; axis image
subplot(2510)
pc_ev = reshape(Vectors(:10)wh)‘; % Get PC eigenvector 10
imagesc(pc_ev); colormap(gray(256)); axis off ;axis image
%input a new image to recongnize
%show the test face
TestFace = Imgs(:10*(TestPer-1)+TestPic);
TFace = reshape(TestFacewh)‘;
figure;
imagesc(TFace);
colormap(gray(256));
title(‘Test Face‘);axis off
%select the first 10 eigenvectors to reconstruct
LowDim_TestF = Vectors(:1:10)‘*(TestFace - Psi); % Project onto eigenvectors
%construct a matrix to save the closest recognized faces
RecFaces = zeros(2NumRecFaces);%first row to record the index the second to the distinction
%find the nearest faces in the database(400 face in all)
for i = 1:NumRecFaces
TemptFace = Imgs(:i);
LowDim_TemptF = Vectors(:1:10)‘*(TemptFace - Psi);
Dis = sum(abs(LowDim_TestF-LowDim_TemptF));
RecFaces(2i) = Dis;%distinction
end
[RecFaces(2:)RecFaces(1:)] = sort(RecFaces(2:));
for i = NumRecFaces+1:400
TemptFace = Imgs(:i);
LowDim_TemptF = Vectors(:1:10)‘*(TemptFace - Psi);
Dis = sum(abs
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 3876 2009-06-17 22:34 pca_face recognition\pca_faces.m
文件 2179 2001-02-12 15:32 pca_face recognition\pc_evectors.m
文件 77 2009-06-17 22:34 pca_face recognition\run_result.m
文件 445 2001-02-12 15:32 pca_face recognition\sortem.m
目录 0 2009-06-17 22:43 pca_face recognition
----------- --------- ---------- ----- ----
6577 5
- 上一篇:多径信道matlab代码
- 下一篇:HBMA算法和EMBA算法
相关资源
- matlab人脸识别和特征提取
- 高光谱图像pca分析特征提取
- pca源码matlab
- matlab人脸识别217995
- PCA人脸识别Eigenface特征脸Matlab
- RPCA图像去噪算法
- MATLAB 对iris数据集进行PCA
- 基于KL变换的人脸识别 matlab
- 遥感影像融合_数字图像处理的matlab程
- 基于Matlab行人检测系统
- 基于TE过程的PCA程序matlab
- Face Recognition with KNN in MATLAB(12017108
- 人脸识别yale数据.mat格式
- 基于PCA和SVM的人脸识别.zip
- 基于SVD分解和最近邻算法的高维人脸
- MATLAB人脸识别考勤系统摄像头,记录
- PCA算法实现人脸识别基于matlab GUI界面
- 基于matlab的人脸识别271850
- 2D2DPCA人脸识别matlab代码/ORL库
- PCA人脸识别MATLAB代码/ORL库
- matlab结课大作业人脸识别是否戴口罩
- PCA人脸识别论文附MATLAB程序
- KPCA matlab实现
- 应用matlab计算人脸识别率
- 个人收集的人脸识别经典算法源码
- 基于K-L变换的人脸识别系统
- 基于matlab的人脸识别源代码235297
- 基于PCA使用Yale人脸数据库的人脸识别
- 降维技术matlab工具箱
- 人脸识别系统
评论
共有 条评论