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

sugr_plot_Homography_2D

PURPOSE ^

% plot uncertain homography 2D

SYNOPSIS ^

function sugr_plot_Homography_2D(H,center_type,bound_type,lw,factor,type)

DESCRIPTION ^

% plot uncertain homography 2D

 sugr_plot_Homography_2D(H,center_type,bound_type,lw,factor,type)

 * H             = homography
 * center_type   = type of plotting the element
 * bound_type    = type of plotting the confidence region
 * lw            = linewidth
 * factor        = magnification factor
 * type          = type for showing homography
                 = 'x' only points are uncertain
                 = 'Hx' points and homography are uncertain
                 = 'H' only homopgraphy is uncertain

 Wolfgang Förstner
 wfoerstn@uni-bonn.de

 wf 1/2011

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 %% plot uncertain homography 2D
0002 %
0003 % sugr_plot_Homography_2D(H,center_type,bound_type,lw,factor,type)
0004 %
0005 % * H             = homography
0006 % * center_type   = type of plotting the element
0007 % * bound_type    = type of plotting the confidence region
0008 % * lw            = linewidth
0009 % * factor        = magnification factor
0010 % * type          = type for showing homography
0011 %                 = 'x' only points are uncertain
0012 %                 = 'Hx' points and homography are uncertain
0013 %                 = 'H' only homopgraphy is uncertain
0014 %
0015 % Wolfgang Förstner
0016 % wfoerstn@uni-bonn.de
0017 %
0018 % wf 1/2011
0019 
0020 function sugr_plot_Homography_2D(H,center_type,bound_type,lw,factor,type)
0021 
0022 if nargin < 6
0023     type='';
0024 end
0025 
0026 %% plot 2D homography by original and transfomed grid
0027 
0028 xlim([-1.4,4.3]);
0029 ylim([-3.8,1.4]);
0030 
0031 Ni = 3;
0032 Nj = 3;
0033 k  = 0;
0034 switch type
0035     case 'x'
0036         Cxx = 0.0004*eye(2);
0037         CHH = zeros(9);
0038         Hp = sugr_minimal_Homography_2D(H.H,CHH);
0039     case 'Hx'
0040         Cxx = 0.000004*eye(2);
0041         Hp = H;
0042     case 'H'
0043         Cxx = eye(2)*10^(-10);
0044         Hp = H;
0045     otherwise
0046         Cxx = zeros(2);
0047         CHH = zeros(9);
0048         Hp = sugr_minimal_Homography_2D(H.H,CHH);
0049 end
0050 
0051 
0052 for i=1:Ni
0053     for j=1:Nj
0054         k = k+1;
0055         X(k) = sugr_Point_2D([(i-Ni/2-1/2), (j-Nj/2-1/2)]',Cxx);
0056     end
0057 end
0058 Nk    =  Ni*Nj+1;
0059 X(Nk) = X(1);
0060 
0061 for k=1:Nk
0062     Y(k) = sugr_transform_with_Homography_2D(Hp,X(k));
0063     Y(k).Crr;
0064 end
0065 if  sugr_get_isfinite_Point_2D(Y(k))
0066     for k=1:Nk
0067         sugr_plot_Point_2D(X(k),center_type,'-r',lw,factor);
0068         hold on
0069         sugr_plot_Point_2D(Y(k),center_type,'-b',lw,factor);
0070     end
0071     for i=1:Ni
0072         [Xs,~] = sugr_get_Euclidean_Point_2D(X(Nj*(i-1)+1));
0073         [Xe,~] = sugr_get_Euclidean_Point_2D(X(Nj*i));
0074         plot([Xs(1),Xe(1)],[Xs(2),Xe(2)],'-r','LineWidth',2);
0075         [Ys,~] = sugr_get_Euclidean_Point_2D(Y(Nj*(i-1)+1));
0076         [Ye,~] = sugr_get_Euclidean_Point_2D(Y(Nj*i));
0077         plot([Ys(1),Ye(1)],[Ys(2),Ye(2)],'-r','LineWidth',2);
0078     end
0079     for j=1:Nj
0080         [Xs,~] = sugr_get_Euclidean_Point_2D(X(j));
0081         [Xe,~] = sugr_get_Euclidean_Point_2D(X(j+(i-1)*Nj));
0082         plot([Xs(1),Xe(1)],[Xs(2),Xe(2)],'-r','LineWidth',2);
0083         [Ys,~] = sugr_get_Euclidean_Point_2D(Y(j));
0084         [Ye,~] = sugr_get_Euclidean_Point_2D(Y(j+(i-1)*Nj));
0085         plot([Ys(1),Ye(1)],[Ys(2),Ye(2)],'-r','LineWidth',2);
0086     end
0087     
0088 end
0089 
0090 xlim([-1.4,4.3]);
0091 ylim([-4.9,1.8]);
0092 axis equal
0093

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