40 #include <visp3/core/vpTrackingException.h> 41 #include <visp3/tt/vpTemplateTrackerWarpHomography.h> 74 dIdW[2] = -j * j * dx - i * j * dy;
77 dIdW[5] = -i * j * dx - i * i * dy;
104 denom = (1. / (ParamM[2] * vX[0] + ParamM[5] * vX[1] + 1.));
110 j2 = ((1. + ParamM[0]) * j + ParamM[3] * i + ParamM[6]) *
denom;
111 i2 = (ParamM[1] * j + (1. + ParamM[4]) * i + ParamM[7]) *
denom;
119 vXres[0] = ((1 + ParamM[0]) * vX[0] + ParamM[3] * vX[1] + ParamM[6]) *
denom;
120 vXres[1] = (ParamM[1] * vX[0] + (1 + ParamM[4]) * vX[1] + ParamM[7]) *
denom;
123 "Division by zero in vpTemplateTrackerWarpHomography::warpX()"));
132 dW_[0][0] = j *
denom;
133 dW_[0][2] = -j * X2[0] *
denom;
134 dW_[0][3] = i *
denom;
135 dW_[0][5] = -i * X2[0] *
denom;
138 dW_[1][1] = j *
denom;
139 dW_[1][2] = -j * X2[1] *
denom;
140 dW_[1][4] = i *
denom;
141 dW_[1][5] = -i * X2[1] *
denom;
152 dwdx0 = ((1. + ParamM[0]) - X2[0] * ParamM[2]) *
denom;
153 dwdx1 = (ParamM[1] - X2[1] * ParamM[2]) *
denom;
154 dwdy0 = (ParamM[3] - X2[0] * ParamM[5]) *
denom;
155 dwdy1 = ((1. + ParamM[4]) - X2[1] * ParamM[5]) *
denom;
156 for (
unsigned int i = 0; i <
nbParam; i++) {
157 dW_[0][i] = dwdx0 * dwdp0[i] + dwdy0 * dwdp0[i +
nbParam];
158 dW_[1][i] = dwdx1 * dwdp0[i] + dwdy1 * dwdp0[i +
nbParam];
165 if ((ParamM[2] * vX[0] + ParamM[5] * vX[1] + 1) < 0)
167 vXres[0] = ((1 + ParamM[0]) * vX[0] + ParamM[3] * vX[1] + ParamM[6]) / (ParamM[2] * vX[0] + ParamM[5] * vX[1] + 1);
168 vXres[1] = (ParamM[1] * vX[0] + (1 + ParamM[4]) * vX[1] + ParamM[7]) / (ParamM[2] * vX[0] + ParamM[5] * vX[1] + 1);
171 "vpTemplateTrackerWarpHomography::" 172 "warpXSpecialInv()"));
184 for (
unsigned int i = 0; i < 3; i++)
185 for (
unsigned int j = 0; j < 3; j++) {
186 if (i + 3 * j != 8) {
187 H[i][j] = ParamM[i + 3 * j];
199 for (
unsigned int i = 0; i < 3; i++)
200 for (
unsigned int j = 0; j < 3; j++) {
201 if (i + 3 * j != 8) {
202 par[i + 3 * j] = H[i][j] / H[2][2];
void getdW0(const int &i, const int &j, const double &dy, const double &dx, double *dIdW)
Implementation of a matrix and operations on matrices.
void getParamPyramidDown(const vpColVector &p, vpColVector &pdown)
void resize(const unsigned int nrows, const unsigned int ncols, const bool flagNullify=true, const bool recopy_=true)
void dWarpCompo(const vpColVector &X1, const vpColVector &X2, const vpColVector &ParamM, const double *dwdp0, vpMatrix &dW)
Implementation of an homography and operations on homographies.
Error that can be emited by the vpTracker class and its derivates.
void computeDenom(vpColVector &vX, const vpColVector &ParamM)
vpHomography inverse() const
invert the homography
void dWarp(const vpColVector &X1, const vpColVector &X2, const vpColVector &ParamM, vpMatrix &dW)
void getdWdp0(const int &i, const int &j, double *dIdW)
void getParamInverse(const vpColVector &ParamM, vpColVector &ParamMinv) const
void getParam(const vpHomography &H, vpColVector &par) const
void pRondp(const vpColVector &p1, const vpColVector &p2, vpColVector &pres) const
Implementation of column vector and the associated operations.
vpTemplateTrackerWarpHomography()
void warpX(const vpColVector &vX, vpColVector &vXres, const vpColVector &ParamM)
void getParamPyramidUp(const vpColVector &p, vpColVector &pup)
void warpXInv(const vpColVector &vX, vpColVector &vXres, const vpColVector &ParamM)
vpHomography getHomography(const vpColVector &ParamM) const