Visual Servoing Platform  version 3.6.1 under development (2024-02-13)
vpTemplateTracker.cpp
1 /****************************************************************************
2  *
3  * ViSP, open source Visual Servoing Platform software.
4  * Copyright (C) 2005 - 2023 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 https://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  *
38 *****************************************************************************/
39 
40 #include <visp3/tt/vpTemplateTracker.h>
41 #include <visp3/tt/vpTemplateTrackerBSpline.h>
42 
44  : nbLvlPyr(1), l0Pyr(0), pyrInitialised(false), evolRMS(0), x_pos(), y_pos(), evolRMS_eps(1e-4), ptTemplate(nullptr),
45  ptTemplatePyr(nullptr), ptTemplateInit(false), templateSize(0), templateSizePyr(nullptr), ptTemplateSelect(nullptr),
46  ptTemplateSelectPyr(nullptr), ptTemplateSelectInit(false), templateSelectSize(0), ptTemplateSupp(nullptr),
47  ptTemplateSuppPyr(nullptr), ptTemplateCompo(nullptr), ptTemplateCompoPyr(nullptr), zoneTracked(nullptr), zoneTrackedPyr(nullptr),
48  pyr_IDes(nullptr), H(), Hdesire(), HdesirePyr(), HLM(), HLMdesire(), HLMdesirePyr(), HLMdesireInverse(),
49  HLMdesireInversePyr(), G(), gain(1.), thresholdGradient(40), costFunctionVerification(false), blur(true),
50  useBrent(false), nbIterBrent(3), taillef(7), fgG(nullptr), fgdG(nullptr), ratioPixelIn(0), mod_i(1), mod_j(1), nbParam(0),
51  lambdaDep(0.001), iterationMax(30), iterationGlobale(0), diverge(false), nbIteration(0), useCompositionnal(true),
52  useInverse(false), Warp(_warp), p(0), dp(), X1(), X2(), dW(), BI(), dIx(), dIy(), zoneRef_()
53 {
54  nbParam = Warp->getNbParam();
55  p.resize(nbParam);
56  dp.resize(nbParam);
57 
58  fgG = new double[(taillef + 1) / 2];
60 
61  fgdG = new double[(taillef + 1) / 2];
63 }
64 
65 void vpTemplateTracker::setGaussianFilterSize(unsigned int new_taill)
66 {
67  taillef = new_taill;
68  if (fgG)
69  delete[] fgG;
70  fgG = new double[taillef];
72 
73  if (fgdG)
74  delete[] fgdG;
75  fgdG = new double[taillef];
77 }
78 
80 {
81  zoneTracked = &zone;
82 
83  int largeur_im = (int)I.getWidth();
84  int hauteur_im = (int)I.getHeight();
85 
86  unsigned int NbPointDsZone = 0;
87  int mod_fi, mod_fj;
88  mod_fi = mod_i;
89  mod_fj = mod_i;
90 
91  for (int i = 0; i < hauteur_im; i += mod_fi) {
92  for (int j = 0; j < largeur_im; j += mod_fj) {
93  if (zone.inZone(i, j)) {
94  NbPointDsZone++;
95  }
96  }
97  }
98 
99  templateSize = NbPointDsZone;
101  ptTemplateInit = true;
102  ptTemplateSelect = new bool[templateSize];
103  ptTemplateSelectInit = true;
104 
107 
109  vpImage<double> GaussI;
110  vpImageFilter::filter(I, GaussI, fgG, taillef);
113 
114  unsigned int cpt_point = 0;
115  templateSelectSize = 0;
116  for (int i = 0; i < hauteur_im; i += mod_i) {
117  for (int j = 0; j < largeur_im; j += mod_j) {
118  if (zone.inZone(i, j)) {
119  pt.x = j;
120  pt.y = i;
121 
122  pt.dx = dIx[i][j];
123  pt.dy = dIy[i][j];
124 
125  if (pt.dx * pt.dx + pt.dy * pt.dy > thresholdGradient) {
126  ptTemplateSelect[cpt_point] = true;
128  } else {
129  ptTemplateSelect[cpt_point] = false;
130  }
131  pt.val = vpTemplateTrackerBSpline::getSubPixBspline4(GaussI, i, j);
132 
133  ptTemplate[cpt_point] = pt;
134  cpt_point++;
135  }
136  }
137  }
138 
139  templateSize = cpt_point;
140  GaussI.destroy();
141 }
142 
144 {
145  delete[] fgG;
146  delete[] fgdG;
147 
148  resetTracker();
149 }
150 
156 {
157  // reset the tracker parameters
158  p = 0;
159 
160  if (pyrInitialised) {
161  if (ptTemplatePyr) {
162  for (unsigned int i = 0; i < nbLvlPyr; i++) {
163  if (ptTemplatePyr[i]) {
164  for (unsigned int point = 0; point < templateSizePyr[i]; point++) {
165  delete[] ptTemplatePyr[i][point].dW;
166  delete[] ptTemplatePyr[i][point].HiG;
167  }
168  delete[] ptTemplatePyr[i];
169  }
170  }
171  delete[] ptTemplatePyr;
172  ptTemplatePyr = nullptr;
173  }
174 
175  if (ptTemplateCompoPyr) {
176  for (unsigned int i = 0; i < nbLvlPyr; i++) {
177  if (ptTemplateCompoPyr[i]) {
178  for (unsigned int point = 0; point < templateSizePyr[i]; point++) {
179  delete[] ptTemplateCompoPyr[i][point].dW;
180  }
181  delete[] ptTemplateCompoPyr[i];
182  }
183  }
184  delete[] ptTemplateCompoPyr;
185  ptTemplateCompoPyr = nullptr;
186  }
187 
188  if (ptTemplateSuppPyr) {
189  for (unsigned int i = 0; i < nbLvlPyr; i++) {
190  if (ptTemplateSuppPyr[i]) {
191  for (unsigned int point = 0; point < templateSizePyr[i]; point++) {
192  delete[] ptTemplateSuppPyr[i][point].Bt;
193  delete[] ptTemplateSuppPyr[i][point].BtInit;
194  delete[] ptTemplateSuppPyr[i][point].dBt;
195  delete[] ptTemplateSuppPyr[i][point].d2W;
196  delete[] ptTemplateSuppPyr[i][point].d2Wx;
197  delete[] ptTemplateSuppPyr[i][point].d2Wy;
198  }
199  delete[] ptTemplateSuppPyr[i];
200  }
201  }
202  delete[] ptTemplateSuppPyr;
203  ptTemplateSuppPyr = nullptr;
204  }
205 
206  if (ptTemplateSelectPyr) {
207  for (unsigned int i = 0; i < nbLvlPyr; i++) {
208  if (ptTemplateSelectPyr[i])
209  delete[] ptTemplateSelectPyr[i];
210  }
211  delete[] ptTemplateSelectPyr;
212  ptTemplateSelectPyr = nullptr;
213  }
214 
215  if (templateSizePyr) {
216  delete[] templateSizePyr;
217  templateSizePyr = nullptr;
218  }
219 
220  if (HdesirePyr) {
221  delete[] HdesirePyr;
222  HdesirePyr = nullptr;
223  }
224 
225  if (HLMdesirePyr) {
226  delete[] HLMdesirePyr;
227  HLMdesirePyr = nullptr;
228  }
229 
230  if (HLMdesireInversePyr) {
231  delete[] HLMdesireInversePyr;
232  HLMdesireInversePyr = nullptr;
233  }
234 
235  if (zoneTrackedPyr) {
236  delete[] zoneTrackedPyr;
237  zoneTrackedPyr = nullptr;
238  }
239 
240  if (pyr_IDes) {
241  delete[] pyr_IDes;
242  pyr_IDes = nullptr;
243  }
244  } else {
245  if (ptTemplateInit) {
246  for (unsigned int point = 0; point < templateSize; point++) {
247  delete[] ptTemplate[point].dW;
248  delete[] ptTemplate[point].HiG;
249  }
250  delete[] ptTemplate;
251  ptTemplate = nullptr;
252  ptTemplateInit = false;
253  }
254  if (ptTemplateCompo) {
255  for (unsigned int point = 0; point < templateSize; point++) {
256  delete[] ptTemplateCompo[point].dW;
257  }
258  delete[] ptTemplateCompo;
259  ptTemplateCompo = nullptr;
260  }
261  if (ptTemplateSupp) {
262  for (unsigned int point = 0; point < templateSize; point++) {
263  delete[] ptTemplateSupp[point].Bt;
264  delete[] ptTemplateSupp[point].BtInit;
265  delete[] ptTemplateSupp[point].dBt;
266  delete[] ptTemplateSupp[point].d2W;
267  delete[] ptTemplateSupp[point].d2Wx;
268  delete[] ptTemplateSupp[point].d2Wy;
269  }
270  delete[] ptTemplateSupp;
271  ptTemplateSupp = nullptr;
272  }
273  if (ptTemplateSelectInit) {
274  if (ptTemplateSelect) {
275  delete[] ptTemplateSelect;
276  ptTemplateSelect = nullptr;
277  }
278  }
279  }
280 }
281 
315 void vpTemplateTracker::display(const vpImage<unsigned char> &I, const vpColor &col, unsigned int thickness)
316 {
317  if (I.display) { // Only if a display is associated to the image
318  vpTemplateTrackerZone zoneWarped;
319  Warp->warpZone(*zoneTracked, p, zoneWarped);
320  zoneWarped.display(I, col, thickness);
321  }
322 }
323 
357 void vpTemplateTracker::display(const vpImage<vpRGBa> &I, const vpColor &col, unsigned int thickness)
358 {
359  if (I.display) { // Only if a display is associated to the image
360  vpTemplateTrackerZone zoneWarped;
361  Warp->warpZone(*zoneTracked, p, zoneWarped);
362  zoneWarped.display(I, col, thickness);
363  }
364 }
365 
367  vpColVector &direction, double &alpha)
368 {
369  vpColVector **ptp;
370  ptp = new vpColVector *[4];
371  vpColVector p0(nbParam);
372  p0 = tp;
373 
374  // valeur necessaire si conditionnel
375  vpColVector dpt(Warp->getNbParam());
376  vpColVector adpt(Warp->getNbParam());
377 
378  vpColVector p1(nbParam);
379  if (useCompositionnal) {
380  if (useInverse)
381  Warp->getParamInverse(direction, dpt);
382  else
383  dpt = direction;
384  Warp->pRondp(tp, dpt, p1);
385  } else {
386  p1 = tp + direction;
387  }
388 
389  vpColVector p2(nbParam);
390  if (useCompositionnal) {
391  adpt = alpha * direction;
392  if (useInverse)
393  Warp->getParamInverse(adpt, dpt);
394  else
395  dpt = adpt;
396  Warp->pRondp(tp, dpt, p2);
397  } else {
398  p2 = tp + alpha * direction;
399  }
400  vpColVector p3(nbParam);
401  ptp[0] = &p0;
402  ptp[1] = &p1;
403  ptp[2] = &p2;
404  ptp[3] = &p3;
405 
406  double *Cost = new double[4];
407  Cost[0] = tMI;
408  Cost[1] = getCost(I, p1);
409  Cost[2] = getCost(I, p2);
410 
411  double *talpha = new double[4];
412  talpha[0] = 0;
413  talpha[1] = 1.;
414  talpha[2] = alpha;
415 
416  // Utilise trois estimees de paraboles successive ...
417  // A changer pour rendre adaptable
418  for (unsigned int opt = 0; opt < nbIterBrent; opt++) {
419  vpMatrix A(3, 3);
420  for (unsigned int i = 0; i < 3; i++) {
421  A[i][0] = talpha[i] * talpha[i];
422  A[i][1] = talpha[i];
423  A[i][2] = 1.;
424  }
425  vpColVector B(3);
426  for (unsigned int i = 0; i < 3; i++)
427  B[i] = Cost[i];
428  vpColVector parabol(3);
429  parabol = (A.t() * A).inverseByLU() * A.t() * B;
430 
431  // If convexe
432  if (parabol[0] > 0) {
433  talpha[3] = -0.5 * parabol[1] / parabol[0];
434  } else { // If concave
435  int tindic_x_min = 0;
436  int tindic_x_max = 0;
437  for (int i = 1; i < 3; i++) {
438  if (talpha[i] < talpha[tindic_x_min])
439  tindic_x_min = i;
440  if (talpha[i] > talpha[tindic_x_max])
441  tindic_x_max = i;
442  }
443 
444  if (Cost[tindic_x_max] < Cost[tindic_x_min]) {
445  talpha[3] = talpha[tindic_x_max] + 1.;
446  } else {
447  talpha[3] = talpha[tindic_x_min] - 1.;
448  }
449  }
450  int indic_x_min = 0;
451  int indic_x_max = 0;
452  for (int i = 1; i < 3; i++) {
453  if (talpha[i] < talpha[indic_x_min])
454  indic_x_min = i;
455  if (talpha[i] > talpha[indic_x_max])
456  indic_x_max = i;
457  }
458  if (talpha[3] > talpha[indic_x_max])
459  if ((talpha[3] - talpha[indic_x_max]) > alpha)
460  talpha[3] = talpha[indic_x_max] + 4.;
461  if (talpha[3] < talpha[indic_x_min])
462  if ((talpha[indic_x_min] - talpha[3]) > alpha)
463  talpha[3] = talpha[indic_x_min] - 4.;
464 
465  if (useCompositionnal) {
466  adpt = talpha[3] * direction;
467  if (useInverse)
468  Warp->getParamInverse(adpt, dpt);
469  else
470  dpt = adpt;
471  Warp->pRondp(tp, dpt, p3);
472  } else {
473  p3 = tp + talpha[3] * direction;
474  }
475 
476  Cost[3] = getCost(I, p3);
477 
478  int indice_f_max = 0;
479  for (int i = 1; i < 4; i++)
480  if (Cost[i] > Cost[indice_f_max])
481  indice_f_max = i;
482  if (indice_f_max != 3) {
483  *ptp[indice_f_max] = *ptp[3];
484  Cost[indice_f_max] = Cost[3];
485  talpha[indice_f_max] = talpha[3];
486  } else
487  break;
488  }
489 
490  int indice_f_min = 0;
491  for (int i = 0; i < 4; i++)
492  if (Cost[i] < Cost[indice_f_min])
493  indice_f_min = i;
494 
495  alpha = talpha[indice_f_min];
496 
497  if (alpha < 1)
498  alpha = 1.;
499 
500  delete[] ptp;
501  delete[] Cost;
502  delete[] talpha;
503 }
504 
510 void vpTemplateTracker::initPyramidal(unsigned int nbLvl, unsigned int l0)
511 {
512  nbLvlPyr = nbLvl;
513  l0Pyr = l0;
514 
518  ptTemplateSelectPyr = new bool *[nbLvlPyr];
519  ptTemplateSuppPyr = new vpTemplateTrackerPointSuppMIInv *[nbLvlPyr];
521  for (unsigned int i = 0; i < nbLvlPyr; i++) {
522  ptTemplatePyr[i] = nullptr;
523  ptTemplateSuppPyr[i] = nullptr;
524  ptTemplateSelectPyr[i] = nullptr;
525  ptTemplateCompoPyr[i] = nullptr;
526  }
527  templateSizePyr = new unsigned int[nbLvlPyr];
531 
532  pyrInitialised = true;
533 }
534 
536 {
537  zoneTrackedPyr[0].copy(zone);
538 
539  pyr_IDes[0] = I;
544 
545  // creation pyramide de zones et images desiree
546  if (nbLvlPyr > 1) {
547  for (unsigned int i = 1; i < nbLvlPyr; i++) {
550 
555  }
556  }
558 }
559 
582 {
583  zoneRef_.initClick(I, delaunay);
584 
585  if (nbLvlPyr > 1) {
589  } else {
592  }
593 }
594 
606 void vpTemplateTracker::initFromPoints(const vpImage<unsigned char> &I, const std::vector<vpImagePoint> &v_ip,
607  bool delaunay)
608 {
609  zoneRef_.initFromPoints(I, v_ip, delaunay);
610 
611  if (nbLvlPyr > 1) {
615  } else {
618  }
619 }
620 
628 {
629  zoneRef_ = zone;
630 
631  if (nbLvlPyr > 1) {
635  } else {
638  }
639 }
640 
642 {
646  try {
648  ptTemplateSuppPyr[0] = ptTemplateSupp;
650  HdesirePyr[0] = Hdesire;
651  HLMdesirePyr[0] = HLMdesire;
653  } catch (const vpException &e) {
654  ptTemplateSuppPyr[0] = ptTemplateSupp;
656  HdesirePyr[0] = Hdesire;
657  HLMdesirePyr[0] = HLMdesire;
659  throw(e);
660  }
661 
662  if (nbLvlPyr > 1) {
664  Itemp = I;
665  for (unsigned int i = 1; i < nbLvlPyr; i++) {
666  vpImageFilter::getGaussPyramidal(Itemp, Itemp);
667 
671  try {
672  initHessienDesired(Itemp);
673  ptTemplateSuppPyr[i] = ptTemplateSupp;
675  HdesirePyr[i] = Hdesire;
676  HLMdesirePyr[i] = HLMdesire;
678  } catch (const vpException &e) {
679  ptTemplateSuppPyr[i] = ptTemplateSupp;
681  HdesirePyr[i] = Hdesire;
682  HLMdesirePyr[i] = HLMdesire;
684  throw(e);
685  }
686  }
687  }
688 }
689 
695 {
696  if (nbLvlPyr > 1)
697  trackPyr(I);
698  else
699  trackNoPyr(I);
700 }
701 
703 {
704  vpImage<unsigned char> *pyr_I;
705  pyr_I = new vpImage<unsigned char>[nbLvlPyr]; // Why +1 ?
706  pyr_I[0] = I;
707 
708  try {
709  vpColVector ptemp(nbParam);
710  if (nbLvlPyr > 1) {
711  for (unsigned int i = 1; i < nbLvlPyr; i++) {
712  vpImageFilter::getGaussPyramidal(pyr_I[i - 1], pyr_I[i]);
713  Warp->getParamPyramidDown(p, ptemp);
714  p = ptemp;
716  }
717 
718  for (int i = (int)nbLvlPyr - 1; i >= 0; i--) {
719  if (i >= (int)l0Pyr) {
723  ptTemplateSupp = ptTemplateSuppPyr[i];
725  H = HdesirePyr[i];
726  HLM = HLMdesirePyr[i];
728  trackRobust(pyr_I[i]);
729  }
730  if (i > 0) {
731  Warp->getParamPyramidUp(p, ptemp);
732  p = ptemp;
733  zoneTracked = &zoneTrackedPyr[i - 1];
734  }
735  }
736  } else {
737  trackRobust(I);
738  }
739  delete[] pyr_I;
740  } catch (const vpException &e) {
741  delete[] pyr_I;
743  }
744 }
745 
747 {
749  vpColVector p_pre_estimation;
750  p_pre_estimation = p;
752  double pre_fcost = getCost(I, p);
753 
754  trackNoPyr(I);
755 
756  double post_fcost = getCost(I, p);
757  if (pre_fcost < post_fcost) {
758  p = p_pre_estimation;
759  }
760  } else {
761  trackNoPyr(I);
762  }
763 }
764 
772 {
773  unsigned int nb_corners = zoneTracked->getNbTriangle() * 3;
774 
775  Warp->computeCoeff(param);
776  evolRMS = 0;
777  vpTemplateTrackerTriangle triangle;
778 
779  for (unsigned int i = 0; i < zoneTracked->getNbTriangle(); i++) {
780  zoneTracked->getTriangle(i, triangle);
781  for (unsigned int j = 0; j < 3; j++) {
782  triangle.getCorner(j, X1[0], X1[1]);
783 
784  Warp->computeDenom(X1, param);
785  Warp->warpX(X1, X2, param);
786 
787  unsigned int index = i * 3 + j;
788  double x_ = x_pos[index] - X2[0];
789  double y_ = y_pos[index] - X2[1];
790  evolRMS += x_ * x_ + y_ * y_;
791  x_pos[index] = X2[0];
792  y_pos[index] = X2[1];
793  }
794  }
795  evolRMS /= nb_corners;
796 }
797 
805 {
806  unsigned int nb_corners = zoneTracked->getNbTriangle() * 3;
807  x_pos.resize(nb_corners);
808  y_pos.resize(nb_corners);
809 
810  Warp->computeCoeff(param);
811  vpTemplateTrackerTriangle triangle;
812 
813  for (unsigned int i = 0; i < zoneTracked->getNbTriangle(); i++) {
814  unsigned int i3 = i * 3;
815  zoneTracked->getTriangle(i, triangle);
816  for (unsigned int j = 0; j < 3; j++) {
817  triangle.getCorner(j, X1[0], X1[1]);
818 
819  Warp->computeDenom(X1, param);
820  Warp->warpX(X1, X2, param);
821  x_pos[i3 + j] = X2[0];
822  y_pos[i3 + j] = X2[1];
823  }
824  }
825 }
void resize(unsigned int nrows, unsigned int ncols, bool flagNullify=true, bool recopy_=true)
Definition: vpArray2D.h:299
Implementation of column vector and the associated operations.
Definition: vpColVector.h:163
void resize(unsigned int i, bool flagNullify=true)
Definition: vpColVector.h:1056
Class to define RGB colors available for display functionalities.
Definition: vpColor.h:152
error that can be emitted by ViSP classes.
Definition: vpException.h:59
@ badValue
Used to indicate that a value is not in the allowed range.
Definition: vpException.h:85
const char * getMessage() const
Definition: vpException.cpp:64
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 getGaussianDerivativeKernel(FilterType *filter, unsigned int size, FilterType sigma=0., bool normalize=true)
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 getGaussianKernel(FilterType *filter, unsigned int size, FilterType sigma=0., bool normalize=true)
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)
static void getGaussPyramidal(const vpImage< unsigned char > &I, vpImage< unsigned char > &GI)
void destroy()
Destructor : Memory de-allocation.
Definition: vpImage.h:809
unsigned int getWidth() const
Definition: vpImage.h:242
unsigned int getHeight() const
Definition: vpImage.h:184
vpDisplay * display
Definition: vpImage.h:140
Implementation of a matrix and operations on matrices.
Definition: vpMatrix.h:146
vpMatrix t() const
Definition: vpMatrix.cpp:457
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 emitted by the vpTracker class and its derivatives.