?? twodrecons.m
字號:
%--------------------------------------------------------------
%
%
%--------------------------------------------------------------
%------------ function name ----------------
%Description : 基于2DPCA的人臉重建
%Author : gongzzzz
%time : 07-5-23
%Input :
%
%Output :
%參考文獻: Yang Jian,Zhang David,F.Frangi Alejandro,Yang Jingyu.
% Two-dimensional PCA:A new approach to appearance-based
% face representation and recognition.IEEE Trans.on Pattern %
% Analysis and Machine Intelligence,26(2004)1,131-137.
%
%function [] = TwoDRecons()
%%%%%%%%根據測試需要修改的參數%%%%%%%
% load F:\BJ3D\gray\model.mat;
load e:\ORL\model2D.mat;
imgPath = 'D:\test\s40_10';
a=imread([imgPath '.jpg']);
imgHei = 112;
imgWid = 92;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
b=double(a);
b=b-Avg;
% 計算新圖片在特征子空間中的系數
c = b * vsort; % c 是圖片a在子空間中的系數, 是1*p行矢量
imwrite(mat2gray(Avg),'D:\test\avg.bmp');
% 根據特征系數及特征臉重建圖
% 前1個
t = 1;
temp = c(:,1:t) * vsort(:,1:t)';
temp = temp + Avg;
imwrite(mat2gray(temp),[imgPath '_p21.bmp']);
% 前10個
t = 10;
temp = c(:,1:t) * vsort(:,1:t)';
temp = temp + Avg;
imwrite(mat2gray(temp),[imgPath '_p22.bmp']);
% 前20個
t = 20;
temp = c(:,1:t) * vsort(:,1:t)';
temp = temp + Avg;
imwrite(mat2gray(temp),[imgPath '_p23.bmp']);
% 前92個
t = 92;
temp = c(:,1:t) * vsort(:,1:t)';
temp = temp + Avg;
imwrite(mat2gray(temp),[imgPath '_p24.bmp']);
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -