Visual Servoing Platform  version 3.6.1 under development (2024-06-18)
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 
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 
318 void vpTemplateTracker::display(const vpImage<unsigned char> &I, const vpColor &col, unsigned int thickness)
319 {
320  if (I.display) { // Only if a display is associated to the image
321  vpTemplateTrackerZone zoneWarped;
322  Warp->warpZone(*zoneTracked, p, zoneWarped);
323  zoneWarped.display(I, col, thickness);
324  }
325 }
326 
360 void vpTemplateTracker::display(const vpImage<vpRGBa> &I, const vpColor &col, unsigned int thickness)
361 {
362  if (I.display) { // Only if a display is associated to the image
363  vpTemplateTrackerZone zoneWarped;
364  Warp->warpZone(*zoneTracked, p, zoneWarped);
365  zoneWarped.display(I, col, thickness);
366  }
367 }
368 
370  vpColVector &direction, double &alpha)
371 {
372  vpColVector **ptp;
373  ptp = new vpColVector *[4];
374  vpColVector p0(nbParam);
375  p0 = tp;
376 
377  // valeur necessaire si conditionnel
378  vpColVector dpt(Warp->getNbParam());
379  vpColVector adpt(Warp->getNbParam());
380 
381  vpColVector p1(nbParam);
382  if (useCompositionnal) {
383  if (useInverse)
384  Warp->getParamInverse(direction, dpt);
385  else
386  dpt = direction;
387  Warp->pRondp(tp, dpt, p1);
388  }
389  else {
390  p1 = tp + direction;
391  }
392 
393  vpColVector p2(nbParam);
394  if (useCompositionnal) {
395  adpt = alpha * direction;
396  if (useInverse)
397  Warp->getParamInverse(adpt, dpt);
398  else
399  dpt = adpt;
400  Warp->pRondp(tp, dpt, p2);
401  }
402  else {
403  p2 = tp + alpha * direction;
404  }
405  vpColVector p3(nbParam);
406  ptp[0] = &p0;
407  ptp[1] = &p1;
408  ptp[2] = &p2;
409  ptp[3] = &p3;
410 
411  double *Cost = new double[4];
412  Cost[0] = tMI;
413  Cost[1] = getCost(I, p1);
414  Cost[2] = getCost(I, p2);
415 
416  double *talpha = new double[4];
417  talpha[0] = 0;
418  talpha[1] = 1.;
419  talpha[2] = alpha;
420 
421  // Utilise trois estimees de paraboles successive ...
422  // A changer pour rendre adaptable
423  for (unsigned int opt = 0; opt < nbIterBrent; opt++) {
424  vpMatrix A(3, 3);
425  for (unsigned int i = 0; i < 3; i++) {
426  A[i][0] = talpha[i] * talpha[i];
427  A[i][1] = talpha[i];
428  A[i][2] = 1.;
429  }
430  vpColVector B(3);
431  for (unsigned int i = 0; i < 3; i++)
432  B[i] = Cost[i];
433  vpColVector parabol(3);
434  parabol = (A.t() * A).inverseByLU() * A.t() * B;
435 
436  // If convexe
437  if (parabol[0] > 0) {
438  talpha[3] = -0.5 * parabol[1] / parabol[0];
439  }
440  else { // If concave
441  int tindic_x_min = 0;
442  int tindic_x_max = 0;
443  for (int i = 1; i < 3; i++) {
444  if (talpha[i] < talpha[tindic_x_min])
445  tindic_x_min = i;
446  if (talpha[i] > talpha[tindic_x_max])
447  tindic_x_max = i;
448  }
449 
450  if (Cost[tindic_x_max] < Cost[tindic_x_min]) {
451  talpha[3] = talpha[tindic_x_max] + 1.;
452  }
453  else {
454  talpha[3] = talpha[tindic_x_min] - 1.;
455  }
456  }
457  int indic_x_min = 0;
458  int indic_x_max = 0;
459  for (int i = 1; i < 3; i++) {
460  if (talpha[i] < talpha[indic_x_min])
461  indic_x_min = i;
462  if (talpha[i] > talpha[indic_x_max])
463  indic_x_max = i;
464  }
465  if (talpha[3] > talpha[indic_x_max])
466  if ((talpha[3] - talpha[indic_x_max]) > alpha)
467  talpha[3] = talpha[indic_x_max] + 4.;
468  if (talpha[3] < talpha[indic_x_min])
469  if ((talpha[indic_x_min] - talpha[3]) > alpha)
470  talpha[3] = talpha[indic_x_min] - 4.;
471 
472  if (useCompositionnal) {
473  adpt = talpha[3] * direction;
474  if (useInverse)
475  Warp->getParamInverse(adpt, dpt);
476  else
477  dpt = adpt;
478  Warp->pRondp(tp, dpt, p3);
479  }
480  else {
481  p3 = tp + talpha[3] * direction;
482  }
483 
484  Cost[3] = getCost(I, p3);
485 
486  int indice_f_max = 0;
487  for (int i = 1; i < 4; i++)
488  if (Cost[i] > Cost[indice_f_max])
489  indice_f_max = i;
490  if (indice_f_max != 3) {
491  *ptp[indice_f_max] = *ptp[3];
492  Cost[indice_f_max] = Cost[3];
493  talpha[indice_f_max] = talpha[3];
494  }
495  else
496  break;
497  }
498 
499  int indice_f_min = 0;
500  for (int i = 0; i < 4; i++)
501  if (Cost[i] < Cost[indice_f_min])
502  indice_f_min = i;
503 
504  alpha = talpha[indice_f_min];
505 
506  if (alpha < 1)
507  alpha = 1.;
508 
509  delete[] ptp;
510  delete[] Cost;
511  delete[] talpha;
512 }
513 
519 void vpTemplateTracker::initPyramidal(unsigned int nbLvl, unsigned int l0)
520 {
521  nbLvlPyr = nbLvl;
522  l0Pyr = l0;
523 
527  ptTemplateSelectPyr = new bool *[nbLvlPyr];
528  ptTemplateSuppPyr = new vpTemplateTrackerPointSuppMIInv *[nbLvlPyr];
530  for (unsigned int i = 0; i < nbLvlPyr; i++) {
531  ptTemplatePyr[i] = nullptr;
532  ptTemplateSuppPyr[i] = nullptr;
533  ptTemplateSelectPyr[i] = nullptr;
534  ptTemplateCompoPyr[i] = nullptr;
535  }
536  templateSizePyr = new unsigned int[nbLvlPyr];
540 
541  pyrInitialised = true;
542 }
543 
545 {
546  zoneTrackedPyr[0].copy(zone);
547 
548  pyr_IDes[0] = I;
553 
554  // creation pyramide de zones et images desiree
555  if (nbLvlPyr > 1) {
556  for (unsigned int i = 1; i < nbLvlPyr; i++) {
559 
564  }
565  }
567 }
568 
591 {
592  zoneRef_.initClick(I, delaunay);
593 
594  if (nbLvlPyr > 1) {
598  }
599  else {
602  }
603 }
604 
616 void vpTemplateTracker::initFromPoints(const vpImage<unsigned char> &I, const std::vector<vpImagePoint> &v_ip,
617  bool delaunay)
618 {
619  zoneRef_.initFromPoints(I, v_ip, delaunay);
620 
621  if (nbLvlPyr > 1) {
625  }
626  else {
629  }
630 }
631 
639 {
640  zoneRef_ = zone;
641 
642  if (nbLvlPyr > 1) {
646  }
647  else {
650  }
651 }
652 
654 {
658  try {
660  ptTemplateSuppPyr[0] = ptTemplateSupp;
662  HdesirePyr[0] = Hdesire;
663  HLMdesirePyr[0] = HLMdesire;
665  }
666  catch (const vpException &e) {
667  ptTemplateSuppPyr[0] = ptTemplateSupp;
669  HdesirePyr[0] = Hdesire;
670  HLMdesirePyr[0] = HLMdesire;
672  throw(e);
673  }
674 
675  if (nbLvlPyr > 1) {
677  Itemp = I;
678  for (unsigned int i = 1; i < nbLvlPyr; i++) {
679  vpImageFilter::getGaussPyramidal(Itemp, Itemp);
680 
684  try {
685  initHessienDesired(Itemp);
686  ptTemplateSuppPyr[i] = ptTemplateSupp;
688  HdesirePyr[i] = Hdesire;
689  HLMdesirePyr[i] = HLMdesire;
691  }
692  catch (const vpException &e) {
693  ptTemplateSuppPyr[i] = ptTemplateSupp;
695  HdesirePyr[i] = Hdesire;
696  HLMdesirePyr[i] = HLMdesire;
698  throw(e);
699  }
700  }
701  }
702 }
703 
709 {
710  if (nbLvlPyr > 1)
711  trackPyr(I);
712  else
713  trackNoPyr(I);
714 }
715 
717 {
718  vpImage<unsigned char> *pyr_I;
719  pyr_I = new vpImage<unsigned char>[nbLvlPyr]; // Why +1 ?
720  pyr_I[0] = I;
721 
722  try {
723  vpColVector ptemp(nbParam);
724  if (nbLvlPyr > 1) {
725  for (unsigned int i = 1; i < nbLvlPyr; i++) {
726  vpImageFilter::getGaussPyramidal(pyr_I[i - 1], pyr_I[i]);
727  Warp->getParamPyramidDown(p, ptemp);
728  p = ptemp;
730  }
731 
732  for (int i = (int)nbLvlPyr - 1; i >= 0; i--) {
733  if (i >= (int)l0Pyr) {
737  ptTemplateSupp = ptTemplateSuppPyr[i];
739  H = HdesirePyr[i];
740  HLM = HLMdesirePyr[i];
742  trackRobust(pyr_I[i]);
743  }
744  if (i > 0) {
745  Warp->getParamPyramidUp(p, ptemp);
746  p = ptemp;
747  zoneTracked = &zoneTrackedPyr[i - 1];
748  }
749  }
750  }
751  else {
752  trackRobust(I);
753  }
754  delete[] pyr_I;
755  }
756  catch (const vpException &e) {
757  delete[] pyr_I;
759  }
760 }
761 
763 {
765  vpColVector p_pre_estimation;
766  p_pre_estimation = p;
768  double pre_fcost = getCost(I, p);
769 
770  trackNoPyr(I);
771 
772  double post_fcost = getCost(I, p);
773  if (pre_fcost < post_fcost) {
774  p = p_pre_estimation;
775  }
776  }
777  else {
778  trackNoPyr(I);
779  }
780 }
781 
789 {
790  unsigned int nb_corners = zoneTracked->getNbTriangle() * 3;
791 
792  Warp->computeCoeff(param);
793  evolRMS = 0;
794  vpTemplateTrackerTriangle triangle;
795 
796  for (unsigned int i = 0; i < zoneTracked->getNbTriangle(); i++) {
797  zoneTracked->getTriangle(i, triangle);
798  for (unsigned int j = 0; j < 3; j++) {
799  triangle.getCorner(j, X1[0], X1[1]);
800 
801  Warp->computeDenom(X1, param);
802  Warp->warpX(X1, X2, param);
803 
804  unsigned int index = i * 3 + j;
805  double x_ = x_pos[index] - X2[0];
806  double y_ = y_pos[index] - X2[1];
807  evolRMS += x_ * x_ + y_ * y_;
808  x_pos[index] = X2[0];
809  y_pos[index] = X2[1];
810  }
811  }
812  evolRMS /= nb_corners;
813 }
814 
822 {
823  unsigned int nb_corners = zoneTracked->getNbTriangle() * 3;
824  x_pos.resize(nb_corners);
825  y_pos.resize(nb_corners);
826 
827  Warp->computeCoeff(param);
828  vpTemplateTrackerTriangle triangle;
829 
830  for (unsigned int i = 0; i < zoneTracked->getNbTriangle(); i++) {
831  unsigned int i3 = i * 3;
832  zoneTracked->getTriangle(i, triangle);
833  for (unsigned int j = 0; j < 3; j++) {
834  triangle.getCorner(j, X1[0], X1[1]);
835 
836  Warp->computeDenom(X1, param);
837  Warp->warpX(X1, X2, param);
838  x_pos[i3 + j] = X2[0];
839  y_pos[i3 + j] = X2[1];
840  }
841  }
842 }
void resize(unsigned int nrows, unsigned int ncols, bool flagNullify=true, bool recopy_=true)
Definition: vpArray2D.h:355
Implementation of column vector and the associated operations.
Definition: vpColVector.h:171
void resize(unsigned int i, bool flagNullify=true)
Definition: vpColVector.h:1066
Class to define RGB colors available for display functionalities.
Definition: vpColor.h:153
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:828
unsigned int getWidth() const
Definition: vpImage.h:246
unsigned int getHeight() const
Definition: vpImage.h:185
vpDisplay * display
Definition: vpImage.h:141
Implementation of a matrix and operations on matrices.
Definition: vpMatrix.h:151
vpMatrix t() const
Definition: vpMatrix.cpp:473
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.