0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
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
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