📄 gha_getcoeffs.m
字号:
function coeffs=gha_getcoeffs(Orig,W,plot_flg)% function coeffs=gha_getcoeffs(Orig,W,plot_flg)%% Orig - original image% W - weights% % if plot_flg is present (any value), plots of the original image,% the masks and the recomposed image with the first three components% is performed%% Hugh Pasika 1997P = gha_chopstak(Orig,8,8);mval = max(max(P));P = P/mval;r = 32; c = 32; xdir = 8; ydir = 8;I = zeros(r*xdir,c*ydir);[rP cP] = size(P); [rW, cW] = size(W);coeffs = zeros(rP,cW); % first get the coeffsfor i=1:rP; in=P(i,:)'; X=in(:,ones(1,cW)); coeffs(i,:)=sum(X.*W); end PCAed=gha_recompose(coeffs,W,1);if nargin == 3, set(gcf,'Position',[18 245 592 556]) subplot(2,2,1); pim(Orig); title('Original Image') subplot(2,2,2); gha_dispwe(W,200); title('Weights') subplot(2,2,3); pim(PCAed*256); title('Using First 8 Components') colormap(gray)end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -