50 #include <visp/vpHomography.h>
51 #include <visp/vpMatrixException.h>
59 double *xn,
double *yn,
60 double &xg,
double &yg,
67 for (i =0 ; i < n ; i++)
91 if(std::fabs(distance) <= std::numeric_limits<double>::epsilon())
94 coef=sqrt(2.0)/distance;
109 double xg1,
double yg1,
double coef1,
110 double xg2,
double yg2,
double coef2 )
124 T1[0][0]=T1[1][1]=coef1;
125 T1[0][2]=-coef1*xg1 ;
126 T1[1][2]=-coef1*yg1 ;
128 T2[0][0]=T2[1][1]=coef2;
129 T2[0][2]=-coef2*xg2 ;
130 T2[1][2]=-coef2*yg2 ;
137 for (
unsigned int i=0 ; i < 3 ; i++)
138 for (
unsigned int j=0 ; j < 3 ; j++) aHb[i][j] = maHb[i][j] ;
160 double *xb,
double *yb,
161 double *xa,
double *ya ,
171 xbn =
new double [n];
172 ybn =
new double [n];
174 double xg1, yg1, coef1 ;
182 xan =
new double [n];
183 yan =
new double [n];
185 double xg2, yg2, coef2 ;
270 double *xb,
double *yb,
271 double *xa,
double *ya ,
278 vpTRACE(
"there must be at least 4 points in the both images\n") ;
306 A[2*i][6]=xb[i]*ya[i] ;
307 A[2*i][7]=yb[i]*ya[i];
317 A[2*i+1][6]=-xb[i]*xa[i];
318 A[2*i+1][7]=-yb[i]*xa[i];
324 for (
int i=0; i < 9; i ++) {
336 for(i = 0; i<9;i++) if(D[i]>1e-7) rank++;
339 vpTRACE(
" Rank is : %d, should be 8", rank);
341 "\n\t\t Matrix rank is deficient")) ;
347 double smallestSv = 1e30 ;
348 unsigned int indexSmallestSv = 0 ;
349 for (i=0 ; i < 9 ; i++)
350 if ((D[i] < smallestSv) ){ smallestSv = D[i] ;indexSmallestSv = i ; }
353 h=V.
column(indexSmallestSv+1);
371 std::cout <<std::endl << me << std::endl ;
Definition of the vpMatrix class.
void resize(const unsigned int nrows, const unsigned int ncols, const bool nullify=true)
error that can be emited by ViSP classes.
static void HartleyDenormalization(vpHomography &aHbn, vpHomography &aHb, double xg1, double yg1, double coef1, double xg2, double yg2, double coef2)
vpMatrix()
Basic constructor.
vpColVector column(const unsigned int j)
Column extraction.
This class aims to compute the homography wrt.two images.
void setIdentity(const double &val=1.0)
void svd(vpColVector &w, vpMatrix &v)
static double sqr(double x)
static void DLT(unsigned int n, double *xb, double *yb, double *xa, double *ya, vpHomography &aHb)
Computes the homography matrix wrt. the data using the DLT (Direct Linear Transform) algorithm...
Class that provides a data structure for the column vectors as well as a set of operations on these v...
error that can be emited by the vpMatrix class and its derivates
vpMatrix pseudoInverse(double svThreshold=1e-6) const
Compute the pseudo inverse of the matrix using the SVD.
static void HartleyDLT(unsigned int n, double *xb, double *yb, double *xa, double *ya, vpHomography &aHb)
Computes the homography matrix using the DLT (Direct Linear Transform) algorithm on normalized data...
static void HartleyNormalization(unsigned int n, double *x, double *y, double *xn, double *yn, double &xg, double &yg, double &coef)