📄 imgpca2.m
字号:
function model = imgpca2(mwa,scaling,nocomp)
%IMGPCA Principal Components Analysis of Multivariate Images.
% IMGPCA uses principal components analysis to make
% psuedocolor maps of multivariate images. The input is the
% multivariate image (mwa). Optional inputs are (scaling) the
% scaling to be used, and the number of PCs to calculate (nocomp).
% scaling = 'auto' uses autoscaling {default},
% scaling = 'mncn' uses mean centering, and
% scaling = 'none' uses no scaling.
%
% It is assumed that the image (mwa) is a 3 dimensional (m x n x p)
% array where each image is m x n pixels and there are p images.
% IMGPCA presents each scores, residual, and T^2 matrix as a
% psuedocolor image. If 3 are more PCs are selected (nocomp>=3),
% a composite of the first three PCs is shown as an rgb image,
% with red for the first PC, green for the second, and blue for the
% the third.
%
% The output (model) is a structure with the following fields:
%
% xname: input data name
% name: type of model, always 'IPCA'
% date: date of model creation
% time: time of model creation
% size: dimensions of input data
% nocomp: number of PCs in model
% scale: type of scaling used
% means: mean vector for PCA model
% stds: standard deviation vector for PCA model
% ssq: variance captured table data
% scores: PCA scores stored as m x n x nocomp array (uint8)
% range: original range of PCA scores before mapping to uint8
% loads: PCA loadings
% res: PCA residuals stored as m x n array (uint8)
% reslim: Q limit
% tsq: PCA T^2 values stared as m x n array (unit8)
% tsqlim: T^2 limit
%
% Note that the scores, residuals and T^2 matrices are stored
% as unsigned 8 bit integers (uint8) scaled so their range is
% 0 to 255. These can be viewed with the IMAGE function, but
% be sure the current colormap has 256 colors. For example, to
% view the scores on the second PC using the jet colormap:
%
% image(model.scores(:,:,2)), colormap(jet(256)), colorbar
%
%I/O: model = imgpca(mwa,scaling,nocomp);
%
% IMGPCA can also be used to apply existing IPCA models to
% new images as follows:
%
%I/O: newmod = imgpca(mwa,model,plots);
%
% If plots == 0, no plots are produced.
%
%See also: CONTRASTMOD, IMAGEGUI, IMGSELCT, IMGSIMCA, IMREAD, ISIMCAPR
%Copyright Eigenvector Research, Inc. 1998-2004
%Licensee shall not re-compile, translate or convert "M-files" contained
% in PLS_Toolbox for use with any software other than MATLAB
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -