Home > General-Functions > SUGR > E-Matrix > sugr_E_Matrix.m

sugr_E_Matrix

PURPOSE ^

% create E-matrix

SYNOPSIS ^

function E = sugr_E_Matrix(a1,a2,a3)

DESCRIPTION ^

% create E-matrix

 Usage
    E = sugr_E_Matrix(E)         
       3x3 matrix, needs not be an essential matrix, CovM = 0
    E = sugr_E_Matrix(b,R)       
       3x1 vector b, 3x3 rotation R, CovM = 0
    E = sugr_E_Matrix(b,R,CbRbR) 
       3x1 vector b, 3x3 rotation R, 5x5 CovM of d_r = [db_r,dr]
    E = sugr_E_Matrix(b,R,Cee)   
       3x1 vector b, 3x3 rotation R, 9x9 CovM of d_e = d_vecE,
       needs  not have the correct rank

 output
 E-Matrix = structure
    .E     = 3 x 3-Matrix, 
             Frobenius norm = 2
             det(U)=det(V), for [U,D,V]=svd(E)% 
    .bR    = 3 x 4 matrix [b,R], if input b, R  
    .Cee   = 9x9 covariance matrix of e=vecE, rank=5
    .CbRbR = 5 x 5 covariance matrix of minimal parameters r
             r(5) = [db_r; dm] for [b,R], if input b, R
    .JebR  = 8 x 5 Jacobian de/dbR
    .type  = 25 -> Essential matrix

 Wolfgang Förstner 11/2017
 wfoerstn@uni-bonn.de

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 %% create E-matrix
0002 %
0003 % Usage
0004 %    E = sugr_E_Matrix(E)
0005 %       3x3 matrix, needs not be an essential matrix, CovM = 0
0006 %    E = sugr_E_Matrix(b,R)
0007 %       3x1 vector b, 3x3 rotation R, CovM = 0
0008 %    E = sugr_E_Matrix(b,R,CbRbR)
0009 %       3x1 vector b, 3x3 rotation R, 5x5 CovM of d_r = [db_r,dr]
0010 %    E = sugr_E_Matrix(b,R,Cee)
0011 %       3x1 vector b, 3x3 rotation R, 9x9 CovM of d_e = d_vecE,
0012 %       needs  not have the correct rank
0013 %
0014 % output
0015 % E-Matrix = structure
0016 %    .E     = 3 x 3-Matrix,
0017 %             Frobenius norm = 2
0018 %             det(U)=det(V), for [U,D,V]=svd(E)%
0019 %    .bR    = 3 x 4 matrix [b,R], if input b, R
0020 %    .Cee   = 9x9 covariance matrix of e=vecE, rank=5
0021 %    .CbRbR = 5 x 5 covariance matrix of minimal parameters r
0022 %             r(5) = [db_r; dm] for [b,R], if input b, R
0023 %    .JebR  = 8 x 5 Jacobian de/dbR
0024 %    .type  = 25 -> Essential matrix
0025 %
0026 % Wolfgang Förstner 11/2017
0027 % wfoerstn@uni-bonn.de
0028 
0029 function E = sugr_E_Matrix(a1,a2,a3)
0030 
0031 % default
0032 Cee   = zeros(9);                                                          %#ok<PREALL>
0033 CbRbR = zeros(5);
0034 %
0035 switch nargin
0036     case 1 % E-matrix, CovM = 0
0037         [U,~,V] = svd(a1);
0038         Em      = U*diag([1,1,0])*V'*det(U)*det(V);
0039         % collect
0040         E.E     = Em;
0041         E.CbRbR = CbRbR;
0042     case 2 % b, R
0043         b        = a1/norm(a1);
0044         E.E      = calc_S(b)*a2';
0045         E.bR     = [b,a2];
0046         E.CbRbR  = CbRbR;
0047     case 3
0048         r=size(a3,1);
0049         switch r
0050             case 5 % basis, rotation, CbRbR
0051                 factor  = 1/norm(a1);
0052                 b       = a1*factor;
0053                 CbRbR   = a3*factor^2;
0054                 [EbR,Cee,JebR]=...
0055                     sugr_get_Cee_JebR_from_b_R_CbRbR(b,a2,CbRbR);
0056                 % normalize E
0057                 [U,~,V] = svd(EbR);
0058                 Em      = U*diag([1,1,0])*V'*det(U)*det(V);
0059                 % collect
0060                 E.E     = Em;
0061                 E.bR    = [b,a2];
0062                 E.Cee   = Cee;     
0063                 E.CbRbR = CbRbR;
0064                 E.JebR  = JebR;
0065             case 9 % basis, rotation, Cee
0066                 factor  = 1/norm(a1);
0067                 b       = a1*factor;
0068                 Cee     = a3*factor^2;
0069                 [EbR,CbRbR,JebR]=...
0070                     sugr_get_CbRbR_JebR_from_b_R_Cee(b,a2,Cee); 
0071                 % normalize E
0072                 [U,~,V] = svd(EbR);
0073                 Em      = U*diag([1,1,0])*V'*det(U)*det(V);             
0074                 % normalize E and get JebR
0075                 E.E     = Em;
0076                 E.bR    = [b,a2];
0077                 E.CbRbR = CbRbR;
0078                 E.Cee   = JebR*E.CbRbR*JebR';
0079                 E.JebR  = JebR;
0080         end
0081 end
0082 E.type = 25;

Generated on Sat 21-Jul-2018 20:56:10 by m2html © 2005