Home > General-Functions > SUGR > Homography_2D > sugr_transform_with_Homography_2D.m

sugr_transform_with_Homography_2D

PURPOSE ^

% transform uncertain elements using a projective mapping

SYNOPSIS ^

function y = sugr_transform_with_Homography_2D(H,x)

DESCRIPTION ^

% transform uncertain elements using a projective mapping

 y = sugr_transform_Homography_2D(H,x);

 Wolfgang Förstner
 wfoerstn@uni-bonn.de

 wf 1/2011
 sw 9/2016

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 %% transform uncertain elements using a projective mapping
0002 %
0003 % y = sugr_transform_Homography_2D(H,x);
0004 %
0005 % Wolfgang Förstner
0006 % wfoerstn@uni-bonn.de
0007 %
0008 % wf 1/2011
0009 % sw 9/2016
0010 
0011 function y = sugr_transform_with_Homography_2D(H,x)
0012 
0013 N = length(x);
0014 
0015 switch H.type
0016     case 20
0017         switch N
0018             case 1
0019                 switch x.type
0020                     case 1
0021                         %% transform a 2D point:                                              x' = H * x
0022                         Jx     = H.H;                                 % Jacobian x' -> x
0023                         y      = Jx * x.h;                            % x'
0024                         Jh     = kron(x.h', eye(3));                  % Jacobian x' -> h
0025                         CHhh   = sugr_get_CovM_homogeneous_Homography_2D(H);
0026                         Cxhh   = sugr_get_CovM_homogeneous_Vector(x);
0027                         Cyhh   = Jx * Cxhh * Jx' + Jh * CHhh * Jh';   % C_x'x_
0028                         y      = sugr_Point_2D(y,Cyhh);
0029                         
0030                     case 2
0031                         %% transform a 2D line:                                                 l' = inv(H') * l
0032                         Jx     = inv(H.H');                           % Jacobian l' -> l
0033                         ls     = Jx * x.h;                            %#ok<*MINV> % l'
0034                         Jh     = kron(x.h', eye(3));                  % Jacobian l' -> h
0035                         CHhh   = sugr_get_CovM_homogeneous_Homography_2D(H);
0036                         Cxhh   = sugr_get_CovM_homogeneous_Vector(x);
0037                         Clhh   = Jx * Cxhh * Jx' + Jh * CHhh * Jh'; % C_l'l'
0038                         y      = sugr_Line_2D(ls,Clhh);
0039                         
0040                 end
0041             otherwise
0042                 %% Transform a list of elements
0043                 y = zeros(N,1);
0044                 for n=1:N
0045                     y(n) = sugr_transform_with_Homography_2D(H,x(n));                    % transform each element
0046                 end
0047         end
0048 end
0049

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