91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 3KB
    文件類型: .rar
    金幣: 2
    下載: 0 次
    發(fā)布日期: 2021-05-27
  • 語(yǔ)言: Matlab
  • 標(biāo)簽: pca??人臉識(shí)別??

資源簡(jiǎn)介

基于pca實(shí)現(xiàn)人臉識(shí)別,是經(jīng)典的人臉識(shí)別算法之一,有較好的識(shí)別效果

資源截圖

代碼片段和文件信息

function?[personpic]?=?pca_faces(TestPerTestPicNumRecFaces)
%此函數(shù)用基于PCA的方法實(shí)現(xiàn)人臉檢測(cè),采用特征臉實(shí)現(xiàn)。

%輸入:
%???TestPerTestPic:希望檢測(cè)的第TestPer個(gè)人的第TestPic個(gè)臉應(yīng)該選擇任意人后五幅臉中的一幅作為測(cè)試圖像
%???NumRecFaces:希望得到的最相近的人臉數(shù),小于10,默認(rèn)為4
%輸出:
%???Person,Pic:檢測(cè)到的最相近的幾個(gè)第Person個(gè)人的第Pic個(gè)臉


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

?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----

?????文件???????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


評(píng)論

共有 條評(píng)論