37#include <visp3/core/vpImageFilter.h>
38#include <visp3/tt/vpTemplateTrackerSSDForwardCompositional.h>
47 for (
unsigned int point = 0; point <
templateSize; point++) {
64 std::cout <<
"Compositionnal tracking not initialised.\nUse initCompo() function." << std::endl;
76 double IW, dIWx, dIWy;
78 unsigned int iteration = 0;
85 double evolRMS_init = 0;
86 double evolRMS_prec = 0;
88 double *tempt =
new double[
nbParam];
91 unsigned int Nbpoint = 0;
95 Warp->computeCoeff(
p);
96 for (
unsigned int point = 0; point <
templateSize; point++) {
107 if ((i2 >= 0) && (j2 >= 0) && (i2 < I.getHeight() - 1) && (j2 < I.getWidth() - 1)) {
110 IW = I.getValue(i2, j2);
112 IW =
BI.getValue(i2, j2);
113 dIWx =
dIx.getValue(i2, j2);
114 dIWy =
dIy.getValue(i2, j2);
119 for (
unsigned int it = 0; it <
nbParam; it++)
120 tempt[it] =
dW[0][it] * dIWx +
dW[1][it] * dIWy;
122 for (
unsigned int it = 0; it <
nbParam; it++)
123 for (
unsigned int jt = 0; jt <
nbParam; jt++)
124 H[it][jt] += tempt[it] * tempt[jt];
126 double er = (Tij - IW);
127 for (
unsigned int it = 0; it <
nbParam; it++)
128 G[it] += er * tempt[it];
141 dp =
HLM.inverseByLU() *
G;
158 if (iteration == 0) {
163 evolRMS_delta = std::fabs(
evolRMS - evolRMS_prec);
error that can be emitted by ViSP classes.
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)
Definition of the vpImage class member functions.
static void computeHLM(const vpMatrix &H, const double &alpha, vpMatrix &HLM)
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
Error that can be emitted by the vpTracker class and its derivatives.
@ notEnoughPointError
Not enough point to track.