39 #include <visp3/core/vpImageFilter.h>
40 #include <visp3/tt/vpTemplateTrackerSSDForwardCompositional.h>
49 for (
unsigned int point = 0; point <
templateSize; point++) {
66 std::cout <<
"Compositionnal tracking not initialised.\nUse initCompo() function." << std::endl;
78 double IW, dIWx, dIWy;
80 unsigned int iteration = 0;
87 double evolRMS_init = 0;
88 double evolRMS_prec = 0;
90 double *tempt =
new double[
nbParam];
93 unsigned int Nbpoint = 0;
97 Warp->computeCoeff(
p);
98 for (
unsigned int point = 0; point <
templateSize; point++) {
109 if ((i2 >= 0) && (j2 >= 0) && (i2 < I.
getHeight() - 1) && (j2 < I.
getWidth() - 1)) {
121 for (
unsigned int it = 0; it <
nbParam; it++)
122 tempt[it] =
dW[0][it] * dIWx +
dW[1][it] * dIWy;
124 for (
unsigned int it = 0; it <
nbParam; it++)
125 for (
unsigned int jt = 0; jt <
nbParam; jt++)
126 H[it][jt] += tempt[it] * tempt[jt];
128 double er = (Tij - IW);
129 for (
unsigned int it = 0; it <
nbParam; it++)
130 G[it] += er * tempt[it];
160 if (iteration == 0) {
165 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)
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 dWarpCompo(const vpColVector &X1, const vpColVector &X2, const vpColVector &p, const double *dwdp0, vpMatrix &dM)=0
virtual void getdWdp0(const int &v, const int &u, double *dIdW)=0
virtual void warpX(const int &v1, const int &u1, double &v2, double &u2, const vpColVector &p)=0
virtual void pRondp(const vpColVector &p1, const vpColVector &p2, vpColVector &p12) const =0
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.