pca_in_context.m

来自「matlab aamtool box」· M 代码 · 共 28 行

M
28
字号
function [Xm, P, b, pcaDat] = pca_in_context(AAM, indices, filenames,FractionPCs, meanshape)
if nargin<4
    FractionPCs=0.95;
end
%v = 0.95;
v = FractionPCs;
% if(nargin < 1) error('No data defined for PCA'); end
elements = get(AAM, 'elements');
activeElements = get(AAM, 'activeElements');
indx = 1;
pmt = get(AAM, 'PointModelTemplate');
templatename = get(pmt, 'name');
templatename = templatename(1:length(templatename)-9);
modelDirec=get(AAM,'modelDirec');
for e =1:length(elements)
    name = filenames{e};
    name = name(1:length(name)-4);
    %pts = load(['PointModels', filesep, templatename, filesep,  name, '_aligned']);
    pts = load(fullfile(modelDirec,[name,'_aligned']));
    pts = pts.pts;
    pts = reshape(pts, 2, length(pts)/2);
    ind = setdiff(1:size(pts,2), indices);
    pts(:, ind) = meanshape(:, ind);
    X(:, indx) = pts(:);
    indx = indx+1;
end
[Xm, P, b, pcaDat] = principle_component_analysis(X, v);

⌨️ 快捷键说明

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