40 #include <visp3/core/vpImageFilter.h> 41 #include <visp3/tt/vpTemplateTrackerZNCCForwardAdditional.h> 63 Warp->computeCoeff(
p);
64 double IW, dIWx, dIWy;
73 double *tempt =
new double[
nbParam];
75 for (
unsigned int point = 0; point <
templateSize; point++) {
88 if ((i2 >= 0) && (j2 >= 0) && (i2 < I.
getHeight() - 1) && (j2 < I.
getWidth() - 1)) {
101 moyTij = moyTij / Nbpoint;
102 moyIW = moyIW / Nbpoint;
104 for (
unsigned int point = 0; point <
templateSize; point++) {
117 if ((i2 >= 0) && (j2 >= 0) && (i2 < I.
getHeight() - 1) && (j2 < I.
getWidth() - 1)) {
129 for (
unsigned int it = 0; it <
nbParam; it++)
130 tempt[it] =
dW[0][it] * dIWx +
dW[1][it] * dIWy;
132 double prod = (Tij - moyTij);
134 double d_Ixx = dIxx.
getValue(i2, j2);
135 double d_Iyy = dIyy.
getValue(i2, j2);
136 double d_Ixy = dIxy.
getValue(i2, j2);
138 for (
unsigned int it = 0; it <
nbParam; it++)
139 for (
unsigned int jt = 0; jt <
nbParam; jt++)
140 Hdesire[it][jt] += prod * (
dW[0][it] * (
dW[0][jt] * d_Ixx +
dW[1][jt] * d_Ixy) +
141 dW[1][it] * (
dW[0][jt] * d_Ixy +
dW[1][jt] * d_Iyy));
142 denom += (Tij - moyTij) * (Tij - moyTij) * (IW - moyIW) * (IW - moyIW);
161 double IW, dIWx, dIWy;
163 unsigned int iteration = 0;
170 double evolRMS_init = 0;
171 double evolRMS_prec = 0;
172 double evolRMS_delta;
173 double *tempt =
new double[
nbParam];
180 Warp->computeCoeff(
p);
184 for (
unsigned int point = 0; point <
templateSize; point++) {
195 if ((i2 >= 0) && (j2 >= 0) && (i2 < I.
getHeight() - 1) && (j2 < I.
getWidth() - 1)) {
214 moyTij = moyTij / Nbpoint;
215 moyIW = moyIW / Nbpoint;
216 for (
unsigned int point = 0; point <
templateSize; point++) {
227 if ((i2 >= 0) && (j2 >= 0) && (i2 < I.
getHeight() - 1) && (j2 < I.
getWidth() - 1)) {
239 for (
unsigned int it = 0; it <
nbParam; it++)
240 tempt[it] =
dW[0][it] * dIWx +
dW[1][it] * dIWy;
242 double prod = (Tij - moyTij);
243 for (
unsigned int it = 0; it <
nbParam; it++)
244 G[it] += prod * tempt[it];
246 double er = (Tij - IW);
248 denom += (Tij - moyTij) * (Tij - moyTij) * (IW - moyIW) * (IW - moyIW);
271 if (iteration == 0) {
276 evolRMS_delta = std::fabs(
evolRMS - evolRMS_prec);
virtual void warpX(const int &v1, const int &u1, double &v2, double &u2, const vpColVector &p)=0
Type getValue(unsigned int i, unsigned int j) const
static void getGradX(const vpImage< unsigned char > &I, vpImage< double > &dIx)
vpTemplateTrackerPoint * ptTemplate
static void getGradY(const vpImage< unsigned char > &I, vpImage< double > &dIy)
vpMatrix inverseByLU() const
void computeOptimalBrentGain(const vpImage< unsigned char > &I, vpColVector &tp, double tMI, vpColVector &direction, double &alpha)
error that can be emited by ViSP classes.
void initPosEvalRMS(const vpColVector &p)
static void getGradYGauss2D(const vpImage< unsigned char > &I, vpImage< double > &dIy, const double *gaussianKernel, const double *gaussianDerivativeKernel, unsigned int size)
void computeEvalRMS(const vpColVector &p)
static void getGradXGauss2D(const vpImage< unsigned char > &I, vpImage< double > &dIx, const double *gaussianKernel, const double *gaussianDerivativeKernel, unsigned int size)
unsigned int templateSize
unsigned int iterationMax
static void filter(const vpImage< double > &I, vpImage< double > &Iu, vpImage< double > &Iv, const vpMatrix &M, bool convolve=false)
vpMatrix HLMdesireInverse
unsigned int getHeight() const
void initHessienDesired(const vpImage< unsigned char > &I)
void trackNoPyr(const vpImage< unsigned char > &I)
virtual void dWarp(const vpColVector &X1, const vpColVector &X2, const vpColVector &p, vpMatrix &dM)=0
vpTemplateTrackerZNCCForwardAdditional(vpTemplateTrackerWarp *warp)
vpTemplateTrackerWarp * Warp
static void computeHLM(const vpMatrix &H, const double &alpha, vpMatrix &HLM)
unsigned int getWidth() const