Visual Servoing Platform  version 3.5.0 under development (2022-02-15)
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(),
46  evolRMS_eps(1e-4), ptTemplate(NULL), ptTemplatePyr(NULL), ptTemplateInit(false),
47  templateSize(0), templateSizePyr(NULL), ptTemplateSelect(NULL), ptTemplateSelectPyr(NULL),
48  ptTemplateSelectInit(false), templateSelectSize(0), ptTemplateSupp(NULL), ptTemplateSuppPyr(NULL),
49  ptTemplateCompo(NULL), ptTemplateCompoPyr(NULL), zoneTracked(NULL), zoneTrackedPyr(NULL), pyr_IDes(NULL), H(),
50  Hdesire(), HdesirePyr(), HLM(), HLMdesire(), HLMdesirePyr(), HLMdesireInverse(), HLMdesireInversePyr(), G(),
51  gain(1.), thresholdGradient(40), costFunctionVerification(false), blur(true), useBrent(false), nbIterBrent(3),
52  taillef(7), fgG(NULL), fgdG(NULL), ratioPixelIn(0), mod_i(1), mod_j(1), nbParam(0), lambdaDep(0.001),
53  iterationMax(30), iterationGlobale(0), diverge(false), nbIteration(0), useCompositionnal(true), useInverse(false),
54  Warp(_warp), p(0), dp(), X1(), X2(), dW(), BI(), dIx(), dIy(), zoneRef_()
55 {
56  nbParam = Warp->getNbParam();
57  p.resize(nbParam);
58  dp.resize(nbParam);
59 
60  fgG = new double[(taillef + 1) / 2];
62 
63  fgdG = new double[(taillef + 1) / 2];
65 }
66 
67 void vpTemplateTracker::setGaussianFilterSize(unsigned int new_taill)
68 {
69  taillef = new_taill;
70  if (fgG)
71  delete[] fgG;
72  fgG = new double[taillef];
74 
75  if (fgdG)
76  delete[] fgdG;
77  fgdG = new double[taillef];
79 }
80 
82 {
83  zoneTracked = &zone;
84 
85  int largeur_im = (int)I.getWidth();
86  int hauteur_im = (int)I.getHeight();
87 
88  unsigned int NbPointDsZone = 0;
89  int mod_fi, mod_fj;
90  mod_fi = mod_i;
91  mod_fj = mod_i;
92 
93  for (int i = 0; i < hauteur_im; i += mod_fi) {
94  for (int j = 0; j < largeur_im; j += mod_fj) {
95  if (zone.inZone(i, j)) {
96  NbPointDsZone++;
97  }
98  }
99  }
100 
101 
102  templateSize = NbPointDsZone;
104  ptTemplateInit = true;
105  ptTemplateSelect = new bool[templateSize];
106  ptTemplateSelectInit = true;
107 
110 
112  vpImage<double> GaussI;
113  vpImageFilter::filter(I, GaussI, fgG, taillef);
116 
117  unsigned int cpt_point = 0;
118  templateSelectSize = 0;
119  for (int i = 0; i < hauteur_im; i += mod_i) {
120  for (int j = 0; j < largeur_im; j += mod_j) {
121  if (zone.inZone(i, j)) {
122  pt.x = j;
123  pt.y = i;
124 
125  pt.dx = dIx[i][j];
126  pt.dy = dIy[i][j];
127 
128  if (pt.dx * pt.dx + pt.dy * pt.dy > thresholdGradient) {
129  ptTemplateSelect[cpt_point] = true;
131  } else {
132  ptTemplateSelect[cpt_point] = false;
133  }
134  pt.val = vpTemplateTrackerBSpline::getSubPixBspline4(GaussI, i, j);
135 
136  ptTemplate[cpt_point] = pt;
137  cpt_point++;
138  }
139  }
140  }
141 
142  templateSize = cpt_point;
143  GaussI.destroy();
144 }
145 
147 {
148  delete[] fgG;
149  delete[] fgdG;
150 
151  resetTracker();
152 }
153 
159 {
160  // reset the tracker parameters
161  p = 0;
162 
163  if (pyrInitialised) {
164  if (ptTemplatePyr) {
165  for (unsigned int i = 0; i < nbLvlPyr; i++) {
166  if (ptTemplatePyr[i]) {
167  for (unsigned int point = 0; point < templateSizePyr[i]; point++) {
168  delete[] ptTemplatePyr[i][point].dW;
169  delete[] ptTemplatePyr[i][point].HiG;
170  }
171  delete[] ptTemplatePyr[i];
172  }
173  }
174  delete[] ptTemplatePyr;
175  ptTemplatePyr = NULL;
176  }
177 
178  if (ptTemplateCompoPyr) {
179  for (unsigned int i = 0; i < nbLvlPyr; i++) {
180  if (ptTemplateCompoPyr[i]) {
181  for (unsigned int point = 0; point < templateSizePyr[i]; point++) {
182  delete[] ptTemplateCompoPyr[i][point].dW;
183  }
184  delete[] ptTemplateCompoPyr[i];
185  }
186  }
187  delete[] ptTemplateCompoPyr;
188  ptTemplateCompoPyr = NULL;
189  }
190 
191  if (ptTemplateSuppPyr) {
192  for (unsigned int i = 0; i < nbLvlPyr; i++) {
193  if (ptTemplateSuppPyr[i]) {
194  for (unsigned int point = 0; point < templateSizePyr[i]; point++) {
195  delete[] ptTemplateSuppPyr[i][point].Bt;
196  delete[] ptTemplateSuppPyr[i][point].BtInit;
197  delete[] ptTemplateSuppPyr[i][point].dBt;
198  delete[] ptTemplateSuppPyr[i][point].d2W;
199  delete[] ptTemplateSuppPyr[i][point].d2Wx;
200  delete[] ptTemplateSuppPyr[i][point].d2Wy;
201  }
202  delete[] ptTemplateSuppPyr[i];
203  }
204  }
205  delete[] ptTemplateSuppPyr;
206  ptTemplateSuppPyr = NULL;
207  }
208 
209  if (ptTemplateSelectPyr) {
210  for (unsigned int i = 0; i < nbLvlPyr; i++) {
211  if (ptTemplateSelectPyr[i])
212  delete[] ptTemplateSelectPyr[i];
213  }
214  delete[] ptTemplateSelectPyr;
215  ptTemplateSelectPyr = NULL;
216  }
217 
218  if (templateSizePyr) {
219  delete[] templateSizePyr;
220  templateSizePyr = NULL;
221  }
222 
223  if (HdesirePyr) {
224  delete[] HdesirePyr;
225  HdesirePyr = NULL;
226  }
227 
228  if (HLMdesirePyr) {
229  delete[] HLMdesirePyr;
230  HLMdesirePyr = NULL;
231  }
232 
233  if (HLMdesireInversePyr) {
234  delete[] HLMdesireInversePyr;
235  HLMdesireInversePyr = NULL;
236  }
237 
238  if (zoneTrackedPyr) {
239  delete[] zoneTrackedPyr;
240  zoneTrackedPyr = NULL;
241  }
242 
243  if (pyr_IDes) {
244  delete[] pyr_IDes;
245  pyr_IDes = NULL;
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 = NULL;
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 = NULL;
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 = NULL;
275  }
276  if (ptTemplateSelectInit) {
277  if (ptTemplateSelect) {
278  delete[] ptTemplateSelect;
279  ptTemplateSelect = NULL;
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  } else {
389  p1 = tp + direction;
390  }
391 
392  vpColVector p2(nbParam);
393  if (useCompositionnal) {
394  adpt = alpha * direction;
395  if (useInverse)
396  Warp->getParamInverse(adpt, dpt);
397  else
398  dpt = adpt;
399  Warp->pRondp(tp, dpt, p2);
400  } else {
401  p2 = tp + alpha * direction;
402  }
403  vpColVector p3(nbParam);
404  ptp[0] = &p0;
405  ptp[1] = &p1;
406  ptp[2] = &p2;
407  ptp[3] = &p3;
408 
409  double *Cost = new double[4];
410  Cost[0] = tMI;
411  Cost[1] = getCost(I, p1);
412  Cost[2] = getCost(I, p2);
413 
414  double *talpha = new double[4];
415  talpha[0] = 0;
416  talpha[1] = 1.;
417  talpha[2] = alpha;
418 
419  // Utilise trois estimees de paraboles successive ...
420  // A changer pour rendre adaptable
421  for (unsigned int opt = 0; opt < nbIterBrent; opt++) {
422  vpMatrix A(3, 3);
423  for (unsigned int i = 0; i < 3; i++) {
424  A[i][0] = talpha[i] * talpha[i];
425  A[i][1] = talpha[i];
426  A[i][2] = 1.;
427  }
428  vpColVector B(3);
429  for (unsigned int i = 0; i < 3; i++)
430  B[i] = Cost[i];
431  vpColVector parabol(3);
432  parabol = (A.t() * A).inverseByLU() * A.t() * B;
433 
434  // If convexe
435  if (parabol[0] > 0) {
436  talpha[3] = -0.5 * parabol[1] / parabol[0];
437  } else { // If concave
438  int tindic_x_min = 0;
439  int tindic_x_max = 0;
440  for (int i = 1; i < 3; i++) {
441  if (talpha[i] < talpha[tindic_x_min])
442  tindic_x_min = i;
443  if (talpha[i] > talpha[tindic_x_max])
444  tindic_x_max = i;
445  }
446 
447  if (Cost[tindic_x_max] < Cost[tindic_x_min]) {
448  talpha[3] = talpha[tindic_x_max] + 1.;
449  } else {
450  talpha[3] = talpha[tindic_x_min] - 1.;
451  }
452  }
453  int indic_x_min = 0;
454  int indic_x_max = 0;
455  for (int i = 1; i < 3; i++) {
456  if (talpha[i] < talpha[indic_x_min])
457  indic_x_min = i;
458  if (talpha[i] > talpha[indic_x_max])
459  indic_x_max = i;
460  }
461  if (talpha[3] > talpha[indic_x_max])
462  if ((talpha[3] - talpha[indic_x_max]) > alpha)
463  talpha[3] = talpha[indic_x_max] + 4.;
464  if (talpha[3] < talpha[indic_x_min])
465  if ((talpha[indic_x_min] - talpha[3]) > alpha)
466  talpha[3] = talpha[indic_x_min] - 4.;
467 
468  if (useCompositionnal) {
469  adpt = talpha[3] * direction;
470  if (useInverse)
471  Warp->getParamInverse(adpt, dpt);
472  else
473  dpt = adpt;
474  Warp->pRondp(tp, dpt, p3);
475  } else {
476  p3 = tp + talpha[3] * direction;
477  }
478 
479  Cost[3] = getCost(I, p3);
480 
481  int indice_f_max = 0;
482  for (int i = 1; i < 4; i++)
483  if (Cost[i] > Cost[indice_f_max])
484  indice_f_max = i;
485  if (indice_f_max != 3) {
486  *ptp[indice_f_max] = *ptp[3];
487  Cost[indice_f_max] = Cost[3];
488  talpha[indice_f_max] = talpha[3];
489  } else
490  break;
491  }
492 
493  int indice_f_min = 0;
494  for (int i = 0; i < 4; i++)
495  if (Cost[i] < Cost[indice_f_min])
496  indice_f_min = i;
497 
498  alpha = talpha[indice_f_min];
499 
500  if (alpha < 1)
501  alpha = 1.;
502 
503  delete[] ptp;
504  delete[] Cost;
505  delete[] talpha;
506 }
507 
513 void vpTemplateTracker::initPyramidal(unsigned int nbLvl, unsigned int l0)
514 {
515  nbLvlPyr = nbLvl;
516  l0Pyr = l0;
517 
521  ptTemplateSelectPyr = new bool *[nbLvlPyr];
522  ptTemplateSuppPyr = new vpTemplateTrackerPointSuppMIInv *[nbLvlPyr];
524  for (unsigned int i = 0; i < nbLvlPyr; i++) {
525  ptTemplatePyr[i] = NULL;
526  ptTemplateSuppPyr[i] = NULL;
527  ptTemplateSelectPyr[i] = NULL;
528  ptTemplateCompoPyr[i] = NULL;
529  }
530  templateSizePyr = new unsigned int[nbLvlPyr];
534 
535  pyrInitialised = true;
536 }
537 
539 {
540  zoneTrackedPyr[0].copy(zone);
541 
542  pyr_IDes[0] = I;
547 
548  // creation pyramide de zones et images desiree
549  if (nbLvlPyr > 1) {
550  for (unsigned int i = 1; i < nbLvlPyr; i++) {
553 
558  }
559  }
561 }
562 
585 {
586  zoneRef_.initClick(I, delaunay);
587 
588  if (nbLvlPyr > 1) {
592  } else {
595  }
596 }
597 
609 void vpTemplateTracker::initFromPoints(const vpImage<unsigned char> &I, const std::vector<vpImagePoint> &v_ip,
610  bool delaunay)
611 {
612  zoneRef_.initFromPoints(I, v_ip, delaunay);
613 
614  if (nbLvlPyr > 1) {
618  } else {
621  }
622 }
623 
631 {
632  zoneRef_ = zone;
633 
634  if (nbLvlPyr > 1) {
638  } else {
641  }
642 }
643 
645 {
649  try {
651  ptTemplateSuppPyr[0] = ptTemplateSupp;
653  HdesirePyr[0] = Hdesire;
654  HLMdesirePyr[0] = HLMdesire;
656  } catch (const vpException &e) {
657  ptTemplateSuppPyr[0] = ptTemplateSupp;
659  HdesirePyr[0] = Hdesire;
660  HLMdesirePyr[0] = HLMdesire;
662  throw(e);
663  }
664 
665  if (nbLvlPyr > 1) {
667  Itemp = I;
668  for (unsigned int i = 1; i < nbLvlPyr; i++) {
669  vpImageFilter::getGaussPyramidal(Itemp, Itemp);
670 
674  try {
675  initHessienDesired(Itemp);
676  ptTemplateSuppPyr[i] = ptTemplateSupp;
678  HdesirePyr[i] = Hdesire;
679  HLMdesirePyr[i] = HLMdesire;
681  } catch (const vpException &e) {
682  ptTemplateSuppPyr[i] = ptTemplateSupp;
684  HdesirePyr[i] = Hdesire;
685  HLMdesirePyr[i] = HLMdesire;
687  throw(e);
688  }
689  }
690  }
691 }
692 
698 {
699  if (nbLvlPyr > 1)
700  trackPyr(I);
701  else
702  trackNoPyr(I);
703 }
704 
706 {
707  vpImage<unsigned char> *pyr_I;
708  pyr_I = new vpImage<unsigned char>[nbLvlPyr]; // Why +1 ?
709  pyr_I[0] = I;
710 
711  try {
712  vpColVector ptemp(nbParam);
713  if (nbLvlPyr > 1) {
714  for (unsigned int i = 1; i < nbLvlPyr; i++) {
715  vpImageFilter::getGaussPyramidal(pyr_I[i - 1], pyr_I[i]);
716  Warp->getParamPyramidDown(p, ptemp);
717  p = ptemp;
719  }
720 
721  for (int i = (int)nbLvlPyr - 1; i >= 0; i--) {
722  if (i >= (int)l0Pyr) {
726  ptTemplateSupp = ptTemplateSuppPyr[i];
728  H = HdesirePyr[i];
729  HLM = HLMdesirePyr[i];
731  trackRobust(pyr_I[i]);
732  }
733  if (i > 0) {
734  Warp->getParamPyramidUp(p, ptemp);
735  p = ptemp;
736  zoneTracked = &zoneTrackedPyr[i - 1];
737  }
738  }
739  } else {
740  trackRobust(I);
741  }
742  delete[] pyr_I;
743  } catch (const vpException &e) {
744  delete[] pyr_I;
746  }
747 }
748 
750 {
752  vpColVector p_pre_estimation;
753  p_pre_estimation = p;
755  double pre_fcost = getCost(I, p);
756 
757  trackNoPyr(I);
758 
759  double post_fcost = getCost(I, p);
760  if (pre_fcost < post_fcost) {
761  p = p_pre_estimation;
762  }
763  } else {
764  trackNoPyr(I);
765  }
766 }
767 
775 {
776  unsigned int nb_corners = zoneTracked->getNbTriangle() * 3;
777 
778  Warp->computeCoeff(param);
779  evolRMS = 0;
780  vpTemplateTrackerTriangle triangle;
781 
782  for (unsigned int i = 0; i < zoneTracked->getNbTriangle(); i++) {
783  zoneTracked->getTriangle(i, triangle);
784  for (unsigned int j = 0; j < 3; j++) {
785  triangle.getCorner(j, X1[0], X1[1]);
786 
787  Warp->computeDenom(X1, param);
788  Warp->warpX(X1, X2, param);
789 
790  unsigned int index = i * 3 + j;
791  double x_ = x_pos[index] - X2[0];
792  double y_ = y_pos[index] - X2[1];
793  evolRMS += x_ * x_ + y_ * y_;
794  x_pos[index] = X2[0];
795  y_pos[index] = X2[1];
796  }
797  }
798  evolRMS /= nb_corners;
799 }
800 
808 {
809  unsigned int nb_corners = zoneTracked->getNbTriangle() * 3;
810  x_pos.resize(nb_corners);
811  y_pos.resize(nb_corners);
812 
813  Warp->computeCoeff(param);
814  vpTemplateTrackerTriangle triangle;
815 
816  for (unsigned int i = 0; i < zoneTracked->getNbTriangle(); i++) {
817  unsigned int i3 = i * 3;
818  zoneTracked->getTriangle(i, triangle);
819  for (unsigned int j = 0; j < 3; j++) {
820  triangle.getCorner(j, X1[0], X1[1]);
821 
822  Warp->computeDenom(X1, param);
823  Warp->warpX(X1, X2, param);
824  x_pos[i3 + j] = X2[0];
825  y_pos[i3 + j] = X2[1];
826  }
827  }
828 }
static void getGaussPyramidal(const vpImage< unsigned char > &I, vpImage< unsigned char > &GI)
virtual void warpX(const int &v1, const int &u1, double &v2, double &u2, const vpColVector &p)=0
vpTemplateTrackerZone getPyramidDown() const
virtual void getParamInverse(const vpColVector &p, vpColVector &p_inv) const =0
void display(const vpImage< unsigned char > &I, const vpColor &col=vpColor::green, unsigned int thickness=3)
Used to indicate that a value is not in the allowed range.
Definition: vpException.h:97
vpDisplay * display
Definition: vpImage.h:144
Implementation of a matrix and operations on matrices.
Definition: vpMatrix.h:153
void resize(unsigned int nrows, unsigned int ncols, bool flagNullify=true, bool recopy_=true)
Definition: vpArray2D.h:304
virtual void trackPyr(const vpImage< unsigned char > &I)
unsigned int templateSelectSize
void getGaussianBluredImage(const vpImage< unsigned char > &I)
vpTemplateTrackerPoint * ptTemplate
vpTemplateTrackerPoint ** ptTemplatePyr
Class to define RGB colors available for display functionnalities.
Definition: vpColor.h:157
unsigned int getNbParam() const
static void getGaussianKernel(double *filter, unsigned int size, double sigma=0., bool normalize=true)
virtual void initTrackingPyr(const vpImage< unsigned char > &I, vpTemplateTrackerZone &zone)
std::vector< double > y_pos
virtual void getParamPyramidDown(const vpColVector &p, vpColVector &p_down)=0
void computeOptimalBrentGain(const vpImage< unsigned char > &I, vpColVector &tp, double tMI, vpColVector &direction, double &alpha)
error that can be emited by ViSP classes.
Definition: vpException.h:71
void initClick(const vpImage< unsigned char > &I, bool delaunay=false)
void initPosEvalRMS(const vpColVector &p)
static void getGradYGauss2D(const vpImage< unsigned char > &I, vpImage< double > &dIy, const double *gaussianKernel, const double *gaussianDerivativeKernel, unsigned int size)
const char * getMessage() const
Definition: vpException.cpp:90
void computeEvalRMS(const vpColVector &p)
vpMatrix * HLMdesireInversePyr
vpTemplateTracker()
Default constructor.
static void getGradXGauss2D(const vpImage< unsigned char > &I, vpImage< double > &dIx, const double *gaussianKernel, const double *gaussianDerivativeKernel, unsigned int size)
void copy(const vpTemplateTrackerZone &z)
unsigned int templateSize
void display(const vpImage< unsigned char > &I, const vpColor &col=vpColor::green, unsigned int thickness=3)
void initTracking(const vpImage< unsigned char > &I, vpTemplateTrackerZone &zone)
vpMatrix t() const
Definition: vpMatrix.cpp:464
bool inZone(const int &i, const int &j) const
Error that can be emited by the vpTracker class and its derivates.
std::vector< double > x_pos
vpTemplateTrackerZone * zoneTrackedPyr
virtual void initHessienDesired(const vpImage< unsigned char > &I)=0
vpTemplateTrackerZone zoneRef_
vpImage< double > dIx
void setGaussianFilterSize(unsigned int new_taill)
void initFromZone(const vpImage< unsigned char > &I, const vpTemplateTrackerZone &zone)
virtual double getCost(const vpImage< unsigned char > &I, const vpColVector &tp)=0
virtual void initHessienDesiredPyr(const vpImage< unsigned char > &I)
virtual void pRondp(const vpColVector &p1, const vpColVector &p2, vpColVector &p12) const =0
void initClick(const vpImage< unsigned char > &I, bool delaunay=false)
vpImage< double > dIy
void initFromPoints(const vpImage< unsigned char > &I, const std::vector< vpImagePoint > &ip, bool delaunay=false)
void destroy()
Destructor : Memory de-allocation.
Definition: vpImage.h:829
void initFromPoints(const vpImage< unsigned char > &I, const std::vector< vpImagePoint > &v_ip, bool delaunay=false)
vpColVector getCorner(unsigned int i) const
unsigned int * templateSizePyr
static void filter(const vpImage< double > &I, vpImage< double > &Iu, vpImage< double > &Iv, const vpMatrix &M, bool convolve=false)
unsigned int nbLvlPyr
void resize(unsigned int i, bool flagNullify=true)
Definition: vpColVector.h:310
virtual void initPyramidal(unsigned int nbLvl, unsigned int l0)
void warpZone(const vpTemplateTrackerZone &in, const vpColVector &p, vpTemplateTrackerZone &out)
static void getGaussianDerivativeKernel(double *filter, unsigned int size, double sigma=0., bool normalize=true)
unsigned int getHeight() const
Definition: vpImage.h:188
vpTemplateTrackerPointCompo * ptTemplateCompo
Implementation of column vector and the associated operations.
Definition: vpColVector.h:130
void track(const vpImage< unsigned char > &I)
virtual void trackNoPyr(const vpImage< unsigned char > &I)=0
vpTemplateTrackerZone * zoneTracked
unsigned int getNbTriangle() const
void trackRobust(const vpImage< unsigned char > &I)
vpImage< unsigned char > * pyr_IDes
void getTriangle(unsigned int i, vpTemplateTrackerTriangle &T) const
virtual void getParamPyramidUp(const vpColVector &p, vpColVector &p_up)=0
vpTemplateTrackerWarp * Warp
unsigned int getWidth() const
Definition: vpImage.h:246
unsigned int nbIterBrent
vpTemplateTrackerPointCompo ** ptTemplateCompoPyr