39 #include <visp3/core/vpImageFilter.h>
40 #include <visp3/tt/vpTemplateTrackerZNCCForwardAdditional.h>
62 Warp->computeCoeff(
p);
63 double IW, dIWx, dIWy;
72 double *tempt =
new double[
nbParam];
74 for (
unsigned int point = 0; point <
templateSize; point++) {
87 if ((i2 >= 0) && (j2 >= 0) && (i2 < I.
getHeight() - 1) && (j2 < I.
getWidth() - 1)) {
100 moyTij = moyTij / Nbpoint;
101 moyIW = moyIW / Nbpoint;
103 for (
unsigned int point = 0; point <
templateSize; point++) {
116 if ((i2 >= 0) && (j2 >= 0) && (i2 < I.
getHeight() - 1) && (j2 < I.
getWidth() - 1)) {
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);
160 double IW, dIWx, dIWy;
162 unsigned int iteration = 0;
169 double evolRMS_init = 0;
170 double evolRMS_prec = 0;
171 double evolRMS_delta;
172 double *tempt =
new double[
nbParam];
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)) {
213 moyTij = moyTij / Nbpoint;
214 moyIW = moyIW / Nbpoint;
215 for (
unsigned int point = 0; point <
templateSize; point++) {
226 if ((i2 >= 0) && (j2 >= 0) && (i2 < I.
getHeight() - 1) && (j2 < I.
getWidth() - 1)) {
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);
error that can be emitted by ViSP classes.
@ divideByZeroError
Division by zero.
static void getGradYGauss2D(const vpImage< ImageType > &I, vpImage< FilterType > &dIy, const FilterType *gaussianKernel, const FilterType *gaussianDerivativeKernel, unsigned int size)
static void filter(const vpImage< ImageType > &I, vpImage< FilterType > &If, const vpArray2D< FilterType > &M, bool convolve=false)
static void getGradXGauss2D(const vpImage< ImageType > &I, vpImage< FilterType > &dIx, const FilterType *gaussianKernel, const FilterType *gaussianDerivativeKernel, unsigned int size)
static void getGradX(const vpImage< unsigned char > &I, vpImage< FilterType > &dIx)
static void getGradY(const vpImage< unsigned char > &I, vpImage< FilterType > &dIy)
unsigned int getWidth() const
Type getValue(unsigned int i, unsigned int j) const
unsigned int getHeight() const
vpMatrix inverseByLU() const
static void computeHLM(const vpMatrix &H, const double &alpha, vpMatrix &HLM)
virtual void dWarp(const vpColVector &X1, const vpColVector &X2, const vpColVector &p, vpMatrix &dM)=0
virtual void warpX(const int &v1, const int &u1, double &v2, double &u2, const vpColVector &p)=0
vpTemplateTrackerZNCCForwardAdditional(vpTemplateTrackerWarp *warp)
void trackNoPyr(const vpImage< unsigned char > &I)
void initHessienDesired(const vpImage< unsigned char > &I)
vpMatrix HLMdesireInverse
void computeEvalRMS(const vpColVector &p)
void computeOptimalBrentGain(const vpImage< unsigned char > &I, vpColVector &tp, double tMI, vpColVector &direction, double &alpha)
unsigned int iterationMax
void initPosEvalRMS(const vpColVector &p)
vpTemplateTrackerPoint * ptTemplate
vpTemplateTrackerWarp * Warp
unsigned int templateSize