gha_getcoeffs.m

来自「Simon Haykin的 《Neural NetWorks》例子原码」· M 代码 · 共 35 行

M
35
字号
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 + =
减小字号Ctrl + -
显示快捷键?