www.pudn.com > snippets(1).rar > extract_pca_descriptors.m, change:2009-10-12,size:646b


function D = extract_pca_descriptors(imname, pca, Globals, ftype)
%
% extract an image descriptor using optic-flow filters and PCA dimensionality reduction

num = length(imname);

for u = 1:num

  % manipulate name and directly read pooled flow from file
  name = imname{u};
  
  if strcmp(ftype,'flow')

    load(name,'flow');

  else

    load(name,'form');
    flow = form;
    clear form;

  end

  [A,B,C] = size(flow);

  fr = size(flow{1,1,1},3);
  step = fr-Globals.concat_frames+1;
  ed = u*step;
  st = ed-step+1;

  % vectorize and project
  G = frame2vec(flow,Globals.concat_frames,'single');
  D(:,st:ed) = project_pca(G, pca);

end