40 #include <visp3/tt/vpTemplateTrackerWarpHomographySL3.h> 65 double **dW_ddp0 =
new double *[(
unsigned int)nb_pt];
66 for (
int i = 0; i < nb_pt; i++) {
68 dW_ddp0[i] =
new double[2 *
nbParam];
80 double lambda = 0.00001;
87 for (
int i = 0; i < nb_pt; i++) {
94 for (
unsigned int ip = 0; ip <
nbParam; ip++) {
95 dW_[0][ip] = dW_ddp0[i][ip];
96 dW_[1][ip] = dW_ddp0[i][ip +
nbParam];
107 erreur += ((u[i] - fX1[0]) * (u[i] - fX1[0]) + (v[i] - fX1[1]) * (v[i] - fX1[1]));
123 while ((cpt < 150) && (sqrt((erreur_prec - erreur) * (erreur_prec - erreur)) > 1e-20));
126 for (
int i = 0; i < nb_pt; i++)
141 for (
unsigned int i = 0; i < 8; i++) {
184 warp(u, v, 4, p, u2, v2);
186 for (
int i = 0; i < 4; i++) {
233 warp(u, v, 4, p, u2, v2);
236 for (
int i = 0; i < 4; i++) {
264 denom = X[0] *
G[2][0] + X[1] *
G[2][1] +
G[2][2];
280 pA[1][1] = -p[4] - p[5];
301 double u = X1[0], v = X1[1];
302 X2[0] = (u *
G[0][0] + v *
G[0][1] +
G[0][2]) /
denom;
303 X2[1] = (u *
G[1][0] + v *
G[1][1] +
G[1][2]) /
denom;
318 u2 = (u1 *
G[0][0] + v1 *
G[0][1] +
G[0][2]) /
denom;
319 v2 = (u1 *
G[1][0] + v1 *
G[1][1] +
G[1][2]) /
denom;
329 for (
unsigned int i = 0; i < 3; i++)
330 for (
unsigned int j = 0; j < 3; j++)
353 dhdx[0][0] = 1. /
denom;
354 dhdx[1][1] = 1. /
denom;
355 dhdx[0][2] = -X2[0] / (
denom);
356 dhdx[1][2] = -X2[1] / (
denom);
358 for (
unsigned int i = 0; i < 3; i++) {
361 dGx[i][2] =
G[i][0] * X1[1];
362 dGx[i][3] =
G[i][1] * X1[0];
363 dGx[i][4] =
G[i][0] * X1[0] -
G[i][1] * X1[1];
364 dGx[i][5] =
G[i][2] -
G[i][1] * X1[1];
365 dGx[i][6] =
G[i][2] * X1[0];
366 dGx[i][7] =
G[i][2] * X1[1];
385 dhdx[0][2] = -u * du - v * dv;
389 for (
unsigned int par = 0; par < 3; par++) {
390 dGx[par][0] =
G[par][0];
391 dGx[par][1] =
G[par][1];
392 dGx[par][2] =
G[par][0] * v;
393 dGx[par][3] =
G[par][1] * u;
394 dGx[par][4] =
G[par][0] * u -
G[par][1] * v;
395 dGx[par][5] =
G[par][2] -
G[par][1] * v;
396 dGx[par][6] =
G[par][2] * u;
397 dGx[par][7] =
G[par][2] * v;
400 for (
unsigned int par = 0; par <
nbParam; par++) {
402 for (
unsigned int par2 = 0; par2 < 3; par2++)
403 res += dhdx[0][par2] *
dGx[par2][par];
429 for (
unsigned int par = 0; par < 3; par++) {
430 dGx[par][0] =
G[par][0];
431 dGx[par][1] =
G[par][1];
432 dGx[par][2] =
G[par][0] * v;
433 dGx[par][3] =
G[par][1] * u;
434 dGx[par][4] =
G[par][0] * u -
G[par][1] * v;
435 dGx[par][5] =
G[par][2] -
G[par][1] * v;
436 dGx[par][6] =
G[par][2] * u;
437 dGx[par][7] =
G[par][2] * v;
440 dIdW_temp = dhdx *
dGx;
442 for (
unsigned int par = 0; par <
nbParam; par++) {
443 dIdW[par] = dIdW_temp[0][par];
444 dIdW[par +
nbParam] = dIdW_temp[1][par];
470 for (
unsigned int par = 0; par < 3; par++) {
471 dGx[par][0] =
G[par][0];
472 dGx[par][1] =
G[par][1];
473 dGx[par][2] =
G[par][0] * v;
474 dGx[par][3] =
G[par][1] * u;
475 dGx[par][4] =
G[par][0] * u -
G[par][1] * v;
476 dGx[par][5] =
G[par][2] -
G[par][1] * v;
477 dGx[par][6] =
G[par][2] * u;
478 dGx[par][7] =
G[par][2] * v;
481 dIdW_temp = dhdx *
dGx;
483 for (
unsigned int par = 0; par <
nbParam; par++) {
484 dIdW[par] = dIdW_temp[0][par];
485 dIdW[par +
nbParam] = dIdW_temp[1][par];
503 for (
unsigned int i = 0; i <
nbParam; i++) {
504 dM[0][i] =
denom * ((
G[0][0] - X[0] *
G[2][0]) * dwdp0[i] + (
G[0][1] - X[0] *
G[2][1]) * dwdp0[i +
nbParam]);
505 dM[1][i] =
denom * ((G[1][0] - X[1] * G[2][0]) * dwdp0[i] + (G[1][1] - X[1] * G[2][1]) * dwdp0[i +
nbParam]);
void getParamPyramidDown(const vpColVector &p, vpColVector &p_down)
Implementation of a matrix and operations on matrices.
void resize(unsigned int nrows, unsigned int ncols, bool flagNullify=true, bool recopy_=true)
void computeDenom(vpColVector &X, const vpColVector &)
void computeCoeff(const vpColVector &p)
void getdWdp0(const int &v, const int &u, double *dIdW)
vpMatrix inverseByLU() const
void getParamInverse(const vpColVector &p, vpColVector &p_inv) const
error that can be emited by ViSP classes.
std::vector< vpMatrix > A
vpHomography getHomography() const
void findWarp(const double *ut0, const double *vt0, const double *u, const double *v, int nb_pt, vpColVector &p)
Implementation of an homography and operations on homographies.
void getdW0(const int &v, const int &u, const double &dv, const double &du, double *dIdW)
void pRondp(const vpColVector &p1, const vpColVector &p2, vpColVector &p12) const
double denom
Internal value used by homography warp model.
virtual ~vpTemplateTrackerWarpHomographySL3()
void dWarp(const vpColVector &X1, const vpColVector &X2, const vpColVector &, vpMatrix &dW)
void warpX(const vpColVector &X1, vpColVector &X2, const vpColVector &)
Implementation of column vector and the associated operations.
vpTemplateTrackerWarpHomographySL3()
void getParamPyramidUp(const vpColVector &p, vpColVector &p_up)
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)
unsigned int nbParam
Number of parameters used to model warp transformation.
void dWarpCompo(const vpColVector &, const vpColVector &X, const vpColVector &, const double *dwdp0, vpMatrix &dW)