40 #include <visp3/core/vpImageFilter.h> 41 #include <visp3/tt/vpTemplateTrackerZNCCForwardAdditional.h> 63 Warp->computeCoeff(
p);
64 double IW, dIWx, dIWy;
73 for (
unsigned int point = 0; point <
templateSize; point++) {
86 if ((i2 >= 0) && (j2 >= 0) && (i2 < I.
getHeight() - 1) && (j2 < I.
getWidth() - 1)) {
99 moyTij = moyTij / Nbpoint;
100 moyIW = moyIW / Nbpoint;
102 for (
unsigned int point = 0; point <
templateSize; point++) {
115 if ((i2 >= 0) && (j2 >= 0) && (i2 < I.
getHeight() - 1) && (j2 < I.
getWidth() - 1)) {
127 double *tempt =
new double[
nbParam];
128 for (
unsigned int it = 0; it <
nbParam; it++)
129 tempt[it] =
dW[0][it] * dIWx +
dW[1][it] * dIWy;
131 double prod = (Tij - moyTij);
133 double d_Ixx = dIxx.
getValue(i2, j2);
134 double d_Iyy = dIyy.
getValue(i2, j2);
135 double d_Ixy = dIxy.
getValue(i2, j2);
137 for (
unsigned int it = 0; it <
nbParam; it++)
138 for (
unsigned int jt = 0; jt <
nbParam; jt++)
139 Hdesire[it][jt] += prod * (
dW[0][it] * (
dW[0][jt] * d_Ixx +
dW[1][jt] * d_Ixy) +
140 dW[1][it] * (
dW[0][jt] * d_Ixy +
dW[1][jt] * d_Iyy));
141 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;
179 Warp->computeCoeff(
p);
183 for (
unsigned int point = 0; point <
templateSize; point++) {
194 if ((i2 >= 0) && (j2 >= 0) && (i2 < I.
getHeight() - 1) && (j2 < I.
getWidth() - 1)) {
212 moyTij = moyTij / Nbpoint;
213 moyIW = moyIW / Nbpoint;
214 for (
unsigned int point = 0; point <
templateSize; point++) {
225 if ((i2 >= 0) && (j2 >= 0) && (i2 < I.
getHeight() - 1) && (j2 < I.
getWidth() - 1)) {
237 double *tempt =
new double[
nbParam];
238 for (
unsigned int it = 0; it <
nbParam; it++)
239 tempt[it] =
dW[0][it] * dIWx +
dW[1][it] * dIWy;
241 double prod = (Tij - moyTij);
242 for (
unsigned int it = 0; it <
nbParam; it++)
243 G[it] += prod * tempt[it];
245 double er = (Tij - IW);
247 denom += (Tij - moyTij) * (Tij - moyTij) * (IW - moyIW) * (IW - moyIW);
270 if (iteration == 0) {
275 evolRMS_delta = std::fabs(
evolRMS - evolRMS_prec);
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)
virtual void warpX(const int &i, const int &j, double &i2, double &j2, const vpColVector &ParamM)=0
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)
vpTemplateTrackerZNCCForwardAdditional(vpTemplateTrackerWarp *warp)
vpTemplateTrackerWarp * Warp
static void computeHLM(const vpMatrix &H, const double &alpha, vpMatrix &HLM)
unsigned int getWidth() const
virtual void dWarp(const vpColVector &X1, const vpColVector &X2, const vpColVector &ParamM, vpMatrix &dW)=0