39 #include <visp3/tt/vpTemplateTrackerWarpHomographySL3.h>
44 const double *u,
const double *v,
int nb_pt,
vpColVector& p)
54 double **dW_ddp0=
new double*[(
unsigned int)nb_pt];
55 for(
int i=0;i<nb_pt;i++)
58 dW_ddp0[i]=
new double[2*
nbParam];
70 double lambda=0.00001;
78 for(
int i=0;i<nb_pt;i++)
86 for(
unsigned int ip=0;ip<
nbParam;ip++)
88 dW_[0][ip]=dW_ddp0[i][ip];
89 dW_[1][ip]=dW_ddp0[i][ip+
nbParam];
100 erreur+=((u[i]-fX1[0])*(u[i]-fX1[0])+(v[i]-fX1[1])*(v[i]-fX1[1]));
117 while((cpt<150)&&(sqrt((erreur_prec-erreur)*(erreur_prec-erreur))>1e-20));
120 for(
int i=0;i<nb_pt;i++)
134 for(
unsigned int i=0;i<8;i++)
159 double *u,*v;u=
new double[4];v=
new double[4];
161 u[0]=0;v[0]=0;u[1]=160;v[1]=0;u[2]=160;v[2]=120;u[3]=0;v[3]=120;
162 double *u2,*v2;u2=
new double[4];v2=
new double[4];
183 double *u,*v;u=
new double[4];v=
new double[4];
185 u[0]=0;v[0]=0;u[1]=160;v[1]=0;u[2]=160;v[2]=120;u[3]=0;v[3]=120;
187 double *u2,*v2;u2=
new double[4];v2=
new double[4];
221 denom=vX[0]*
G[2][0]+vX[1]*
G[2][1]+
G[2][2];
245 double i=vX[1],j=vX[0];
246 vXres[0]=(j*
G[0][0]+i*
G[0][1]+
G[0][2])/
denom;
247 vXres[1]=(j*
G[1][0]+i*
G[1][1]+
G[1][2])/
denom;
251 j2=(j*
G[0][0]+i*
G[0][1]+
G[0][2])/
denom;
252 i2=(j*
G[1][0]+i*
G[1][1]+
G[1][2])/
denom;
258 for (
unsigned int i=0; i<3; i++)
259 for (
unsigned int j=0; j<3; j++)
270 for(
unsigned int i=0;i<3;i++)
274 dGx[i][2]=
G[i][0]*X1[1];
275 dGx[i][3]=
G[i][1]*X1[0];
276 dGx[i][4]=
G[i][0]*X1[0]-
G[i][1]*X1[1];
277 dGx[i][5]=
G[i][2]-
G[i][1]*X1[1];
278 dGx[i][6]=
G[i][2]*X1[0];
279 dGx[i][7]=
G[i][2]*X1[1];
291 dhdx[0][0]=dx;dhdx[0][1]=dy;dhdx[0][2]=-j*dx-i*dy;
295 for(
unsigned int par=0;par<3;par++)
297 dGx[par][0]=
G[par][0];
298 dGx[par][1]=
G[par][1];
299 dGx[par][2]=
G[par][0]*i;
300 dGx[par][3]=
G[par][1]*j;
301 dGx[par][4]=
G[par][0]*j-
G[par][1]*i;
302 dGx[par][5]=
G[par][2]-
G[par][1]*i;
303 dGx[par][6]=
G[par][2]*j;
304 dGx[par][7]=
G[par][2]*i;
307 for(
unsigned int par=0;par<
nbParam;par++)
310 for(
unsigned int par2=0;par2<3;par2++)
311 res+=dhdx[0][par2]*
dGx[par2][par];
323 dhdx[0][0]=1.;dhdx[1][1]=1.;dhdx[0][2]=-j;dhdx[1][2]=-i;
327 for(
unsigned int par=0;par<3;par++)
329 dGx[par][0]=
G[par][0];
330 dGx[par][1]=
G[par][1];
331 dGx[par][2]=
G[par][0]*i;
332 dGx[par][3]=
G[par][1]*j;
333 dGx[par][4]=
G[par][0]*j-
G[par][1]*i;
334 dGx[par][5]=
G[par][2]-
G[par][1]*i;
335 dGx[par][6]=
G[par][2]*j;
336 dGx[par][7]=
G[par][2]*i;
341 for(
unsigned int par=0;par<
nbParam;par++)
343 dIdW[par]=dIdW_temp[0][par];
344 dIdW[par+
nbParam]=dIdW_temp[1][par];
352 dhdx[0][0]=1.;dhdx[1][1]=1.;dhdx[0][2]=-j;dhdx[1][2]=-i;
356 for(
unsigned int par=0;par<3;par++)
358 dGx[par][0]=
G[par][0];
359 dGx[par][1]=
G[par][1];
360 dGx[par][2]=
G[par][0]*i;
361 dGx[par][3]=
G[par][1]*j;
362 dGx[par][4]=
G[par][0]*j-
G[par][1]*i;
363 dGx[par][5]=
G[par][2]-
G[par][1]*i;
364 dGx[par][6]=
G[par][2]*j;
365 dGx[par][7]=
G[par][2]*i;
370 for(
unsigned int par=0;par<
nbParam;par++)
372 dIdW[par]=dIdW_temp[0][par];
373 dIdW[par+
nbParam]=dIdW_temp[1][par];
383 for(
unsigned int i=0;i<
nbParam;i++)
385 dW_[0][i]=
denom*((
G[0][0]-X2[0]*
G[2][0])*dwdp0[i]+(
G[0][1]-X2[0]*
G[2][1])*dwdp0[i+
nbParam]);
386 dW_[1][i]=
denom*((G[1][0]-X2[1]*G[2][0])*dwdp0[i]+(G[1][1]-X2[1]*G[2][1])*dwdp0[i+
nbParam]);
void pRondp(const vpColVector &p1, const vpColVector &p2, vpColVector &pres) const
Implementation of a matrix and operations on matrices.
void computeDenom(vpColVector &vX, const vpColVector &ParamM)
void getParamPyramidDown(const vpColVector &p, vpColVector &pdown)
void resize(const unsigned int nrows, const unsigned int ncols, const bool flagNullify=true)
void computeCoeff(const vpColVector &p)
void getdW0(const int &i, const int &j, const double &dy, const double &dx, double *dIdW)
void dWarpCompo(const vpColVector &X1, const vpColVector &X2, const vpColVector &ParamM, const double *dwdp0, vpMatrix &dW)
error that can be emited by ViSP classes.
std::vector< vpMatrix > A
void findWarp(const double *ut0, const double *vt0, const double *u, const double *v, int nb_pt, vpColVector &p)
vpHomography getHomography() const
void getdWdp0(const int &i, const int &j, double *dIdW)
Implementation of an homography and operations on homographies.
void warpX(const vpColVector &vX, vpColVector &vXres, const vpColVector &ParamM)
void getParamInverse(const vpColVector &ParamM, vpColVector &ParamMinv) const
~vpTemplateTrackerWarpHomographySL3()
void getParamPyramidUp(const vpColVector &p, vpColVector &pup)
Implementation of column vector and the associated operations.
vpTemplateTrackerWarpHomographySL3()
vpMatrix inverseByLU() const
void dWarp(const vpColVector &X1, const vpColVector &X2, const vpColVector &ParamM, vpMatrix &dW)
static void computeHLM(const vpMatrix &H, const double &alpha, vpMatrix &HLM)
void warp(const double *ut0, const double *vt0, int nb_pt, const vpColVector &p, double *u, double *v)