Visual Servoing Platform  version 3.5.1 under development (2023-03-14)
vpTemplateTracker.cpp
1 /****************************************************************************
2  *
3  * ViSP, open source Visual Servoing Platform software.
4  * Copyright (C) 2005 - 2019 by Inria. All rights reserved.
5  *
6  * This software is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  * See the file LICENSE.txt at the root directory of this source
11  * distribution for additional information about the GNU GPL.
12  *
13  * For using ViSP with software that can not be combined with the GNU
14  * GPL, please contact Inria about acquiring a ViSP Professional
15  * Edition License.
16  *
17  * See http://visp.inria.fr for more information.
18  *
19  * This software was developed at:
20  * Inria Rennes - Bretagne Atlantique
21  * Campus Universitaire de Beaulieu
22  * 35042 Rennes Cedex
23  * France
24  *
25  * If you have questions regarding the use of this file, please contact
26  * Inria at visp@inria.fr
27  *
28  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
29  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
30  *
31  * Description:
32  * Template tracker.
33  *
34  * Authors:
35  * Amaury Dame
36  * Aurelien Yol
37  * Fabien Spindler
38  *
39  *****************************************************************************/
40 
41 #include <visp3/tt/vpTemplateTracker.h>
42 #include <visp3/tt/vpTemplateTrackerBSpline.h>
43 
45  : nbLvlPyr(1), l0Pyr(0), pyrInitialised(false), evolRMS(0), x_pos(), y_pos(), evolRMS_eps(1e-4), ptTemplate(NULL),
46  ptTemplatePyr(NULL), ptTemplateInit(false), templateSize(0), templateSizePyr(NULL), ptTemplateSelect(NULL),
47  ptTemplateSelectPyr(NULL), ptTemplateSelectInit(false), templateSelectSize(0), ptTemplateSupp(NULL),
48  ptTemplateSuppPyr(NULL), ptTemplateCompo(NULL), ptTemplateCompoPyr(NULL), zoneTracked(NULL), zoneTrackedPyr(NULL),
49  pyr_IDes(NULL), H(), Hdesire(), HdesirePyr(), HLM(), HLMdesire(), HLMdesirePyr(), HLMdesireInverse(),
50  HLMdesireInversePyr(), G(), gain(1.), thresholdGradient(40), costFunctionVerification(false), blur(true),
51  useBrent(false), nbIterBrent(3), taillef(7), fgG(NULL), fgdG(NULL), ratioPixelIn(0), mod_i(1), mod_j(1), nbParam(0),
52  lambdaDep(0.001), iterationMax(30), iterationGlobale(0), diverge(false), nbIteration(0), useCompositionnal(true),
53  useInverse(false), Warp(_warp), p(0), dp(), X1(), X2(), dW(), BI(), dIx(), dIy(), zoneRef_()
54 {
55  nbParam = Warp->getNbParam();
56  p.resize(nbParam);
57  dp.resize(nbParam);
58 
59  fgG = new double[(taillef + 1) / 2];
61 
62  fgdG = new double[(taillef + 1) / 2];
64 }
65 
66 void vpTemplateTracker::setGaussianFilterSize(unsigned int new_taill)
67 {
68  taillef = new_taill;
69  if (fgG)
70  delete[] fgG;
71  fgG = new double[taillef];
73 
74  if (fgdG)
75  delete[] fgdG;
76  fgdG = new double[taillef];
78 }
79 
81 {
82  zoneTracked = &zone;
83 
84  int largeur_im = (int)I.getWidth();
85  int hauteur_im = (int)I.getHeight();
86 
87  unsigned int NbPointDsZone = 0;
88  int mod_fi, mod_fj;
89  mod_fi = mod_i;
90  mod_fj = mod_i;
91 
92  for (int i = 0; i < hauteur_im; i += mod_fi) {
93  for (int j = 0; j < largeur_im; j += mod_fj) {
94  if (zone.inZone(i, j)) {
95  NbPointDsZone++;
96  }
97  }
98  }
99 
100  templateSize = NbPointDsZone;
102  ptTemplateInit = true;
103  ptTemplateSelect = new bool[templateSize];
104  ptTemplateSelectInit = true;
105 
108 
110  vpImage<double> GaussI;
111  vpImageFilter::filter(I, GaussI, fgG, taillef);
114 
115  unsigned int cpt_point = 0;
116  templateSelectSize = 0;
117  for (int i = 0; i < hauteur_im; i += mod_i) {
118  for (int j = 0; j < largeur_im; j += mod_j) {
119  if (zone.inZone(i, j)) {
120  pt.x = j;
121  pt.y = i;
122 
123  pt.dx = dIx[i][j];
124  pt.dy = dIy[i][j];
125 
126  if (pt.dx * pt.dx + pt.dy * pt.dy > thresholdGradient) {
127  ptTemplateSelect[cpt_point] = true;
129  } else {
130  ptTemplateSelect[cpt_point] = false;
131  }
132  pt.val = vpTemplateTrackerBSpline::getSubPixBspline4(GaussI, i, j);
133 
134  ptTemplate[cpt_point] = pt;
135  cpt_point++;
136  }
137  }
138  }
139 
140  templateSize = cpt_point;
141  GaussI.destroy();
142 }
143 
145 {
146  delete[] fgG;
147  delete[] fgdG;
148 
149  resetTracker();
150 }
151 
157 {
158  // reset the tracker parameters
159  p = 0;
160 
161  if (pyrInitialised) {
162  if (ptTemplatePyr) {
163  for (unsigned int i = 0; i < nbLvlPyr; i++) {
164  if (ptTemplatePyr[i]) {
165  for (unsigned int point = 0; point < templateSizePyr[i]; point++) {
166  delete[] ptTemplatePyr[i][point].dW;
167  delete[] ptTemplatePyr[i][point].HiG;
168  }
169  delete[] ptTemplatePyr[i];
170  }
171  }
172  delete[] ptTemplatePyr;
173  ptTemplatePyr = NULL;
174  }
175 
176  if (ptTemplateCompoPyr) {
177  for (unsigned int i = 0; i < nbLvlPyr; i++) {
178  if (ptTemplateCompoPyr[i]) {
179  for (unsigned int point = 0; point < templateSizePyr[i]; point++) {
180  delete[] ptTemplateCompoPyr[i][point].dW;
181  }
182  delete[] ptTemplateCompoPyr[i];
183  }
184  }
185  delete[] ptTemplateCompoPyr;
186  ptTemplateCompoPyr = NULL;
187  }
188 
189  if (ptTemplateSuppPyr) {
190  for (unsigned int i = 0; i < nbLvlPyr; i++) {
191  if (ptTemplateSuppPyr[i]) {
192  for (unsigned int point = 0; point < templateSizePyr[i]; point++) {
193  delete[] ptTemplateSuppPyr[i][point].Bt;
194  delete[] ptTemplateSuppPyr[i][point].BtInit;
195  delete[] ptTemplateSuppPyr[i][point].dBt;
196  delete[] ptTemplateSuppPyr[i][point].d2W;
197  delete[] ptTemplateSuppPyr[i][point].d2Wx;
198  delete[] ptTemplateSuppPyr[i][point].d2Wy;
199  }
200  delete[] ptTemplateSuppPyr[i];
201  }
202  }
203  delete[] ptTemplateSuppPyr;
204  ptTemplateSuppPyr = NULL;
205  }
206 
207  if (ptTemplateSelectPyr) {
208  for (unsigned int i = 0; i < nbLvlPyr; i++) {
209  if (ptTemplateSelectPyr[i])
210  delete[] ptTemplateSelectPyr[i];
211  }
212  delete[] ptTemplateSelectPyr;
213  ptTemplateSelectPyr = NULL;
214  }
215 
216  if (templateSizePyr) {
217  delete[] templateSizePyr;
218  templateSizePyr = NULL;
219  }
220 
221  if (HdesirePyr) {
222  delete[] HdesirePyr;
223  HdesirePyr = NULL;
224  }
225 
226  if (HLMdesirePyr) {
227  delete[] HLMdesirePyr;
228  HLMdesirePyr = NULL;
229  }
230 
231  if (HLMdesireInversePyr) {
232  delete[] HLMdesireInversePyr;
233  HLMdesireInversePyr = NULL;
234  }
235 
236  if (zoneTrackedPyr) {
237  delete[] zoneTrackedPyr;
238  zoneTrackedPyr = NULL;
239  }
240 
241  if (pyr_IDes) {
242  delete[] pyr_IDes;
243  pyr_IDes = NULL;
244  }
245  } else {
246  if (ptTemplateInit) {
247  for (unsigned int point = 0; point < templateSize; point++) {
248  delete[] ptTemplate[point].dW;
249  delete[] ptTemplate[point].HiG;
250  }
251  delete[] ptTemplate;
252  ptTemplate = NULL;
253  ptTemplateInit = false;
254  }
255  if (ptTemplateCompo) {
256  for (unsigned int point = 0; point < templateSize; point++) {
257  delete[] ptTemplateCompo[point].dW;
258  }
259  delete[] ptTemplateCompo;
260  ptTemplateCompo = NULL;
261  }
262  if (ptTemplateSupp) {
263  for (unsigned int point = 0; point < templateSize; point++) {
264  delete[] ptTemplateSupp[point].Bt;
265  delete[] ptTemplateSupp[point].BtInit;
266  delete[] ptTemplateSupp[point].dBt;
267  delete[] ptTemplateSupp[point].d2W;
268  delete[] ptTemplateSupp[point].d2Wx;
269  delete[] ptTemplateSupp[point].d2Wy;
270  }
271  delete[] ptTemplateSupp;
272  ptTemplateSupp = NULL;
273  }
274  if (ptTemplateSelectInit) {
275  if (ptTemplateSelect) {
276  delete[] ptTemplateSelect;
277  ptTemplateSelect = NULL;
278  }
279  }
280  }
281 }
282 
316 void vpTemplateTracker::display(const vpImage<unsigned char> &I, const vpColor &col, unsigned int thickness)
317 {
318  if (I.display) { // Only if a display is associated to the image
319  vpTemplateTrackerZone zoneWarped;
320  Warp->warpZone(*zoneTracked, p, zoneWarped);
321  zoneWarped.display(I, col, thickness);
322  }
323 }
324 
358 void vpTemplateTracker::display(const vpImage<vpRGBa> &I, const vpColor &col, unsigned int thickness)
359 {
360  if (I.display) { // Only if a display is associated to the image
361  vpTemplateTrackerZone zoneWarped;
362  Warp->warpZone(*zoneTracked, p, zoneWarped);
363  zoneWarped.display(I, col, thickness);
364  }
365 }
366 
368  vpColVector &direction, double &alpha)
369 {
370  vpColVector **ptp;
371  ptp = new vpColVector *[4];
372  vpColVector p0(nbParam);
373  p0 = tp;
374 
375  // valeur necessaire si conditionnel
376  vpColVector dpt(Warp->getNbParam());
377  vpColVector adpt(Warp->getNbParam());
378 
379  vpColVector p1(nbParam);
380  if (useCompositionnal) {
381  if (useInverse)
382  Warp->getParamInverse(direction, dpt);
383  else
384  dpt = direction;
385  Warp->pRondp(tp, dpt, p1);
386  } else {
387  p1 = tp + direction;
388  }
389 
390  vpColVector p2(nbParam);
391  if (useCompositionnal) {
392  adpt = alpha * direction;
393  if (useInverse)
394  Warp->getParamInverse(adpt, dpt);
395  else
396  dpt = adpt;
397  Warp->pRondp(tp, dpt, p2);
398  } else {
399  p2 = tp + alpha * direction;
400  }
401  vpColVector p3(nbParam);
402  ptp[0] = &p0;
403  ptp[1] = &p1;
404  ptp[2] = &p2;
405  ptp[3] = &p3;
406 
407  double *Cost = new double[4];
408  Cost[0] = tMI;
409  Cost[1] = getCost(I, p1);
410  Cost[2] = getCost(I, p2);
411 
412  double *talpha = new double[4];
413  talpha[0] = 0;
414  talpha[1] = 1.;
415  talpha[2] = alpha;
416 
417  // Utilise trois estimees de paraboles successive ...
418  // A changer pour rendre adaptable
419  for (unsigned int opt = 0; opt < nbIterBrent; opt++) {
420  vpMatrix A(3, 3);
421  for (unsigned int i = 0; i < 3; i++) {
422  A[i][0] = talpha[i] * talpha[i];
423  A[i][1] = talpha[i];
424  A[i][2] = 1.;
425  }
426  vpColVector B(3);
427  for (unsigned int i = 0; i < 3; i++)
428  B[i] = Cost[i];
429  vpColVector parabol(3);
430  parabol = (A.t() * A).inverseByLU() * A.t() * B;
431 
432  // If convexe
433  if (parabol[0] > 0) {
434  talpha[3] = -0.5 * parabol[1] / parabol[0];
435  } else { // If concave
436  int tindic_x_min = 0;
437  int tindic_x_max = 0;
438  for (int i = 1; i < 3; i++) {
439  if (talpha[i] < talpha[tindic_x_min])
440  tindic_x_min = i;
441  if (talpha[i] > talpha[tindic_x_max])
442  tindic_x_max = i;
443  }
444 
445  if (Cost[tindic_x_max] < Cost[tindic_x_min]) {
446  talpha[3] = talpha[tindic_x_max] + 1.;
447  } else {
448  talpha[3] = talpha[tindic_x_min] - 1.;
449  }
450  }
451  int indic_x_min = 0;
452  int indic_x_max = 0;
453  for (int i = 1; i < 3; i++) {
454  if (talpha[i] < talpha[indic_x_min])
455  indic_x_min = i;
456  if (talpha[i] > talpha[indic_x_max])
457  indic_x_max = i;
458  }
459  if (talpha[3] > talpha[indic_x_max])
460  if ((talpha[3] - talpha[indic_x_max]) > alpha)
461  talpha[3] = talpha[indic_x_max] + 4.;
462  if (talpha[3] < talpha[indic_x_min])
463  if ((talpha[indic_x_min] - talpha[3]) > alpha)
464  talpha[3] = talpha[indic_x_min] - 4.;
465 
466  if (useCompositionnal) {
467  adpt = talpha[3] * direction;
468  if (useInverse)
469  Warp->getParamInverse(adpt, dpt);
470  else
471  dpt = adpt;
472  Warp->pRondp(tp, dpt, p3);
473  } else {
474  p3 = tp + talpha[3] * direction;
475  }
476 
477  Cost[3] = getCost(I, p3);
478 
479  int indice_f_max = 0;
480  for (int i = 1; i < 4; i++)
481  if (Cost[i] > Cost[indice_f_max])
482  indice_f_max = i;
483  if (indice_f_max != 3) {
484  *ptp[indice_f_max] = *ptp[3];
485  Cost[indice_f_max] = Cost[3];
486  talpha[indice_f_max] = talpha[3];
487  } else
488  break;
489  }
490 
491  int indice_f_min = 0;
492  for (int i = 0; i < 4; i++)
493  if (Cost[i] < Cost[indice_f_min])
494  indice_f_min = i;
495 
496  alpha = talpha[indice_f_min];
497 
498  if (alpha < 1)
499  alpha = 1.;
500 
501  delete[] ptp;
502  delete[] Cost;
503  delete[] talpha;
504 }
505 
511 void vpTemplateTracker::initPyramidal(unsigned int nbLvl, unsigned int l0)
512 {
513  nbLvlPyr = nbLvl;
514  l0Pyr = l0;
515 
519  ptTemplateSelectPyr = new bool *[nbLvlPyr];
520  ptTemplateSuppPyr = new vpTemplateTrackerPointSuppMIInv *[nbLvlPyr];
522  for (unsigned int i = 0; i < nbLvlPyr; i++) {
523  ptTemplatePyr[i] = NULL;
524  ptTemplateSuppPyr[i] = NULL;
525  ptTemplateSelectPyr[i] = NULL;
526  ptTemplateCompoPyr[i] = NULL;
527  }
528  templateSizePyr = new unsigned int[nbLvlPyr];
532 
533  pyrInitialised = true;
534 }
535 
537 {
538  zoneTrackedPyr[0].copy(zone);
539 
540  pyr_IDes[0] = I;
545 
546  // creation pyramide de zones et images desiree
547  if (nbLvlPyr > 1) {
548  for (unsigned int i = 1; i < nbLvlPyr; i++) {
551 
556  }
557  }
559 }
560 
583 {
584  zoneRef_.initClick(I, delaunay);
585 
586  if (nbLvlPyr > 1) {
590  } else {
593  }
594 }
595 
607 void vpTemplateTracker::initFromPoints(const vpImage<unsigned char> &I, const std::vector<vpImagePoint> &v_ip,
608  bool delaunay)
609 {
610  zoneRef_.initFromPoints(I, v_ip, delaunay);
611 
612  if (nbLvlPyr > 1) {
616  } else {
619  }
620 }
621 
629 {
630  zoneRef_ = zone;
631 
632  if (nbLvlPyr > 1) {
636  } else {
639  }
640 }
641 
643 {
647  try {
649  ptTemplateSuppPyr[0] = ptTemplateSupp;
651  HdesirePyr[0] = Hdesire;
652  HLMdesirePyr[0] = HLMdesire;
654  } catch (const vpException &e) {
655  ptTemplateSuppPyr[0] = ptTemplateSupp;
657  HdesirePyr[0] = Hdesire;
658  HLMdesirePyr[0] = HLMdesire;
660  throw(e);
661  }
662 
663  if (nbLvlPyr > 1) {
665  Itemp = I;
666  for (unsigned int i = 1; i < nbLvlPyr; i++) {
667  vpImageFilter::getGaussPyramidal(Itemp, Itemp);
668 
672  try {
673  initHessienDesired(Itemp);
674  ptTemplateSuppPyr[i] = ptTemplateSupp;
676  HdesirePyr[i] = Hdesire;
677  HLMdesirePyr[i] = HLMdesire;
679  } catch (const vpException &e) {
680  ptTemplateSuppPyr[i] = ptTemplateSupp;
682  HdesirePyr[i] = Hdesire;
683  HLMdesirePyr[i] = HLMdesire;
685  throw(e);
686  }
687  }
688  }
689 }
690 
696 {
697  if (nbLvlPyr > 1)
698  trackPyr(I);
699  else
700  trackNoPyr(I);
701 }
702 
704 {
705  vpImage<unsigned char> *pyr_I;
706  pyr_I = new vpImage<unsigned char>[nbLvlPyr]; // Why +1 ?
707  pyr_I[0] = I;
708 
709  try {
710  vpColVector ptemp(nbParam);
711  if (nbLvlPyr > 1) {
712  for (unsigned int i = 1; i < nbLvlPyr; i++) {
713  vpImageFilter::getGaussPyramidal(pyr_I[i - 1], pyr_I[i]);
714  Warp->getParamPyramidDown(p, ptemp);
715  p = ptemp;
717  }
718 
719  for (int i = (int)nbLvlPyr - 1; i >= 0; i--) {
720  if (i >= (int)l0Pyr) {
724  ptTemplateSupp = ptTemplateSuppPyr[i];
726  H = HdesirePyr[i];
727  HLM = HLMdesirePyr[i];
729  trackRobust(pyr_I[i]);
730  }
731  if (i > 0) {
732  Warp->getParamPyramidUp(p, ptemp);
733  p = ptemp;
734  zoneTracked = &zoneTrackedPyr[i - 1];
735  }
736  }
737  } else {
738  trackRobust(I);
739  }
740  delete[] pyr_I;
741  } catch (const vpException &e) {
742  delete[] pyr_I;
744  }
745 }
746 
748 {
750  vpColVector p_pre_estimation;
751  p_pre_estimation = p;
753  double pre_fcost = getCost(I, p);
754 
755  trackNoPyr(I);
756 
757  double post_fcost = getCost(I, p);
758  if (pre_fcost < post_fcost) {
759  p = p_pre_estimation;
760  }
761  } else {
762  trackNoPyr(I);
763  }
764 }
765 
773 {
774  unsigned int nb_corners = zoneTracked->getNbTriangle() * 3;
775 
776  Warp->computeCoeff(param);
777  evolRMS = 0;
778  vpTemplateTrackerTriangle triangle;
779 
780  for (unsigned int i = 0; i < zoneTracked->getNbTriangle(); i++) {
781  zoneTracked->getTriangle(i, triangle);
782  for (unsigned int j = 0; j < 3; j++) {
783  triangle.getCorner(j, X1[0], X1[1]);
784 
785  Warp->computeDenom(X1, param);
786  Warp->warpX(X1, X2, param);
787 
788  unsigned int index = i * 3 + j;
789  double x_ = x_pos[index] - X2[0];
790  double y_ = y_pos[index] - X2[1];
791  evolRMS += x_ * x_ + y_ * y_;
792  x_pos[index] = X2[0];
793  y_pos[index] = X2[1];
794  }
795  }
796  evolRMS /= nb_corners;
797 }
798 
806 {
807  unsigned int nb_corners = zoneTracked->getNbTriangle() * 3;
808  x_pos.resize(nb_corners);
809  y_pos.resize(nb_corners);
810 
811  Warp->computeCoeff(param);
812  vpTemplateTrackerTriangle triangle;
813 
814  for (unsigned int i = 0; i < zoneTracked->getNbTriangle(); i++) {
815  unsigned int i3 = i * 3;
816  zoneTracked->getTriangle(i, triangle);
817  for (unsigned int j = 0; j < 3; j++) {
818  triangle.getCorner(j, X1[0], X1[1]);
819 
820  Warp->computeDenom(X1, param);
821  Warp->warpX(X1, X2, param);
822  x_pos[i3 + j] = X2[0];
823  y_pos[i3 + j] = X2[1];
824  }
825  }
826 }
void resize(unsigned int nrows, unsigned int ncols, bool flagNullify=true, bool recopy_=true)
Definition: vpArray2D.h:303
Implementation of column vector and the associated operations.
Definition: vpColVector.h:131
void resize(unsigned int i, bool flagNullify=true)
Definition: vpColVector.h:314
Class to define RGB colors available for display functionnalities.
Definition: vpColor.h:158
error that can be emited by ViSP classes.
Definition: vpException.h:72
@ badValue
Used to indicate that a value is not in the allowed range.
Definition: vpException.h:97
const char * getMessage() const
Definition: vpException.cpp:87
static void filter(const vpImage< double > &I, vpImage< double > &Iu, vpImage< double > &Iv, const vpMatrix &M, bool convolve=false)
static void getGradXGauss2D(const vpImage< unsigned char > &I, vpImage< double > &dIx, const double *gaussianKernel, const double *gaussianDerivativeKernel, unsigned int size)
static void getGaussianDerivativeKernel(double *filter, unsigned int size, double sigma=0., bool normalize=true)
static void getGaussianKernel(double *filter, unsigned int size, double sigma=0., bool normalize=true)
static void getGradYGauss2D(const vpImage< unsigned char > &I, vpImage< double > &dIy, const double *gaussianKernel, const double *gaussianDerivativeKernel, unsigned int size)
static void getGaussPyramidal(const vpImage< unsigned char > &I, vpImage< unsigned char > &GI)
void destroy()
Destructor : Memory de-allocation.
Definition: vpImage.h:829
unsigned int getWidth() const
Definition: vpImage.h:247
unsigned int getHeight() const
Definition: vpImage.h:189
vpDisplay * display
Definition: vpImage.h:145
Implementation of a matrix and operations on matrices.
Definition: vpMatrix.h:154
vpMatrix t() const
Definition: vpMatrix.cpp:462
vpColVector getCorner(unsigned int i) const
virtual void getParamPyramidUp(const vpColVector &p, vpColVector &p_up)=0
unsigned int getNbParam() const
virtual void getParamInverse(const vpColVector &p, vpColVector &p_inv) const =0
void warpZone(const vpTemplateTrackerZone &in, const vpColVector &p, vpTemplateTrackerZone &out)
virtual void warpX(const int &v1, const int &u1, double &v2, double &u2, const vpColVector &p)=0
virtual void getParamPyramidDown(const vpColVector &p, vpColVector &p_down)=0
virtual void pRondp(const vpColVector &p1, const vpColVector &p2, vpColVector &p12) const =0
vpTemplateTrackerZone getPyramidDown() const
void initFromPoints(const vpImage< unsigned char > &I, const std::vector< vpImagePoint > &ip, bool delaunay=false)
bool inZone(const int &i, const int &j) const
void getTriangle(unsigned int i, vpTemplateTrackerTriangle &T) const
unsigned int getNbTriangle() const
void copy(const vpTemplateTrackerZone &z)
void display(const vpImage< unsigned char > &I, const vpColor &col=vpColor::green, unsigned int thickness=3)
void initClick(const vpImage< unsigned char > &I, bool delaunay=false)
void display(const vpImage< unsigned char > &I, const vpColor &col=vpColor::green, unsigned int thickness=3)
vpImage< double > dIx
unsigned int nbIterBrent
void initTracking(const vpImage< unsigned char > &I, vpTemplateTrackerZone &zone)
vpImage< double > dIy
vpTemplateTracker()
Default constructor.
unsigned int templateSelectSize
virtual void initHessienDesiredPyr(const vpImage< unsigned char > &I)
vpTemplateTrackerPoint ** ptTemplatePyr
void initFromPoints(const vpImage< unsigned char > &I, const std::vector< vpImagePoint > &v_ip, bool delaunay=false)
void computeEvalRMS(const vpColVector &p)
unsigned int nbLvlPyr
virtual void trackNoPyr(const vpImage< unsigned char > &I)=0
unsigned int * templateSizePyr
void initFromZone(const vpImage< unsigned char > &I, const vpTemplateTrackerZone &zone)
vpTemplateTrackerZone * zoneTrackedPyr
void computeOptimalBrentGain(const vpImage< unsigned char > &I, vpColVector &tp, double tMI, vpColVector &direction, double &alpha)
vpTemplateTrackerZone zoneRef_
vpImage< unsigned char > * pyr_IDes
std::vector< double > y_pos
vpMatrix * HLMdesireInversePyr
std::vector< double > x_pos
virtual double getCost(const vpImage< unsigned char > &I, const vpColVector &tp)=0
void track(const vpImage< unsigned char > &I)
vpTemplateTrackerPointCompo ** ptTemplateCompoPyr
virtual void trackPyr(const vpImage< unsigned char > &I)
void getGaussianBluredImage(const vpImage< unsigned char > &I)
void initPosEvalRMS(const vpColVector &p)
virtual void initHessienDesired(const vpImage< unsigned char > &I)=0
vpTemplateTrackerPoint * ptTemplate
virtual void initTrackingPyr(const vpImage< unsigned char > &I, vpTemplateTrackerZone &zone)
virtual void initPyramidal(unsigned int nbLvl, unsigned int l0)
void setGaussianFilterSize(unsigned int new_taill)
vpTemplateTrackerWarp * Warp
void trackRobust(const vpImage< unsigned char > &I)
void initClick(const vpImage< unsigned char > &I, bool delaunay=false)
unsigned int templateSize
vpTemplateTrackerPointCompo * ptTemplateCompo
vpTemplateTrackerZone * zoneTracked
Error that can be emited by the vpTracker class and its derivates.