42 #include <visp3/core/vpImageTools.h>
43 #include <visp3/tt/vpTemplateTrackerSSDForwardAdditional.h>
62 double IW, dIWx, dIWy;
64 unsigned int iteration = 0;
71 double evolRMS_init = 0;
72 double evolRMS_prec = 0;
74 double *tempt =
new double[
nbParam];
77 unsigned int Nbpoint = 0;
81 Warp->computeCoeff(
p);
82 for (
unsigned int point = 0; point <
templateSize; point++) {
93 if ((i2 >= 0) && (j2 >= 0) && (i2 < I.
getHeight() - 1) && (j2 < I.
getWidth() - 1)) {
106 for (
unsigned int it = 0; it <
nbParam; it++)
107 tempt[it] =
dW[0][it] * dIWx +
dW[1][it] * dIWy;
109 for (
unsigned int it = 0; it <
nbParam; it++)
110 for (
unsigned int jt = 0; jt <
nbParam; jt++)
111 H[it][jt] += tempt[it] * tempt[jt];
113 double er = (Tij - IW);
114 for (
unsigned int it = 0; it <
nbParam; it++)
115 G[it] += er * tempt[it];
134 switch (minimizationMethod) {
139 double erreur_LMA = -
getCost(I, p_test_LMA);
140 if (erreur_LMA < erreur) {
142 lambda = (lambda / 10. < 1e-6) ? lambda / 10. : 1e-6;
145 lambda = (lambda * 10. < 1e6) ? 1e6 : lambda * 10.;
163 double s_scal_y = s_quasi.
t() * y_quasi;
164 if (std::fabs(s_scal_y) > std::numeric_limits<double>::epsilon())
165 KQuasiNewton = KQuasiNewton + 0.001 * (s_quasi * s_quasi.
t() / s_scal_y -
166 KQuasiNewton * y_quasi * y_quasi.
t() * KQuasiNewton /
167 (y_quasi.
t() * KQuasiNewton * y_quasi));
169 dp = -KQuasiNewton *
G;
190 if (iteration == 0) {
197 evolRMS_delta = std::fabs(
evolRMS - evolRMS_prec);
Implementation of column vector and the associated operations.
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 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 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 iterationGlobale
unsigned int templateSize
Error that can be emitted by the vpTracker class and its derivatives.
@ notEnoughPointError
Not enough point to track.