Visual Servoing Platform  version 3.6.1 under development (2024-12-06)
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 
43 BEGIN_VISP_NAMESPACE
45  : nbLvlPyr(1), l0Pyr(0), pyrInitialised(false), evolRMS(0), x_pos(), y_pos(), evolRMS_eps(1e-4), ptTemplate(nullptr),
46  ptTemplatePyr(nullptr), ptTemplateInit(false), templateSize(0), templateSizePyr(nullptr), ptTemplateSelect(nullptr),
47  ptTemplateSelectPyr(nullptr), ptTemplateSelectInit(false), templateSelectSize(0), ptTemplateSupp(nullptr),
48  ptTemplateSuppPyr(nullptr), ptTemplateCompo(nullptr), ptTemplateCompoPyr(nullptr), zoneTracked(nullptr), zoneTrackedPyr(nullptr),
49  pyr_IDes(nullptr), 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(nullptr), fgdG(nullptr), 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  }
130  else {
131  ptTemplateSelect[cpt_point] = false;
132  }
133  pt.val = vpTemplateTrackerBSpline::getSubPixBspline4(GaussI, i, j);
134 
135  ptTemplate[cpt_point] = pt;
136  cpt_point++;
137  }
138  }
139  }
140 
141  templateSize = cpt_point;
142  GaussI.destroy();
143 }
144 
146 {
147  delete[] fgG;
148  delete[] fgdG;
149 
150  resetTracker();
151 }
152 
158 {
159  // reset the tracker parameters
160  p = 0;
161 
162  if (pyrInitialised) {
163  if (ptTemplatePyr) {
164  for (unsigned int i = 0; i < nbLvlPyr; i++) {
165  if (ptTemplatePyr[i]) {
166  for (unsigned int point = 0; point < templateSizePyr[i]; point++) {
167  delete[] ptTemplatePyr[i][point].dW;
168  delete[] ptTemplatePyr[i][point].HiG;
169  }
170  delete[] ptTemplatePyr[i];
171  }
172  }
173  delete[] ptTemplatePyr;
174  ptTemplatePyr = nullptr;
175  }
176 
177  if (ptTemplateCompoPyr) {
178  for (unsigned int i = 0; i < nbLvlPyr; i++) {
179  if (ptTemplateCompoPyr[i]) {
180  for (unsigned int point = 0; point < templateSizePyr[i]; point++) {
181  delete[] ptTemplateCompoPyr[i][point].dW;
182  }
183  delete[] ptTemplateCompoPyr[i];
184  }
185  }
186  delete[] ptTemplateCompoPyr;
187  ptTemplateCompoPyr = nullptr;
188  }
189 
190  if (ptTemplateSuppPyr) {
191  for (unsigned int i = 0; i < nbLvlPyr; i++) {
192  if (ptTemplateSuppPyr[i]) {
193  for (unsigned int point = 0; point < templateSizePyr[i]; point++) {
194  delete[] ptTemplateSuppPyr[i][point].Bt;
195  delete[] ptTemplateSuppPyr[i][point].BtInit;
196  delete[] ptTemplateSuppPyr[i][point].dBt;
197  delete[] ptTemplateSuppPyr[i][point].d2W;
198  delete[] ptTemplateSuppPyr[i][point].d2Wx;
199  delete[] ptTemplateSuppPyr[i][point].d2Wy;
200  }
201  delete[] ptTemplateSuppPyr[i];
202  }
203  }
204  delete[] ptTemplateSuppPyr;
205  ptTemplateSuppPyr = nullptr;
206  }
207 
208  if (ptTemplateSelectPyr) {
209  for (unsigned int i = 0; i < nbLvlPyr; i++) {
210  if (ptTemplateSelectPyr[i])
211  delete[] ptTemplateSelectPyr[i];
212  }
213  delete[] ptTemplateSelectPyr;
214  ptTemplateSelectPyr = nullptr;
215  }
216 
217  if (templateSizePyr) {
218  delete[] templateSizePyr;
219  templateSizePyr = nullptr;
220  }
221 
222  if (HdesirePyr) {
223  delete[] HdesirePyr;
224  HdesirePyr = nullptr;
225  }
226 
227  if (HLMdesirePyr) {
228  delete[] HLMdesirePyr;
229  HLMdesirePyr = nullptr;
230  }
231 
232  if (HLMdesireInversePyr) {
233  delete[] HLMdesireInversePyr;
234  HLMdesireInversePyr = nullptr;
235  }
236 
237  if (zoneTrackedPyr) {
238  delete[] zoneTrackedPyr;
239  zoneTrackedPyr = nullptr;
240  }
241 
242  if (pyr_IDes) {
243  delete[] pyr_IDes;
244  pyr_IDes = nullptr;
245  }
246  }
247  else {
248  if (ptTemplateInit) {
249  for (unsigned int point = 0; point < templateSize; point++) {
250  delete[] ptTemplate[point].dW;
251  delete[] ptTemplate[point].HiG;
252  }
253  delete[] ptTemplate;
254  ptTemplate = nullptr;
255  ptTemplateInit = false;
256  }
257  if (ptTemplateCompo) {
258  for (unsigned int point = 0; point < templateSize; point++) {
259  delete[] ptTemplateCompo[point].dW;
260  }
261  delete[] ptTemplateCompo;
262  ptTemplateCompo = nullptr;
263  }
264  if (ptTemplateSupp) {
265  for (unsigned int point = 0; point < templateSize; point++) {
266  delete[] ptTemplateSupp[point].Bt;
267  delete[] ptTemplateSupp[point].BtInit;
268  delete[] ptTemplateSupp[point].dBt;
269  delete[] ptTemplateSupp[point].d2W;
270  delete[] ptTemplateSupp[point].d2Wx;
271  delete[] ptTemplateSupp[point].d2Wy;
272  }
273  delete[] ptTemplateSupp;
274  ptTemplateSupp = nullptr;
275  }
276  if (ptTemplateSelectInit) {
277  if (ptTemplateSelect) {
278  delete[] ptTemplateSelect;
279  ptTemplateSelect = nullptr;
280  }
281  }
282  }
283 }
284 
322 void vpTemplateTracker::display(const vpImage<unsigned char> &I, const vpColor &col, unsigned int thickness)
323 {
324  if (I.display) { // Only if a display is associated to the image
325  vpTemplateTrackerZone zoneWarped;
326  Warp->warpZone(*zoneTracked, p, zoneWarped);
327  zoneWarped.display(I, col, thickness);
328  }
329 }
330 
368 void vpTemplateTracker::display(const vpImage<vpRGBa> &I, const vpColor &col, unsigned int thickness)
369 {
370  if (I.display) { // Only if a display is associated to the image
371  vpTemplateTrackerZone zoneWarped;
372  Warp->warpZone(*zoneTracked, p, zoneWarped);
373  zoneWarped.display(I, col, thickness);
374  }
375 }
376 
378  vpColVector &direction, double &alpha)
379 {
380  vpColVector **ptp;
381  ptp = new vpColVector *[4];
382  vpColVector p0(nbParam);
383  p0 = tp;
384 
385  // valeur necessaire si conditionnel
386  vpColVector dpt(Warp->getNbParam());
387  vpColVector adpt(Warp->getNbParam());
388 
389  vpColVector p1(nbParam);
390  if (useCompositionnal) {
391  if (useInverse)
392  Warp->getParamInverse(direction, dpt);
393  else
394  dpt = direction;
395  Warp->pRondp(tp, dpt, p1);
396  }
397  else {
398  p1 = tp + direction;
399  }
400 
401  vpColVector p2(nbParam);
402  if (useCompositionnal) {
403  adpt = alpha * direction;
404  if (useInverse)
405  Warp->getParamInverse(adpt, dpt);
406  else
407  dpt = adpt;
408  Warp->pRondp(tp, dpt, p2);
409  }
410  else {
411  p2 = tp + alpha * direction;
412  }
413  vpColVector p3(nbParam);
414  ptp[0] = &p0;
415  ptp[1] = &p1;
416  ptp[2] = &p2;
417  ptp[3] = &p3;
418 
419  double *Cost = new double[4];
420  Cost[0] = tMI;
421  Cost[1] = getCost(I, p1);
422  Cost[2] = getCost(I, p2);
423 
424  double *talpha = new double[4];
425  talpha[0] = 0;
426  talpha[1] = 1.;
427  talpha[2] = alpha;
428 
429  // Utilise trois estimees de paraboles successive ...
430  // A changer pour rendre adaptable
431  for (unsigned int opt = 0; opt < nbIterBrent; opt++) {
432  vpMatrix A(3, 3);
433  for (unsigned int i = 0; i < 3; i++) {
434  A[i][0] = talpha[i] * talpha[i];
435  A[i][1] = talpha[i];
436  A[i][2] = 1.;
437  }
438  vpColVector B(3);
439  for (unsigned int i = 0; i < 3; i++)
440  B[i] = Cost[i];
441  vpColVector parabol(3);
442  parabol = (A.t() * A).inverseByLU() * A.t() * B;
443 
444  // If convexe
445  if (parabol[0] > 0) {
446  talpha[3] = -0.5 * parabol[1] / parabol[0];
447  }
448  else { // If concave
449  int tindic_x_min = 0;
450  int tindic_x_max = 0;
451  for (int i = 1; i < 3; i++) {
452  if (talpha[i] < talpha[tindic_x_min])
453  tindic_x_min = i;
454  if (talpha[i] > talpha[tindic_x_max])
455  tindic_x_max = i;
456  }
457 
458  if (Cost[tindic_x_max] < Cost[tindic_x_min]) {
459  talpha[3] = talpha[tindic_x_max] + 1.;
460  }
461  else {
462  talpha[3] = talpha[tindic_x_min] - 1.;
463  }
464  }
465  int indic_x_min = 0;
466  int indic_x_max = 0;
467  for (int i = 1; i < 3; i++) {
468  if (talpha[i] < talpha[indic_x_min])
469  indic_x_min = i;
470  if (talpha[i] > talpha[indic_x_max])
471  indic_x_max = i;
472  }
473  if (talpha[3] > talpha[indic_x_max])
474  if ((talpha[3] - talpha[indic_x_max]) > alpha)
475  talpha[3] = talpha[indic_x_max] + 4.;
476  if (talpha[3] < talpha[indic_x_min])
477  if ((talpha[indic_x_min] - talpha[3]) > alpha)
478  talpha[3] = talpha[indic_x_min] - 4.;
479 
480  if (useCompositionnal) {
481  adpt = talpha[3] * direction;
482  if (useInverse)
483  Warp->getParamInverse(adpt, dpt);
484  else
485  dpt = adpt;
486  Warp->pRondp(tp, dpt, p3);
487  }
488  else {
489  p3 = tp + talpha[3] * direction;
490  }
491 
492  Cost[3] = getCost(I, p3);
493 
494  int indice_f_max = 0;
495  for (int i = 1; i < 4; i++)
496  if (Cost[i] > Cost[indice_f_max])
497  indice_f_max = i;
498  if (indice_f_max != 3) {
499  *ptp[indice_f_max] = *ptp[3];
500  Cost[indice_f_max] = Cost[3];
501  talpha[indice_f_max] = talpha[3];
502  }
503  else
504  break;
505  }
506 
507  int indice_f_min = 0;
508  for (int i = 0; i < 4; i++)
509  if (Cost[i] < Cost[indice_f_min])
510  indice_f_min = i;
511 
512  alpha = talpha[indice_f_min];
513 
514  if (alpha < 1)
515  alpha = 1.;
516 
517  delete[] ptp;
518  delete[] Cost;
519  delete[] talpha;
520 }
521 
527 void vpTemplateTracker::initPyramidal(unsigned int nbLvl, unsigned int l0)
528 {
529  nbLvlPyr = nbLvl;
530  l0Pyr = l0;
531 
535  ptTemplateSelectPyr = new bool *[nbLvlPyr];
536  ptTemplateSuppPyr = new vpTemplateTrackerPointSuppMIInv *[nbLvlPyr];
538  for (unsigned int i = 0; i < nbLvlPyr; i++) {
539  ptTemplatePyr[i] = nullptr;
540  ptTemplateSuppPyr[i] = nullptr;
541  ptTemplateSelectPyr[i] = nullptr;
542  ptTemplateCompoPyr[i] = nullptr;
543  }
544  templateSizePyr = new unsigned int[nbLvlPyr];
548 
549  pyrInitialised = true;
550 }
551 
553 {
554  zoneTrackedPyr[0].copy(zone);
555 
556  pyr_IDes[0] = I;
561 
562  // creation pyramide de zones et images desiree
563  if (nbLvlPyr > 1) {
564  for (unsigned int i = 1; i < nbLvlPyr; i++) {
567 
572  }
573  }
575 }
576 
599 {
600  zoneRef_.initClick(I, delaunay);
601 
602  if (nbLvlPyr > 1) {
606  }
607  else {
610  }
611 }
612 
624 void vpTemplateTracker::initFromPoints(const vpImage<unsigned char> &I, const std::vector<vpImagePoint> &v_ip,
625  bool delaunay)
626 {
627  zoneRef_.initFromPoints(I, v_ip, delaunay);
628 
629  if (nbLvlPyr > 1) {
633  }
634  else {
637  }
638 }
639 
647 {
648  zoneRef_ = zone;
649 
650  if (nbLvlPyr > 1) {
654  }
655  else {
658  }
659 }
660 
662 {
666  try {
668  ptTemplateSuppPyr[0] = ptTemplateSupp;
670  HdesirePyr[0] = Hdesire;
671  HLMdesirePyr[0] = HLMdesire;
673  }
674  catch (const vpException &e) {
675  ptTemplateSuppPyr[0] = ptTemplateSupp;
677  HdesirePyr[0] = Hdesire;
678  HLMdesirePyr[0] = HLMdesire;
680  throw(e);
681  }
682 
683  if (nbLvlPyr > 1) {
685  Itemp = I;
686  for (unsigned int i = 1; i < nbLvlPyr; i++) {
687  vpImageFilter::getGaussPyramidal(Itemp, Itemp);
688 
692  try {
693  initHessienDesired(Itemp);
694  ptTemplateSuppPyr[i] = ptTemplateSupp;
696  HdesirePyr[i] = Hdesire;
697  HLMdesirePyr[i] = HLMdesire;
699  }
700  catch (const vpException &e) {
701  ptTemplateSuppPyr[i] = ptTemplateSupp;
703  HdesirePyr[i] = Hdesire;
704  HLMdesirePyr[i] = HLMdesire;
706  throw(e);
707  }
708  }
709  }
710 }
711 
717 {
718  if (nbLvlPyr > 1)
719  trackPyr(I);
720  else
721  trackNoPyr(I);
722 }
723 
725 {
726  vpImage<unsigned char> *pyr_I;
727  pyr_I = new vpImage<unsigned char>[nbLvlPyr]; // Why +1 ?
728  pyr_I[0] = I;
729 
730  try {
731  vpColVector ptemp(nbParam);
732  if (nbLvlPyr > 1) {
733  for (unsigned int i = 1; i < nbLvlPyr; i++) {
734  vpImageFilter::getGaussPyramidal(pyr_I[i - 1], pyr_I[i]);
735  Warp->getParamPyramidDown(p, ptemp);
736  p = ptemp;
738  }
739 
740  for (int i = (int)nbLvlPyr - 1; i >= 0; i--) {
741  if (i >= (int)l0Pyr) {
745  ptTemplateSupp = ptTemplateSuppPyr[i];
747  H = HdesirePyr[i];
748  HLM = HLMdesirePyr[i];
750  trackRobust(pyr_I[i]);
751  }
752  if (i > 0) {
753  Warp->getParamPyramidUp(p, ptemp);
754  p = ptemp;
755  zoneTracked = &zoneTrackedPyr[i - 1];
756  }
757  }
758  }
759  else {
760  trackRobust(I);
761  }
762  delete[] pyr_I;
763  }
764  catch (const vpException &e) {
765  delete[] pyr_I;
767  }
768 }
769 
771 {
773  vpColVector p_pre_estimation;
774  p_pre_estimation = p;
776  double pre_fcost = getCost(I, p);
777 
778  trackNoPyr(I);
779 
780  double post_fcost = getCost(I, p);
781  if (pre_fcost < post_fcost) {
782  p = p_pre_estimation;
783  }
784  }
785  else {
786  trackNoPyr(I);
787  }
788 }
789 
797 {
798  unsigned int nb_corners = zoneTracked->getNbTriangle() * 3;
799 
800  Warp->computeCoeff(param);
801  evolRMS = 0;
802  vpTemplateTrackerTriangle triangle;
803 
804  for (unsigned int i = 0; i < zoneTracked->getNbTriangle(); i++) {
805  zoneTracked->getTriangle(i, triangle);
806  for (unsigned int j = 0; j < 3; j++) {
807  triangle.getCorner(j, X1[0], X1[1]);
808 
809  Warp->computeDenom(X1, param);
810  Warp->warpX(X1, X2, param);
811 
812  unsigned int index = i * 3 + j;
813  double x_ = x_pos[index] - X2[0];
814  double y_ = y_pos[index] - X2[1];
815  evolRMS += x_ * x_ + y_ * y_;
816  x_pos[index] = X2[0];
817  y_pos[index] = X2[1];
818  }
819  }
820  evolRMS /= nb_corners;
821 }
822 
830 {
831  unsigned int nb_corners = zoneTracked->getNbTriangle() * 3;
832  x_pos.resize(nb_corners);
833  y_pos.resize(nb_corners);
834 
835  Warp->computeCoeff(param);
836  vpTemplateTrackerTriangle triangle;
837 
838  for (unsigned int i = 0; i < zoneTracked->getNbTriangle(); i++) {
839  unsigned int i3 = i * 3;
840  zoneTracked->getTriangle(i, triangle);
841  for (unsigned int j = 0; j < 3; j++) {
842  triangle.getCorner(j, X1[0], X1[1]);
843 
844  Warp->computeDenom(X1, param);
845  Warp->warpX(X1, X2, param);
846  x_pos[i3 + j] = X2[0];
847  y_pos[i3 + j] = X2[1];
848  }
849  }
850 }
851 END_VISP_NAMESPACE
void resize(unsigned int nrows, unsigned int ncols, bool flagNullify=true, bool recopy_=true)
Definition: vpArray2D.h:362
Implementation of column vector and the associated operations.
Definition: vpColVector.h:191
void resize(unsigned int i, bool flagNullify=true)
Definition: vpColVector.h:1143
Class to define RGB colors available for display functionalities.
Definition: vpColor.h:157
error that can be emitted by ViSP classes.
Definition: vpException.h:60
@ badValue
Used to indicate that a value is not in the allowed range.
Definition: vpException.h:73
const char * getMessage() const
Definition: vpException.cpp:65
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:573
unsigned int getWidth() const
Definition: vpImage.h:242
unsigned int getHeight() const
Definition: vpImage.h:181
vpDisplay * display
Definition: vpImage.h:136
Implementation of a matrix and operations on matrices.
Definition: vpMatrix.h:169
vpMatrix t() const
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.