 |
Visual Servoing Platform
version 3.3.0
|
41 #include <visp3/tt_mi/vpTemplateTrackerMIForwardAdditional.h>
43 #ifdef VISP_HAVE_OPENMP
48 :
vpTemplateTrackerMI(_warp), minimizationMethod(USE_NEWTON), p_prec(), G_prec(), KQuasiNewton()
72 Warp->computeCoeff(
p);
73 for (
unsigned int point = 0; point <
templateSize; point++) {
87 if ((i2 >= 0) && (j2 >= 0) && (i2 < I.
getHeight() - 1) && (j2 < I.
getWidth() - 1)) {
98 ct =
static_cast<int>((IW * (
Nc - 1)) / 255.);
99 cr =
static_cast<int>((Tij * (
Nc - 1)) / 255.);
100 et = (IW * (
Nc - 1)) / 255. - ct;
101 er = (
static_cast<double>(Tij) * (
Nc - 1)) / 255. - cr;
104 double *tptemp =
new double[
nbParam];
105 for (
unsigned int it = 0; it <
nbParam; it++)
106 tptemp[it] =
dW[0][it] * dx +
dW[1][it] * dy;
142 double MI = 0, MIprec = -1000;
148 unsigned int iteration = 0;
151 double evolRMS_init = 0;
152 double evolRMS_prec = 0;
153 double evolRMS_delta;
156 if (iteration % 5 == 0)
165 Warp->computeCoeff(
p);
166 #ifdef VISP_HAVE_OPENMP
167 int nthreads = omp_get_num_procs();
170 omp_set_num_threads(nthreads);
171 #pragma omp parallel for default(shared)
173 for (
int point = 0; point < (int)
templateSize; point++) {
185 if ((i2 >= 0) && (j2 >= 0) && (i2 < I.
getHeight() - 1) && (j2 < I.
getWidth() - 1)) {
197 int ct = (int)((IW * (
Nc - 1)) / 255.);
198 int cr = (int)((Tij * (
Nc - 1)) / 255.);
199 double et = (IW * (
Nc - 1)) / 255. - ct;
200 double er = ((double)Tij * (
Nc - 1)) / 255. - cr;
204 double *tptemp =
new double[
nbParam];
206 for (
unsigned int it = 0; it <
nbParam; it++)
207 tptemp[it] = (
dW[0][it] * dx +
dW[1][it] * dy);
248 switch (minimizationMethod) {
252 p_test_LMA =
p - 100000.1 *
dp;
256 double MI_LMA = -
getCost(I, p_test_LMA);
279 double s_scal_y = s_quasi.
t() * y_quasi;
280 if (std::fabs(s_scal_y) > std::numeric_limits<double>::epsilon()) {
281 KQuasiNewton = KQuasiNewton + 0.001 * (s_quasi * s_quasi.
t() / s_scal_y -
282 KQuasiNewton * y_quasi * y_quasi.
t() * KQuasiNewton /
283 (y_quasi.
t() * KQuasiNewton * y_quasi));
286 dp = -KQuasiNewton *
G;
308 if (iteration == 0) {
314 evolRMS_delta = std::fabs(
evolRMS - evolRMS_prec);
317 }
while ((std::fabs(MI - MIprec) > std::fabs(MI) * std::numeric_limits<double>::epsilon()) &&
Error that can be emited by the vpTracker class and its derivates.
void initHessienDesired(const vpImage< unsigned char > &I)
void initPosEvalRMS(const vpColVector &p)
vpTemplateTrackerPoint * ptTemplate
static void filter(const vpImage< double > &I, vpImage< double > &Iu, vpImage< double > &Iv, const vpMatrix &M, bool convolve=false)
void computeProba(int &nbpoint)
void computeOptimalBrentGain(const vpImage< unsigned char > &I, vpColVector &tp, double tMI, vpColVector &direction, double &alpha)
void trackNoPyr(const vpImage< unsigned char > &I)
unsigned int getHeight() const
virtual void dWarp(const vpColVector &X1, const vpColVector &X2, const vpColVector &ParamM, vpMatrix &dW)=0
void computeMI(double &MI)
static void getGradYGauss2D(const vpImage< unsigned char > &I, vpImage< double > &dIy, const double *gaussianKernel, const double *gaussianDerivativeKernel, unsigned int size)
virtual void warpX(const int &i, const int &j, double &i2, double &j2, const vpColVector &ParamM)=0
unsigned int templateSize
double cond(double svThreshold=1e-6) const
void computeEvalRMS(const vpColVector &p)
Implementation of column vector and the associated operations.
unsigned int getWidth() const
unsigned int iterationMax
vpMatrix HLMdesireInverse
vpTemplateTrackerMIForwardAdditional()
Default constructor.
vpMatrix inverseByLU() const
vpHessienApproximationType ApproxHessian
unsigned int iterationGlobale
Type getValue(unsigned int i, unsigned int j) const
double getCost(const vpImage< unsigned char > &I, const vpColVector &tp)
static void computeHLM(const vpMatrix &H, const double &alpha, vpMatrix &HLM)
vpHessienType hessianComputation
error that can be emited by ViSP classes.
void computeHessien(vpMatrix &H)
vpTemplateTrackerWarp * Warp
static void getGradXGauss2D(const vpImage< unsigned char > &I, vpImage< double > &dIx, const double *gaussianKernel, const double *gaussianDerivativeKernel, unsigned int size)