Go to the documentation of this file.00001
00002 #include "vgl_h_matrix_1d_compute_3point.h"
00003 #include <vcl_cassert.h>
00004
00005
00006
00007
00008 static void
00009 direct_compute(double T[2][2],
00010 double p11,double p12,double p13,
00011 double p21,double p22,double p23,
00012
00013 double q11,double q12,double q13,
00014 double q21,double q22,double q23)
00015 {
00016 double A[2][2],B[2][2];
00017 double t;
00018
00019 t=+(p22*p13-p12*p23); A[0][0]=t*p11; A[1][0]=t*p21;
00020 t=-(p21*p13-p11*p23); A[0][1]=t*p12; A[1][1]=t*p22;
00021
00022 t=+(q22*q13-q12*q23); B[0][0]=t*q11; B[1][0]=t*q21;
00023 t=-(q21*q13-q11*q23); B[0][1]=t*q12; B[1][1]=t*q22;
00024
00025 T[0][0]= B[0][0]*A[1][1]-B[0][1]*A[1][0];
00026 T[1][0]= B[1][0]*A[1][1]-B[1][1]*A[1][0];
00027 T[0][1]=-B[0][0]*A[0][1]+B[0][1]*A[0][0];
00028 T[1][1]=-B[1][0]*A[0][1]+B[1][1]*A[0][0];
00029 }
00030
00031 bool vgl_h_matrix_1d_compute_3point::
00032 compute_cool_homg(const vcl_vector<vgl_homg_point_1d<double> >& points1,
00033 const vcl_vector<vgl_homg_point_1d<double> >& points2,
00034 vgl_h_matrix_1d<double>& H)
00035 {
00036 assert(points1.size() == 3);
00037 assert(points2.size() == 3);
00038 double T[2][2];
00039 direct_compute(T,
00040 points1[0].x() , points1[1].x() , points1[2].x(),
00041 points1[0].w() , points1[1].w() , points1[2].w(),
00042
00043 points2[0].x() , points2[1].x() , points2[2].x(),
00044 points2[0].w() , points2[1].w() , points2[2].w());
00045 H.set(&T[0][0]);
00046 return true;
00047 }
00048