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