⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 computeferetfacepca.m

📁 It is for Face Recognition
💻 M
字号:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% function computeFeretFacePCA()
%   z.li, 03-10-2004
%   support vector machine
% function dependency:
%   - getFeretFaceIcons()
% input:
%   side - side margin
%   top, low - top and bottom margin
%   fw, fh - face icon size
% output:
%   T, lat, mf,faceIcons.dat
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%function [T, lat, mf, faceIcons]=computeFeretFacePCA(side, top, low, fw, fh)
function [T, lat, mf, faceIcons]=computeFeretFacePCA(side, top, low, fw, fh)
dbg = 'n';
if dbg == 'y'
  side = 0.5; top= 1.0; low = 1.5; fw=16; fh=20; 
  %side = 0.4; top= 0.6; low = 0.6; fw=15; fh=20;   
end

% const
doHistEq    = 'n';
dimPCA      = 24;
minLuma     = 20;
maxLuma     = 180;

truth = load('feretGndTruth.dat');
[n w]=size(truth);
m=0; cnt=0; faceIcons=[];
% collect samples
for k=1:n   
   if k == 2438     % bad annotation
     icon == -1;
   else
     [icon]=getFeretFaceIcon(truth, doHistEq, k, side, top, low, fw, fh);     
     mLuma = mean(icon);
   end
   if icon ~= -1 & mLuma > minLuma & mLuma < maxLuma
      m=m+1; fprintf('.');
      faceIcons(m,1:fw*fh)=icon;   
      faceLuma(m) = mLuma;     
   else
      fprintf('x');
   end
   cnt = cnt + 1;
   if  cnt >= 100
     cnt =0; fprintf('\n');
   end
end

fprintf('\n luma min max = %d %d valid sample num = %d ', minLuma, maxLuma, m);

% do pca
x = double(faceIcons');
[T, lat, mf]=pcaAnalysis(x, dimPCA);


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -