read_in_pointmodels.asv

来自「matlab aamtool box」· ASV 代码 · 共 35 行

ASV
35
字号
function aam=read_in_pointmodels(aam,cwd)
ind=findstr(aam.modelDirec(19:end),'\')+17;
dirname=[pwd,'\PointModels\',aam.modelDirec(19:ind(1))];
d=dir([dirname,'\','*_pm*']);
%now go through the list of files that we need, taking them from the dir
dnames={d.name};
pmt=get(aam, 'PointModelTemplate');
completed=[];
for i=1:length(aam.am_imagenames)
    imagename=aam.am_imagenames{i};
    filename=imagename(1:regexpi(imagename,'.jpg')-1);
    n=regexpi(dnames,filename);
    if any(~isempty(n)) % non-empty disc file matches image filename
        for k=1:length(n)
            if ~isempty(n{k})
                temp=load([dirname,'\',dnames{k}]);
                [r,c]=size(temp.pts');
                pts=reshape(temp.pts,2,round(c/2));
                els{i}=AAM_Element;% aam.elements{i};
                loops=get(pmt,'loops');
                els{i}=set(els{i},'loops',loops{1});
                els{i}=set(els{i},'closedloops',get(pmt,'closedloops'));
                els{i}=set(els{i},'imagefilename',imagename);
                els{i}=set(els{i},'alignedPts',pts);
                els{i}=set(els{i},'pts',pts);
                completed=[completed,i];
            end
        end
    else
        uiwait(warndlg(sprintf('Attempting to create a model from a non-existent pointmodel %s',filename)));
    end
end
aam=set(aam,'elements',els);
aam=set(aam,'completeElements',completed);

⌨️ 快捷键说明

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