40 #include <visp3/core/vpTrackingException.h> 41 #include <visp3/tt/vpTemplateTrackerWarpHomography.h> 72 double j_dx_ = j * dx;
73 double i_dy_ = i * dy;
76 dIdW[2] = -j * j_dx_ - j * i_dy_;
79 dIdW[5] = -i * j_dx_ - i * i_dy_;
107 double value = (ParamM[2] * vX[0] + ParamM[5] * vX[1] + 1.);
109 if (std::fabs(value) > std::numeric_limits<double>::epsilon()) {
110 denom = (1. / value);
113 "Division by zero in vpTemplateTrackerWarpHomography::computeDenom()"));
120 j2 = ((1. + ParamM[0]) * j + ParamM[3] * i + ParamM[6]) *
denom;
121 i2 = (ParamM[1] * j + (1. + ParamM[4]) * i + ParamM[7]) *
denom;
126 vXres[0] = ((1 + ParamM[0]) * vX[0] + ParamM[3] * vX[1] + ParamM[6]) *
denom;
127 vXres[1] = (ParamM[1] * vX[0] + (1 + ParamM[4]) * vX[1] + ParamM[7]) *
denom;
136 dW_[0][0] = j *
denom;
137 dW_[0][2] = -j * X2[0] *
denom;
138 dW_[0][3] = i *
denom;
139 dW_[0][5] = -i * X2[0] *
denom;
142 dW_[1][1] = j *
denom;
143 dW_[1][2] = -j * X2[1] *
denom;
144 dW_[1][4] = i *
denom;
145 dW_[1][5] = -i * X2[1] *
denom;
156 dwdx0 = ((1. + ParamM[0]) - X2[0] * ParamM[2]) *
denom;
157 dwdx1 = (ParamM[1] - X2[1] * ParamM[2]) *
denom;
158 dwdy0 = (ParamM[3] - X2[0] * ParamM[5]) *
denom;
159 dwdy1 = ((1. + ParamM[4]) - X2[1] * ParamM[5]) *
denom;
160 for (
unsigned int i = 0; i <
nbParam; i++) {
161 dW_[0][i] = dwdx0 * dwdp0[i] + dwdy0 * dwdp0[i +
nbParam];
162 dW_[1][i] = dwdx1 * dwdp0[i] + dwdy1 * dwdp0[i +
nbParam];
168 double value = (ParamM[2] * vX[0] + ParamM[5] * vX[1] + 1.);
170 if (std::fabs(value) > std::numeric_limits<double>::epsilon()) {
171 vXres[0] = ((1 + ParamM[0]) * vX[0] + ParamM[3] * vX[1] + ParamM[6]) / value;
172 vXres[1] = (ParamM[1] * vX[0] + (1 + ParamM[4]) * vX[1] + ParamM[7]) / value;
175 "vpTemplateTrackerWarpHomography::" 189 for (
unsigned int i = 0; i < 3; i++)
190 for (
unsigned int j = 0; j < 3; j++) {
191 if (i + 3 * j != 8) {
192 H[i][j] = ParamM[i + 3 * j];
204 for (
unsigned int i = 0; i < 3; i++)
205 for (
unsigned int j = 0; j < 3; j++) {
206 if (i + 3 * j != 8) {
207 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 resize(unsigned int nrows, unsigned int ncols, bool flagNullify=true, bool recopy_=true)
void getParamPyramidDown(const vpColVector &p, vpColVector &pdown)
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