37#include <visp3/core/vpImageFilter.h>
38#include <visp3/tt/vpTemplateTrackerZNCCForwardAdditional.h>
61 Warp->computeCoeff(
p);
62 double IW, dIWx, dIWy;
71 double *tempt =
new double[
nbParam];
73 for (
unsigned int point = 0; point <
templateSize; point++) {
86 if ((i2 >= 0) && (j2 >= 0) && (i2 < I.getHeight() - 1) && (j2 < I.getWidth() - 1)) {
90 IW = I.getValue(i2, j2);
92 IW =
BI.getValue(i2, j2);
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)) {
119 IW = I.getValue(i2, j2);
121 IW =
BI.getValue(i2, j2);
123 dIWx =
dIx.getValue(i2, j2);
124 dIWy =
dIy.getValue(i2, j2);
127 for (
unsigned int it = 0; it <
nbParam; it++)
128 tempt[it] =
dW[0][it] * dIWx +
dW[1][it] * dIWy;
130 double prod = (Tij - moyTij);
132 double d_Ixx = dIxx.
getValue(i2, j2);
133 double d_Iyy = dIyy.
getValue(i2, j2);
134 double d_Ixy = dIxy.
getValue(i2, j2);
136 for (
unsigned int it = 0; it <
nbParam; it++)
137 for (
unsigned int jt = 0; jt <
nbParam; jt++)
138 Hdesire[it][jt] += prod * (
dW[0][it] * (
dW[0][jt] * d_Ixx +
dW[1][jt] * d_Ixy) +
139 dW[1][it] * (
dW[0][jt] * d_Ixy +
dW[1][jt] * d_Iyy));
140 denom += (Tij - moyTij) * (Tij - moyTij) * (IW - moyIW) * (IW - moyIW);
159 double IW, dIWx, dIWy;
161 unsigned int iteration = 0;
168 double evolRMS_init = 0;
169 double evolRMS_prec = 0;
170 double evolRMS_delta;
171 double *tempt =
new double[
nbParam];
178 Warp->computeCoeff(
p);
182 for (
unsigned int point = 0; point <
templateSize; point++) {
193 if ((i2 >= 0) && (j2 >= 0) && (i2 < I.getHeight() - 1) && (j2 < I.getWidth() - 1)) {
197 IW = I.getValue(i2, j2);
199 IW =
BI.getValue(i2, j2);
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)) {
229 IW = I.getValue(i2, j2);
231 IW =
BI.getValue(i2, j2);
233 dIWx =
dIx.getValue(i2, j2);
234 dIWy =
dIy.getValue(i2, j2);
237 for (
unsigned int it = 0; it <
nbParam; it++)
238 tempt[it] =
dW[0][it] * dIWx +
dW[1][it] * dIWy;
240 double prod = (Tij - moyTij);
241 for (
unsigned int it = 0; it <
nbParam; it++)
242 G[it] += prod * tempt[it];
244 double er = (Tij - IW);
246 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 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)
Definition of the vpImage class member functions.
Type getValue(unsigned int i, unsigned int j) const
static void computeHLM(const vpMatrix &H, const double &alpha, vpMatrix &HLM)
void trackNoPyr(const vpImage< unsigned char > &I)
void initHessienDesired(const vpImage< unsigned char > &I)
VP_EXPLICIT vpTemplateTrackerZNCCForwardAdditional(vpTemplateTrackerWarp *warp)
VP_EXPLICIT vpTemplateTrackerZNCC(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