39 #include <visp3/core/vpImageFilter.h>
40 #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);
272 if (iteration == 0) {
277 evolRMS_delta = std::fabs(
evolRMS - evolRMS_prec);
error that can be emitted by ViSP classes.
@ divideByZeroError
Division by zero.
static void getGradX(const vpImage< unsigned char > &I, vpImage< FilterType > &dIx, const vpImage< bool > *p_mask=nullptr)
static void getGradXGauss2D(const vpImage< ImageType > &I, vpImage< FilterType > &dIx, const FilterType *gaussianKernel, const FilterType *gaussianDerivativeKernel, unsigned int size, const vpImage< bool > *p_mask=nullptr)
static void filter(const vpImage< ImageType > &I, vpImage< FilterType > &If, const vpArray2D< FilterType > &M, bool convolve=false, const vpImage< bool > *p_mask=nullptr)
static void getGradYGauss2D(const vpImage< ImageType > &I, vpImage< FilterType > &dIy, const FilterType *gaussianKernel, const FilterType *gaussianDerivativeKernel, unsigned int size, const vpImage< bool > *p_mask=nullptr)
static void getGradY(const vpImage< unsigned char > &I, vpImage< FilterType > &dIy, const vpImage< bool > *p_mask=nullptr)
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
void trackNoPyr(const vpImage< unsigned char > &I)
void initHessienDesired(const vpImage< unsigned char > &I)
VP_EXPLICIT vpTemplateTrackerZNCCForwardAdditional(vpTemplateTrackerWarp *warp)
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