Code covered by the BSD License  

Highlights from
Statistical Learning Toolbox

from Statistical Learning Toolbox by Dahua Lin
Functions for statistical learning, pattern recognition and computer vision, covering many topics.

Description of sl2dpca_construct
Home > sltoolbox > subspace_ex > sl2dpca_construct.m

sl2dpca_construct

PURPOSE ^

SL2DPCA_CONSTRUCT Constructs the matrix from 2D feature

SYNOPSIS ^

function X = sl2dpca_construct(Mm, PL, PR, Y)

DESCRIPTION ^

SL2DPCA_CONSTRUCT Constructs the matrix from 2D feature

 $ Syntax $
   - X = sl2dpca_construct(Mm, PL, PR, Y)

 $ Arguments $
   - Mm:       the mean matrix
   - PL:       the left projection matrix
   - PR:       the right projection matrix
   - Y:        the extracted 2D features
   - X:        the constructed matrices

 $ Description $
   - X = sl2dpca_construct(Mm, PL, PR, Y) constructs the matrices in
     original size using a 2D PCA model characterized by mean matrix and
     the left and right projection matrices. 

 $ History $
   - Created by Dahua Lin, on Jul 31st, 2006

CROSS-REFERENCE INFORMATION ^

This function calls:
This function is called by:

SOURCE CODE ^

0001 function X = sl2dpca_construct(Mm, PL, PR, Y)
0002 %SL2DPCA_CONSTRUCT Constructs the matrix from 2D feature
0003 %
0004 % $ Syntax $
0005 %   - X = sl2dpca_construct(Mm, PL, PR, Y)
0006 %
0007 % $ Arguments $
0008 %   - Mm:       the mean matrix
0009 %   - PL:       the left projection matrix
0010 %   - PR:       the right projection matrix
0011 %   - Y:        the extracted 2D features
0012 %   - X:        the constructed matrices
0013 %
0014 % $ Description $
0015 %   - X = sl2dpca_construct(Mm, PL, PR, Y) constructs the matrices in
0016 %     original size using a 2D PCA model characterized by mean matrix and
0017 %     the left and right projection matrices.
0018 %
0019 % $ History $
0020 %   - Created by Dahua Lin, on Jul 31st, 2006
0021 %
0022 
0023 %% Parse and verify input arguments
0024 
0025 if ndims(Mm) ~= 2
0026     error('sltoolbox:invalidarg', ...
0027         'Mm should be a 2D matrix');
0028 end
0029 [d1, d2] = size(Mm);
0030 if size(PL, 1) ~= d1 || size(PR, 1) ~= d2
0031     error('sltoolbox:sizmismatch', ...
0032         'Inconsistent size for 2D PCA model');
0033 end
0034 k1 = size(PL, 2);
0035 k2 = size(PR, 2);
0036 if size(Y, 1) ~= k1 || size(Y, 2) ~= k2
0037     error('sltoolbox:sizmismatch', ...
0038         'The feature size is inconsistent with the 2D PCA model');
0039 end
0040 
0041 %% Construct
0042 
0043 n = size(Y, 3);
0044 X = zeros(d1, d2, n);
0045 PRT = PR';
0046 
0047 for i = 1 : n
0048     X(:,:,i) = PL * Y(:,:,i) * PRT + Mm;
0049 end
0050 
0051

Generated on Wed 20-Sep-2006 12:43:11 by m2html © 2003

Contact us at files@mathworks.com