getshapestatistics.m

来自「active shape model的matlab代码实现」· M 代码 · 共 24 行

M
24
字号
function [MeanShape,tEigenvectors,tEigenValues]=GetShapeStatistics(Xa,ExplainPercent);%function [MeanShape,tEigenvectors,tEigenValues]=GetShapeStatistics(Xa,ExplainPercent);MeanShape=(sum(Xa'))'/size(Xa,2);%DX=Xa-MeanShape*ones(1,size(Xa,2));%CovMatrix=zeros(size(Xa,1),size(Xa,1));%for ind1=1:size(Xa,2),%   CovMatrix=CovMatrix+DX(:,ind1)*DX(:,ind1)';%end%CovMatrix=CovMatrix/size(Xa,2);%using the function cov (see help cov)CovMatrix=cov(Xa');  %Xa'--> row_i=observations_i col_j=variables_j (variable is the x value)[V,D]=eig(CovMatrix);[PC, LATENT, EXPLAINED] = pcacov(CovMatrix);higher=find(cumsum(EXPLAINED)>=ExplainPercent*100);tEigenvectors=PC(:,1:higher(1));tEigenValues=LATENT(1:higher(1));

⌨️ 快捷键说明

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