Visual Servoing Platform  version 3.4.0
templateTracker.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  * Example of template tracking.
33  *
34  * Authors:
35  * Amaury Dame
36  * Aurelien Yol
37  * Fabien Spindler
38  *
39  *****************************************************************************/
40 
47 #include <iostream>
48 #include <visp3/core/vpConfig.h>
49 
50 #if defined(VISP_HAVE_MODULE_TT) && defined(VISP_HAVE_DISPLAY)
51 
52 #include <visp3/core/vpDebug.h>
53 #include <visp3/core/vpHomogeneousMatrix.h>
54 #include <visp3/core/vpIoTools.h>
55 #include <visp3/core/vpMath.h>
56 #include <visp3/gui/vpDisplayD3D.h>
57 #include <visp3/gui/vpDisplayGDI.h>
58 #include <visp3/gui/vpDisplayGTK.h>
59 #include <visp3/gui/vpDisplayOpenCV.h>
60 #include <visp3/gui/vpDisplayX.h>
61 #include <visp3/io/vpImageIo.h>
62 #include <visp3/io/vpParseArgv.h>
63 #include <visp3/io/vpVideoReader.h>
64 
65 #include <visp3/tt/vpTemplateTrackerSSD.h>
66 #include <visp3/tt/vpTemplateTrackerSSDESM.h>
67 #include <visp3/tt/vpTemplateTrackerSSDForwardAdditional.h>
68 #include <visp3/tt/vpTemplateTrackerSSDForwardCompositional.h>
69 #include <visp3/tt/vpTemplateTrackerSSDInverseCompositional.h>
70 #include <visp3/tt/vpTemplateTrackerZNCCForwardAdditional.h>
71 #include <visp3/tt/vpTemplateTrackerZNCCInverseCompositional.h>
72 
73 #include <visp3/tt/vpTemplateTrackerWarpAffine.h>
74 #include <visp3/tt/vpTemplateTrackerWarpHomography.h>
75 #include <visp3/tt/vpTemplateTrackerWarpHomographySL3.h>
76 #include <visp3/tt/vpTemplateTrackerWarpRT.h>
77 #include <visp3/tt/vpTemplateTrackerWarpSRT.h>
78 #include <visp3/tt/vpTemplateTrackerWarpTranslation.h>
79 
80 #ifdef VISP_HAVE_MODULE_TT_MI
81 #include <visp3/tt_mi/vpTemplateTrackerMIESM.h>
82 #include <visp3/tt_mi/vpTemplateTrackerMIForwardAdditional.h>
83 #include <visp3/tt_mi/vpTemplateTrackerMIForwardCompositional.h>
84 #include <visp3/tt_mi/vpTemplateTrackerMIInverseCompositional.h>
85 #endif
86 
87 #define GETOPTARGS "cdhi:l:Lprs:t:w:"
88 
89 #ifndef DOXYGEN_SHOULD_SKIP_THIS
90 typedef enum {
91  WARP_AFFINE,
92  WARP_HOMOGRAPHY,
93  WARP_HOMOGRAPHY_SL3,
94  WARP_SRT,
95  WARP_TRANSLATION,
96 #ifdef VISP_HAVE_MODULE_TT_MI
97  WARP_RT,
98 #endif
99  WARP_LAST
100 } WarpType;
101 
102 typedef enum {
103  TRACKER_SSD_ESM,
104  TRACKER_SSD_FORWARD_ADDITIONAL,
105  TRACKER_SSD_FORWARD_COMPOSITIONAL,
106  TRACKER_SSD_INVERSE_COMPOSITIONAL, // The most efficient
107  TRACKER_ZNCC_FORWARD_ADDITIONEL,
108  TRACKER_ZNCC_INVERSE_COMPOSITIONAL,
109 #ifdef VISP_HAVE_MODULE_TT_MI
110  TRACKER_MI_ESM,
111  TRACKER_MI_FORWARD_ADDITIONAL,
112  TRACKER_MI_FORWARD_COMPOSITIONAL,
113  TRACKER_MI_INVERSE_COMPOSITIONAL, // The most efficient
114 #endif
115  TRACKER_LAST
116 } TrackerType;
117 
118 #endif
119 
120 void usage(const char *name, const char *badparam, const WarpType &warp_type, TrackerType &tracker_type,
121  const long &last_frame, const double &residual_threhold)
122 {
123  fprintf(stdout, "\n\
124 Example of template tracking.\n\
125 \n\
126 SYNOPSIS\n\
127  %s [-i <test image path>] [-c] [-d] [-p] \n\
128  [-w <warp type>] [-t <tracker type>] \n\
129  [-l <last frame number>] [-r] [-L] [-h]\n", name);
130 
131  fprintf(stdout, "\n\
132 OPTIONS: Default\n\
133  -i <input image path> \n\
134  Set image input path.\n\
135  From this path read images \n\
136  \"cube/image%%04d.pgm\". These \n\
137  images come from ViSP-images-x.y.z.tar.gz available \n\
138  on the ViSP website.\n\
139  Setting the VISP_INPUT_IMAGE_PATH environment\n\
140  variable produces the same behaviour than using\n\
141  this option.\n\
142  \n\
143  -l <last frame number> %ld\n\
144  Last frame number to consider.\n\
145  \n\
146  -d \n\
147  Turn off the display.\n\
148  \n\
149  -c\n\
150  Disable the mouse click. Useful to automaze the \n\
151  execution of this program without humain intervention.\n\
152  \n", last_frame);
153 
154 #ifdef VISP_HAVE_MODULE_TT_MI
155  fprintf(stdout, "\n\
156  -w <warp type=[0,1,2,3,4,5]> %d\n\
157  Set the model used to warp the template. \n\
158  Authorized values are:\n\
159  %d : Affine\n\
160  %d : Homography\n\
161  %d : Homography in SL3\n\
162  %d : SRT (scale, rotation, translation)\n\
163  %d : Translation\n\
164  %d : RT (rotation, translation)\n\n", (int)warp_type, (int)WARP_AFFINE, (int)WARP_HOMOGRAPHY, (int)WARP_HOMOGRAPHY_SL3, (int)WARP_SRT,
165  (int)WARP_TRANSLATION, (int)WARP_RT);
166 #else
167  fprintf(stdout, "\n\
168  -w <warp type=[0,1,2,3,4]> %d\n\
169  Set the model used to warp the template. \n\
170  Authorized values are:\n\
171  %d : Affine\n\
172  %d : Homography\n\
173  %d : Homography in SL3\n\
174  %d : SRT (scale, rotation, translation)\n\
175  %d : Translation\n\n", (int)warp_type, (int)WARP_AFFINE, (int)WARP_HOMOGRAPHY, (int)WARP_HOMOGRAPHY_SL3, (int)WARP_SRT,
176  (int)WARP_TRANSLATION);
177 #endif
178 
179 #ifdef VISP_HAVE_MODULE_TT_MI
180  fprintf(stdout, "\n\
181  -t <tracker type=[0,1,2,3,4,5,6,7,8,9]> %d\n\
182  Set the tracker used to track the template. \n\
183  Authorized values are:\n\
184  %d : SSD ESM\n\
185  %d : SSD forward additional\n\
186  %d : SSD forward compositional\n\
187  %d : SSD inverse compositional\n\
188  %d : ZNCC forward additional\n\
189  %d : ZNCC inverse compositional\n\
190  %d : MI ESM\n\
191  %d : MI forward additional\n\
192  %d : MI forward compositional\n\
193  %d : MI inverse compositional\n", (int)tracker_type, (int)TRACKER_SSD_ESM, (int)TRACKER_SSD_FORWARD_ADDITIONAL,
194  (int)TRACKER_SSD_FORWARD_COMPOSITIONAL, (int)TRACKER_SSD_INVERSE_COMPOSITIONAL,
195  (int)TRACKER_ZNCC_FORWARD_ADDITIONEL, (int)TRACKER_ZNCC_INVERSE_COMPOSITIONAL, (int)TRACKER_MI_ESM,
196  (int)TRACKER_MI_FORWARD_ADDITIONAL, (int)TRACKER_MI_FORWARD_COMPOSITIONAL,
197  (int)TRACKER_MI_INVERSE_COMPOSITIONAL);
198 #else
199  fprintf(stdout, "\n\
200  -t <tracker type=[0,1,2,3,4,5]> %d\n\
201  Set the tracker used to track the template. \n\
202  Authorized values are:\n\
203  %d : SSD ESM\n\
204  %d : SSD forward additional\n\
205  %d : SSD forward compositional\n\
206  %d : SSD inverse compositional\n\
207  %d : ZNCC forward additional\n\
208  %d : ZNCC inverse compositional\n", (int)tracker_type, (int)TRACKER_SSD_ESM, (int)TRACKER_SSD_FORWARD_ADDITIONAL,
209  (int)TRACKER_SSD_FORWARD_COMPOSITIONAL, (int)TRACKER_SSD_INVERSE_COMPOSITIONAL,
210  (int)TRACKER_ZNCC_FORWARD_ADDITIONEL, (int)TRACKER_ZNCC_INVERSE_COMPOSITIONAL);
211 
212 #endif
213  fprintf(stdout, "\n\
214  -p\n\
215  Enable pyramidal tracking.\n\
216  \n\
217  -r\n\
218  Disable re-init at frame 10.\n\
219  \n\
220  -s <residual threshold> %g\n\
221  Threshold used to stop optimization when residual difference\n\
222  between two successive optimization iteration becomes lower\n\
223  that this parameter.\n\
224  \n\
225  -L \n\
226  Create log file.\n\
227  \n\
228  -h \n\
229  Print the help.\n\n", residual_threhold);
230 
231  if (badparam)
232  fprintf(stdout, "\nERROR: Bad parameter [%s]\n", badparam);
233 }
234 
235 bool getOptions(int argc, const char **argv, std::string &ipath, bool &click_allowed, bool &display, bool &pyramidal,
236  WarpType &warp_type, TrackerType &tracker_type, long &last_frame, bool &reinit, double &threshold_residual,
237  bool &log)
238 {
239  const char *optarg_;
240  int c;
241  while ((c = vpParseArgv::parse(argc, argv, GETOPTARGS, &optarg_)) > 1) {
242 
243  switch (c) {
244  case 'c':
245  click_allowed = false;
246  break;
247  case 'd':
248  display = false;
249  break;
250  case 'h':
251  usage(argv[0], NULL, warp_type, tracker_type, last_frame, threshold_residual);
252  return false;
253  break;
254  case 'i':
255  ipath = optarg_;
256  break;
257  case 'l':
258  last_frame = (long)atoi(optarg_);
259  break;
260  case 'L':
261  log = true;
262  break;
263  case 'p':
264  pyramidal = true;
265  break;
266  case 'r':
267  reinit = false;
268  break;
269  case 't':
270  tracker_type = (TrackerType)atoi(optarg_);
271  break;
272  case 'w':
273  warp_type = (WarpType)atoi(optarg_);
274  break;
275  case 's':
276  threshold_residual = std::atof(optarg_);
277  break;
278 
279  default:
280  usage(argv[0], optarg_, warp_type, tracker_type, last_frame, threshold_residual);
281  return false;
282  break;
283  }
284  }
285 
286  if (warp_type >= WARP_LAST) {
287  usage(argv[0], NULL, warp_type, tracker_type, last_frame, threshold_residual);
288  std::cerr << "ERROR: " << std::endl;
289  std::cerr << " Bad argument -w <warp type> with \"warp type\"=" << (int)warp_type << std::endl << std::endl;
290  return false;
291  }
292  if (tracker_type >= TRACKER_LAST) {
293  usage(argv[0], NULL, warp_type, tracker_type, last_frame, threshold_residual);
294  std::cerr << "ERROR: " << std::endl;
295  std::cerr << " Bad argument -t <tracker type> with \"tracker type\"=" << (int)tracker_type << std::endl
296  << std::endl;
297  return false;
298  }
299  if ((c == 1) || (c == -1)) {
300  // standalone param or error
301  usage(argv[0], NULL, warp_type, tracker_type, last_frame, threshold_residual);
302  std::cerr << "ERROR: " << std::endl;
303  std::cerr << " Bad argument " << optarg_ << std::endl << std::endl;
304  return false;
305  }
306 
307  return true;
308 }
309 
310 int main(int argc, const char **argv)
311 {
312 #if defined(VISP_HAVE_LAPACK) || defined(VISP_HAVE_EIGEN3) || defined(VISP_HAVE_OPENCV)
313  try {
314  std::string env_ipath;
315  std::string opt_ipath;
316  std::string ipath;
317  bool opt_click_allowed = true;
318  bool opt_display = true;
319  bool opt_pyramidal = false;
320  TrackerType opt_tracker_type = TRACKER_SSD_INVERSE_COMPOSITIONAL;
321  WarpType opt_warp_type = WARP_AFFINE;
322  long opt_last_frame = 30;
323  bool opt_reinit = true;
324  double opt_threshold_residual = 1e-4;
325  bool opt_log = false;
326  std::ofstream ofs;
327 
328  // Set the default output path
329 #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))) // UNIX
330  std::string opath = "/tmp";
331 #elif defined(_WIN32)
332  std::string opath = "C:\\temp";
333 #endif
334 
335  // Get the user login name
336  std::string username;
337  vpIoTools::getUserName(username);
338 
339  // Get the visp-images-data package path or VISP_INPUT_IMAGE_PATH
340  // environment variable value
341  env_ipath = vpIoTools::getViSPImagesDataPath();
342 
343  // Set the default input path
344  if (!env_ipath.empty())
345  ipath = env_ipath;
346 
347  // Append to the output path string, the login name of the user
348  std::string odirname = vpIoTools::createFilePath(opath, username);
349  std::string logfilename = vpIoTools::createFilePath(odirname, "template-tracker.log");
350 
351  // Read the command line options
352  if (!getOptions(argc, argv, opt_ipath, opt_click_allowed, opt_display, opt_pyramidal, opt_warp_type,
353  opt_tracker_type, opt_last_frame, opt_reinit, opt_threshold_residual, opt_log)) {
354  return (-1);
355  }
356 
357  // Test if an input path is set
358  if (opt_ipath.empty() && env_ipath.empty()) {
359  usage(argv[0], NULL, opt_warp_type, opt_tracker_type, opt_last_frame, opt_threshold_residual);
360  std::cerr << std::endl << "ERROR:" << std::endl;
361  std::cerr << " Use -i <visp image path> option or set VISP_INPUT_IMAGE_PATH " << std::endl
362  << " environment variable to specify the location of the " << std::endl
363  << " image path where test images are located." << std::endl
364  << std::endl;
365 
366  return (-1);
367  }
368 
369  // Get the option values
370  if (!opt_ipath.empty())
371  ipath = vpIoTools::createFilePath(opt_ipath, "mire-2/image.%04d.pgm");
372  else
373  ipath = vpIoTools::createFilePath(env_ipath, "mire-2/image.%04d.pgm");
374 
375  if (opt_log) {
376  ofs.open( logfilename.c_str() );
377  }
378 
380  vpVideoReader reader;
381 
382  reader.setFileName(ipath.c_str());
383  reader.setFirstFrameIndex(1);
384  reader.setLastFrameIndex(opt_last_frame);
385  try {
386  reader.open(I);
387  } catch (...) {
388  std::cout << "Cannot open sequence: " << ipath << std::endl;
389  return -1;
390  }
391  reader.acquire(I);
392 
393  vpDisplay *display = NULL;
394  if (opt_display) {
395 // initialise a display
396 #if defined VISP_HAVE_X11
397  display = new vpDisplayX;
398 #elif defined VISP_HAVE_GDI
399  display = new vpDisplayGDI;
400 #elif defined VISP_HAVE_OPENCV
401  display = new vpDisplayOpenCV;
402 #elif defined VISP_HAVE_D3D9
403  display = new vpDisplayD3D;
404 #elif defined VISP_HAVE_GTK
405  display = new vpDisplayGTK;
406 #else
407  opt_display = false;
408 #endif
409 #if defined(VISP_HAVE_DISPLAY)
410  display->init(I, 100, 100, "Test tracking");
411 #endif
413  vpDisplay::flush(I);
414  }
415 
416  vpTemplateTrackerWarp *warp = NULL;
417  switch (opt_warp_type) {
418  case WARP_AFFINE:
419  warp = new vpTemplateTrackerWarpAffine;
420  break;
421  case WARP_HOMOGRAPHY:
423  break;
424  case WARP_HOMOGRAPHY_SL3:
426  break;
427  case WARP_SRT:
428  warp = new vpTemplateTrackerWarpSRT;
429  break;
430  case WARP_TRANSLATION:
432  break;
433 #ifdef VISP_HAVE_MODULE_TT_MI
434  case WARP_RT:
435  warp = new vpTemplateTrackerWarpRT;
436  break;
437 #endif
438  default:
439  return 0;
440  }
441 
442  vpTemplateTracker *tracker = NULL;
443  switch (opt_tracker_type) {
444  case TRACKER_SSD_ESM:
445  tracker = new vpTemplateTrackerSSDESM(warp);
446  break;
447  case TRACKER_SSD_FORWARD_ADDITIONAL:
448  tracker = new vpTemplateTrackerSSDForwardAdditional(warp);
449  break;
450  case TRACKER_SSD_FORWARD_COMPOSITIONAL:
451  tracker = new vpTemplateTrackerSSDForwardCompositional(warp);
452  break;
453  case TRACKER_SSD_INVERSE_COMPOSITIONAL:
454  tracker = new vpTemplateTrackerSSDInverseCompositional(warp);
455  break;
456  case TRACKER_ZNCC_FORWARD_ADDITIONEL:
457  tracker = new vpTemplateTrackerZNCCForwardAdditional(warp);
458  break;
459  case TRACKER_ZNCC_INVERSE_COMPOSITIONAL:
460  tracker = new vpTemplateTrackerZNCCInverseCompositional(warp);
461  break;
462 #ifdef VISP_HAVE_MODULE_TT_MI
463  case TRACKER_MI_ESM:
464  tracker = new vpTemplateTrackerMIESM(warp);
465  break;
466  case TRACKER_MI_FORWARD_ADDITIONAL:
467  tracker = new vpTemplateTrackerMIForwardAdditional(warp);
468  break;
469  case TRACKER_MI_FORWARD_COMPOSITIONAL:
470  tracker = new vpTemplateTrackerMIForwardCompositional(warp);
471  break;
472  case TRACKER_MI_INVERSE_COMPOSITIONAL:
473  tracker = new vpTemplateTrackerMIInverseCompositional(warp);
474  break;
475 #endif
476  default:
477  return 0;
478  }
479 
480  tracker->setSampling(2, 2);
481  tracker->setLambda(0.001);
482  tracker->setThresholdGradient(60.);
483  tracker->setIterationMax(800);
484  if (opt_pyramidal) {
485  tracker->setPyramidal(2, 1);
486  }
487  tracker->setThresholdResidualDifference(opt_threshold_residual);
488  bool delaunay = false;
489  if (opt_display && opt_click_allowed)
490  tracker->initClick(I, delaunay);
491  else {
492  std::vector<vpImagePoint> v_ip;
493  vpImagePoint ip;
494  ip.set_ij(166, 54);
495  v_ip.push_back(ip);
496  ip.set_ij(284, 55);
497  v_ip.push_back(ip);
498  ip.set_ij(259, 284);
499  v_ip.push_back(ip); // ends the first triangle
500  ip.set_ij(259, 284);
501  v_ip.push_back(ip); // start the second triangle
502  ip.set_ij(149, 240);
503  v_ip.push_back(ip);
504  ip.set_ij(167, 58);
505  v_ip.push_back(ip);
506 
507  tracker->initFromPoints(I, v_ip, false);
508  }
509 
510  double t_init = vpTime::measureTimeMs();
511  int niter = 0;
512 
513  while (!reader.end()) {
514  // Acquire a new image
515  reader.acquire(I);
516  std::cout << "Process image number " << reader.getFrameIndex() << std::endl;
517  // Display the image
519  // Track the template
520  tracker->track(I);
521  // Save log
522  if (opt_log) {
523  ofs << tracker->getNbIteration() << std::endl;
524  }
525 
526  // Simulate a re-init
527  if (opt_reinit && (reader.getFrameIndex() == 10)) {
528  std::cout << "re-init simulation" << std::endl;
529  if (opt_click_allowed)
531 
532  tracker->resetTracker();
533 
534  if (opt_display && opt_click_allowed) {
535  vpDisplay::displayText(I, 10, 10, "Re-init simulation", vpColor::red);
536  vpDisplay::flush(I);
537  tracker->initClick(I, delaunay);
538  } else {
539  std::vector<vpImagePoint> v_ip;
540  vpImagePoint ip;
541  ip.set_ij(146, 60);
542  v_ip.push_back(ip);
543  ip.set_ij(254, 74);
544  v_ip.push_back(ip);
545  ip.set_ij(228, 288);
546  v_ip.push_back(ip); // ends the first triangle
547  ip.set_ij(228, 288);
548  v_ip.push_back(ip); // start the second triangle
549  ip.set_ij(126, 242);
550  v_ip.push_back(ip);
551  ip.set_ij(146, 60);
552  v_ip.push_back(ip);
553 
554  tracker->initFromPoints(I, v_ip, false);
555  }
556  }
557 
558 // Display the template
559 #if 1
560  tracker->display(I, vpColor::red, 3);
561 #else
562  vpTemplateTrackerZone zoneWarped_, zoneRef_ = tracker->getZoneRef();
563  vpTemplateTrackerWarp *warp_ = tracker->getWarp();
564  vpColVector p_ = tracker->getp();
565  warp_->warpZone(zoneRef_, p_, zoneWarped_);
566  zoneWarped_.display(I, vpColor::red, 3);
567  zoneRef_.display(I, vpColor::green, 3);
568 #endif
569 
570  vpDisplay::flush(I);
571 
572  niter ++;
573  }
574  double t_end = vpTime::measureTimeMs();
575  std::cout << "Total time: " << t_end - t_init << " ms" << std::endl;
576  std::cout << "Total mean: " << (t_end - t_init)/niter << " ms" << std::endl;
577 
578  if (opt_log) {
579  std::cout << "Log are saved in: " << logfilename << std::endl;
580  ofs.close();
581  }
582 
583  if (opt_click_allowed) {
584  vpDisplay::displayText(I, 10, 10, "A click to exit...", vpColor::red);
585  vpDisplay::flush(I);
587  }
588  reader.close();
589  if (display)
590  delete display;
591 
592  delete warp;
593  delete tracker;
594 
595  return EXIT_SUCCESS;
596  } catch (const vpException &e) {
597  std::cout << "Catch an exception: " << e << std::endl;
598  return EXIT_FAILURE;
599  }
600 #else
601  (void)argc;
602  (void)argv;
603  std::cout << "Cannot run this example: install Lapack, Eigen3 or OpenCV" << std::endl;
604 #endif
605 }
606 
607 #else
608 
609 int main()
610 {
611  std::cout << "visp_tt module or display not available." << std::endl;
612  return EXIT_SUCCESS;
613 }
614 
615 #endif
void display(const vpImage< unsigned char > &I, const vpColor &col=vpColor::green, unsigned int thickness=3)
long getFrameIndex() const
void setSampling(int sample_i, int sample_j)
Class that defines generic functionnalities for display.
Definition: vpDisplay.h:177
static bool getClick(const vpImage< unsigned char > &I, bool blocking=true)
static std::string getViSPImagesDataPath()
Definition: vpIoTools.cpp:1202
Display for windows using GDI (available on any windows 32 platform).
Definition: vpDisplayGDI.h:128
static void displayText(const vpImage< unsigned char > &I, const vpImagePoint &ip, const std::string &s, const vpColor &color)
Use the X11 console to display images on unix-like OS. Thus to enable this class X11 should be instal...
Definition: vpDisplayX.h:150
Class that enables to manipulate easily a video file or a sequence of images. As it inherits from the...
error that can be emited by ViSP classes.
Definition: vpException.h:71
void setIterationMax(const unsigned int &n)
static const vpColor green
Definition: vpColor.h:220
static void flush(const vpImage< unsigned char > &I)
VISP_EXPORT double measureTimeMs()
Definition: vpTime.cpp:126
vpColVector getp() const
static bool parse(int *argcPtr, const char **argv, vpArgvInfo *argTable, int flags)
Definition: vpParseArgv.cpp:69
static const vpColor red
Definition: vpColor.h:217
void open(vpImage< vpRGBa > &I)
void display(const vpImage< unsigned char > &I, const vpColor &col=vpColor::green, unsigned int thickness=3)
Display for windows using Direct3D 3rd party. Thus to enable this class Direct3D should be installed...
Definition: vpDisplayD3D.h:106
static std::string createFilePath(const std::string &parent, const std::string &child)
Definition: vpIoTools.cpp:1446
static void display(const vpImage< unsigned char > &I)
The vpDisplayOpenCV allows to display image using the OpenCV library. Thus to enable this class OpenC...
void initClick(const vpImage< unsigned char > &I, bool delaunay=false)
static std::string getUserName()
Definition: vpIoTools.cpp:228
The vpDisplayGTK allows to display image using the GTK 3rd party library. Thus to enable this class G...
Definition: vpDisplayGTK.h:134
void acquire(vpImage< vpRGBa > &I)
unsigned int getNbIteration() const
void initFromPoints(const vpImage< unsigned char > &I, const std::vector< vpImagePoint > &v_ip, bool delaunay=false)
void warpZone(const vpTemplateTrackerZone &in, const vpColVector &p, vpTemplateTrackerZone &out)
void set_ij(double ii, double jj)
Definition: vpImagePoint.h:188
void setLastFrameIndex(const long last_frame)
Implementation of column vector and the associated operations.
Definition: vpColVector.h:130
void setLambda(double l)
void track(const vpImage< unsigned char > &I)
void setFileName(const std::string &filename)
vpTemplateTrackerZone getZoneRef() const
void setFirstFrameIndex(const long first_frame)
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
Definition: vpImagePoint.h:87
void setThresholdResidualDifference(double threshold)
void setPyramidal(unsigned int nlevels=2, unsigned int level_to_stop=1)
vpTemplateTrackerWarp * getWarp() const
void setThresholdGradient(double threshold)