Visual Servoing Platform  version 3.2.0 under development (2019-01-22)
mbtEdgeKltTracking.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 Hybrid Tracking of MBT and MBT KTL.
33  *
34  * Authors:
35  * Aurelien Yol
36  *
37  *****************************************************************************/
38 
46 #include <iostream>
47 #include <visp3/core/vpConfig.h>
48 
49 #if defined(VISP_HAVE_MODULE_MBT) && defined(VISP_HAVE_MODULE_KLT) && defined(VISP_HAVE_OPENCV) && \
50  defined(VISP_HAVE_DISPLAY) && (VISP_HAVE_OPENCV_VERSION >= 0x020100)
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 #include <visp3/mbt/vpMbEdgeKltTracker.h>
65 
66 #define GETOPTARGS "x:m:i:n:de:chtfColwvp"
67 
68 void usage(const char *name, const char *badparam)
69 {
70  fprintf(stdout, "\n\
71 Example of tracking based on the 3D model.\n\
72 \n\
73 SYNOPSIS\n\
74  %s [-i <test image path>] [-x <config file>]\n\
75  [-m <model name>] [-n <initialisation file base name>] [-e <last frame index>]\n\
76  [-t] [-c] [-d] [-h] [-f] [-C] [-o] [-w] [-l] [-v] [-p]\n", name);
77 
78  fprintf(stdout, "\n\
79 OPTIONS: \n\
80  -i <input image path> \n\
81  Set image input path.\n\
82  From this path read images \n\
83  \"mbt/cube/image%%04d.ppm\". These \n\
84  images come from ViSP-images-x.y.z.tar.gz available \n\
85  on the ViSP website.\n\
86  Setting the VISP_INPUT_IMAGE_PATH environment\n\
87  variable produces the same behaviour than using\n\
88  this option.\n\
89 \n\
90  -x <config file> \n\
91  Set the config file (the xml file) to use.\n\
92  The config file is used to specify the parameters of the tracker.\n\
93 \n\
94  -m <model name> \n\
95  Specify the name of the file of the model\n\
96  The model can either be a vrml model (.wrl) or a .cao file.\n\
97 \n\
98  -e <last frame index> \n\
99  Specify the index of the last frame. Once reached, the tracking is stopped\n\
100 \n\
101  -f \n\
102  Do not use the vrml model, use the .cao one. These two models are \n\
103  equivalent and comes from ViSP-images-x.y.z.tar.gz available on the ViSP\n\
104  website. However, the .cao model allows to use the 3d model based tracker \n\
105  without Coin.\n\
106 \n\
107  -C \n\
108  Track only the cube (not the cylinder). In this case the models files are\n\
109  cube.cao or cube.wrl instead of cube_and_cylinder.cao and \n\
110  cube_and_cylinder.wrl.\n\
111 \n\
112  -n <initialisation file base name> \n\
113  Base name of the initialisation file. The file will be 'base_name'.init .\n\
114  This base name is also used for the optionnal picture specifying where to \n\
115  click (a .ppm picture).\n\
116 \n\
117  -t \n\
118  Turn off the display of the the moving edges and Klt points. \n\
119 \n\
120  -d \n\
121  Turn off the display.\n\
122 \n\
123  -c\n\
124  Disable the mouse click. Useful to automaze the \n\
125  execution of this program without humain intervention.\n\
126 \n\
127  -o\n\
128  Use Ogre3D for visibility tests\n\
129 \n\
130  -w\n\
131  When Ogre3D is enable [-o] show Ogre3D configuration dialog thatallows to set the renderer.\n\
132 \n\
133  -l\n\
134  Use the scanline for visibility tests.\n\
135 \n\
136  -v\n\
137  Compute covariance matrix.\n\
138 \n\
139  -p\n\
140  Compute gradient projection error.\n\
141 \n\
142  -h \n\
143  Print the help.\n\n");
144 
145  if (badparam)
146  fprintf(stdout, "\nERROR: Bad parameter [%s]\n", badparam);
147 }
148 
149 bool getOptions(int argc, const char **argv, std::string &ipath, std::string &configFile, std::string &modelFile,
150  std::string &initFile, long &lastFrame, bool &displayFeatures, bool &click_allowed, bool &display,
151  bool &cao3DModel, bool &trackCylinder, bool &useOgre, bool &showOgreConfigDialog, bool &useScanline,
152  bool &computeCovariance, bool &projectionError)
153 {
154  const char *optarg_;
155  int c;
156  while ((c = vpParseArgv::parse(argc, argv, GETOPTARGS, &optarg_)) > 1) {
157 
158  switch (c) {
159  case 'e':
160  lastFrame = atol(optarg_);
161  break;
162  case 'i':
163  ipath = optarg_;
164  break;
165  case 'x':
166  configFile = optarg_;
167  break;
168  case 'm':
169  modelFile = optarg_;
170  break;
171  case 'n':
172  initFile = optarg_;
173  break;
174  case 't':
175  displayFeatures = false;
176  break;
177  case 'f':
178  cao3DModel = true;
179  break;
180  case 'c':
181  click_allowed = false;
182  break;
183  case 'd':
184  display = false;
185  break;
186  case 'C':
187  trackCylinder = false;
188  break;
189  case 'o':
190  useOgre = true;
191  break;
192  case 'l':
193  useScanline = true;
194  break;
195  case 'w':
196  showOgreConfigDialog = true;
197  break;
198  case 'v':
199  computeCovariance = true;
200  break;
201  case 'p':
202  projectionError = true;
203  break;
204  case 'h':
205  usage(argv[0], NULL);
206  return false;
207  break;
208 
209  default:
210  usage(argv[0], optarg_);
211  return false;
212  break;
213  }
214  }
215 
216  if ((c == 1) || (c == -1)) {
217  // standalone param or error
218  usage(argv[0], NULL);
219  std::cerr << "ERROR: " << std::endl;
220  std::cerr << " Bad argument " << optarg_ << std::endl << std::endl;
221  return false;
222  }
223 
224  return true;
225 }
226 
227 int main(int argc, const char **argv)
228 {
229  try {
230  std::string env_ipath;
231  std::string opt_ipath;
232  std::string ipath;
233  std::string opt_configFile;
234  std::string configFile;
235  std::string opt_modelFile;
236  std::string modelFile;
237  std::string opt_initFile;
238  std::string initFile;
239  long opt_lastFrame = -1;
240  bool displayFeatures = true;
241  bool opt_click_allowed = true;
242  bool opt_display = true;
243  bool cao3DModel = false;
244  bool trackCylinder = true;
245  bool useOgre = false;
246  bool showOgreConfigDialog = false;
247  bool useScanline = false;
248  bool computeCovariance = false;
249  bool projectionError = false;
250  bool quit = false;
251 
252  // Get the visp-images-data package path or VISP_INPUT_IMAGE_PATH
253  // environment variable value
254  env_ipath = vpIoTools::getViSPImagesDataPath();
255 
256  // Set the default input path
257  if (!env_ipath.empty())
258  ipath = env_ipath;
259 
260  // Read the command line options
261  if (!getOptions(argc, argv, opt_ipath, opt_configFile, opt_modelFile, opt_initFile, opt_lastFrame, displayFeatures,
262  opt_click_allowed, opt_display, cao3DModel, trackCylinder, useOgre, showOgreConfigDialog,
263  useScanline, computeCovariance, projectionError)) {
264  return (-1);
265  }
266 
267  // Test if an input path is set
268  if (opt_ipath.empty() && env_ipath.empty()) {
269  usage(argv[0], NULL);
270  std::cerr << std::endl << "ERROR:" << std::endl;
271  std::cerr << " Use -i <visp image path> option or set VISP_INPUT_IMAGE_PATH " << std::endl
272  << " environment variable to specify the location of the " << std::endl
273  << " image path where test images are located." << std::endl
274  << std::endl;
275 
276  return (-1);
277  }
278 
279  // Get the option values
280  if (!opt_ipath.empty())
281  ipath = vpIoTools::createFilePath(opt_ipath, "mbt/cube/image%04d.pgm");
282  else
283  ipath = vpIoTools::createFilePath(env_ipath, "mbt/cube/image%04d.pgm");
284 
285  if (!opt_configFile.empty())
286  configFile = opt_configFile;
287  else if (!opt_ipath.empty())
288  configFile = vpIoTools::createFilePath(opt_ipath, "mbt/cube.xml");
289  else
290  configFile = vpIoTools::createFilePath(env_ipath, "mbt/cube.xml");
291 
292  if (!opt_modelFile.empty()) {
293  modelFile = opt_modelFile;
294  } else {
295  std::string modelFileCao;
296  std::string modelFileWrl;
297  if (trackCylinder) {
298  modelFileCao = "mbt/cube_and_cylinder.cao";
299  modelFileWrl = "mbt/cube_and_cylinder.wrl";
300  } else {
301  modelFileCao = "mbt/cube.cao";
302  modelFileWrl = "mbt/cube.wrl";
303  }
304 
305  if (!opt_ipath.empty()) {
306  if (cao3DModel) {
307  modelFile = vpIoTools::createFilePath(opt_ipath, modelFileCao);
308  } else {
309 #ifdef VISP_HAVE_COIN3D
310  modelFile = vpIoTools::createFilePath(opt_ipath, modelFileWrl);
311 #else
312  std::cerr << "Coin is not detected in ViSP. Use the .cao model instead." << std::endl;
313  modelFile = vpIoTools::createFilePath(opt_ipath, modelFileCao);
314 #endif
315  }
316  } else {
317  if (cao3DModel) {
318  modelFile = vpIoTools::createFilePath(env_ipath, modelFileCao);
319  } else {
320 #ifdef VISP_HAVE_COIN3D
321  modelFile = vpIoTools::createFilePath(env_ipath, modelFileWrl);
322 #else
323  std::cerr << "Coin is not detected in ViSP. Use the .cao model instead." << std::endl;
324  modelFile = vpIoTools::createFilePath(env_ipath, modelFileCao);
325 #endif
326  }
327  }
328  }
329 
330  if (!opt_initFile.empty())
331  initFile = opt_initFile;
332  else if (!opt_ipath.empty())
333  initFile = vpIoTools::createFilePath(opt_ipath, "mbt/cube");
334  else
335  initFile = vpIoTools::createFilePath(env_ipath, "mbt/cube");
336 
338  vpVideoReader reader;
339 
340  reader.setFileName(ipath);
341  try {
342  reader.open(I);
343  } catch (...) {
344  std::cout << "Cannot open sequence: " << ipath << std::endl;
345  return -1;
346  }
347 
348  if (opt_lastFrame > 1 && opt_lastFrame < reader.getLastFrameIndex())
349  reader.setLastFrameIndex(opt_lastFrame);
350 
351  reader.acquire(I);
352 
353 // initialise a display
354 #if defined VISP_HAVE_X11
355  vpDisplayX display;
356 #elif defined VISP_HAVE_GDI
357  vpDisplayGDI display;
358 #elif defined VISP_HAVE_OPENCV
359  vpDisplayOpenCV display;
360 #elif defined VISP_HAVE_D3D9
361  vpDisplayD3D display;
362 #elif defined VISP_HAVE_GTK
363  vpDisplayGTK display;
364 #else
365  opt_display = false;
366 #endif
367  if (opt_display) {
368 #if defined(VISP_HAVE_DISPLAY)
369  display.init(I, 100, 100, "Test tracking");
370 #endif
372  vpDisplay::flush(I);
373  }
374 
375  vpMbEdgeKltTracker tracker;
377  vpCameraParameters cam;
378 
379 // Initialise the tracker: camera parameters, moving edge and KLT settings
380 #if defined(VISP_HAVE_XML2)
381  // From the xml file
382  tracker.loadConfigFile(configFile);
383 #else
384  // By setting the parameters:
385  cam.initPersProjWithoutDistortion(547, 542, 338, 234);
386 
387  vpMe me;
388  me.setMaskSize(5);
389  me.setMaskNumber(180);
390  me.setRange(7);
391  me.setThreshold(5000);
392  me.setMu1(0.5);
393  me.setMu2(0.5);
394  me.setSampleStep(4);
395 
396  vpKltOpencv klt;
397  klt.setMaxFeatures(10000);
398  klt.setWindowSize(5);
399  klt.setQuality(0.01);
400  klt.setMinDistance(5);
401  klt.setHarrisFreeParameter(0.01);
402  klt.setBlockSize(3);
403  klt.setPyramidLevels(3);
404 
405  tracker.setCameraParameters(cam);
406  tracker.setMovingEdge(me);
407  tracker.setKltOpencv(klt);
408  tracker.setKltMaskBorder(5);
409  tracker.setAngleAppear(vpMath::rad(65));
410  tracker.setAngleDisappear(vpMath::rad(75));
411 
412  // Specify the clipping to
413  tracker.setNearClippingDistance(0.01);
414  tracker.setFarClippingDistance(0.90);
416 // tracker.setClipping(tracker.getClipping() | vpMbtPolygon::LEFT_CLIPPING |
417 // vpMbtPolygon::RIGHT_CLIPPING | vpMbtPolygon::UP_CLIPPING |
418 // vpMbtPolygon::DOWN_CLIPPING); // Equivalent to FOV_CLIPPING
419 #endif
420 
421  // Display the moving edges, and the Klt points
422  tracker.setDisplayFeatures(displayFeatures);
423 
424  // Tells if the tracker has to use Ogre3D for visibility tests
425  tracker.setOgreVisibilityTest(useOgre);
426  if (useOgre)
427  tracker.setOgreShowConfigDialog(showOgreConfigDialog);
428 
429  // Tells if the tracker has to use the scanline visibility tests
430  tracker.setScanLineVisibilityTest(useScanline);
431 
432  // Tells if the tracker has to compute the covariance matrix
433  tracker.setCovarianceComputation(computeCovariance);
434 
435  // Tells if the tracker has to compute the projection error
436  tracker.setProjectionErrorComputation(projectionError);
437 
438  // Retrieve the camera parameters from the tracker
439  tracker.getCameraParameters(cam);
440 
441  // Loop to position the cube
442  if (opt_display && opt_click_allowed) {
443  while (!vpDisplay::getClick(I, false)) {
445  vpDisplay::displayText(I, 15, 10, "click after positioning the object", vpColor::red);
446  vpDisplay::flush(I);
447  vpTime::wait(100);
448  }
449  }
450 
451  // Load the 3D model (either a vrml file or a .cao file)
452  tracker.loadModel(modelFile);
453 
454  // Initialise the tracker by clicking on the image
455  // This function looks for
456  // - a ./cube/cube.init file that defines the 3d coordinates (in meter,
457  // in the object basis) of the points used for the initialisation
458  // - a ./cube/cube.ppm file to display where the user have to click
459  // (optionnal, set by the third parameter)
460  if (opt_display && opt_click_allowed) {
461  tracker.initClick(I, initFile, true);
462  tracker.getPose(cMo);
463  // display the 3D model at the given pose
464  tracker.display(I, cMo, cam, vpColor::red);
465  } else {
466  vpHomogeneousMatrix cMoi(0.02044769891, 0.1101505452, 0.5078963719, 2.063603907, 1.110231561, -0.4392789872);
467  tracker.initFromPose(I, cMoi);
468  }
469 
470  // track the model
471  tracker.track(I);
472  tracker.getPose(cMo);
473 
474  if (opt_display)
475  vpDisplay::flush(I);
476 
477  while (!reader.end()) {
478  // acquire a new image
479  reader.acquire(I);
480  // display the image
481  if (opt_display)
483 
484  // Test to reset the tracker
485  if (reader.getFrameIndex() == reader.getFirstFrameIndex() + 10) {
486  vpTRACE("Test reset tracker");
487  if (opt_display)
489  tracker.resetTracker();
490 #if defined(VISP_HAVE_XML2)
491  tracker.loadConfigFile(configFile);
492 #else
493  // By setting the parameters:
494  cam.initPersProjWithoutDistortion(547, 542, 338, 234);
495 
496  vpMe me;
497  me.setMaskSize(5);
498  me.setMaskNumber(180);
499  me.setRange(7);
500  me.setThreshold(5000);
501  me.setMu1(0.5);
502  me.setMu2(0.5);
503  me.setSampleStep(4);
504 
505  vpKltOpencv klt;
506  klt.setMaxFeatures(10000);
507  klt.setWindowSize(5);
508  klt.setQuality(0.01);
509  klt.setMinDistance(5);
510  klt.setHarrisFreeParameter(0.01);
511  klt.setBlockSize(3);
512  klt.setPyramidLevels(3);
513 
514  tracker.setCameraParameters(cam);
515  tracker.setMovingEdge(me);
516  tracker.setKltOpencv(klt);
517  tracker.setKltMaskBorder(5);
518  tracker.setAngleAppear(vpMath::rad(65));
519  tracker.setAngleDisappear(vpMath::rad(75));
520 
521  // Specify the clipping to
522  tracker.setNearClippingDistance(0.01);
523  tracker.setFarClippingDistance(0.90);
525 // tracker.setClipping(tracker.getClipping() | vpMbtPolygon::LEFT_CLIPPING |
526 // vpMbtPolygon::RIGHT_CLIPPING | vpMbtPolygon::UP_CLIPPING |
527 // vpMbtPolygon::DOWN_CLIPPING); // Equivalent to FOV_CLIPPING
528 #endif
529  tracker.loadModel(modelFile);
530  tracker.setCameraParameters(cam);
531  tracker.setOgreVisibilityTest(useOgre);
532  tracker.setScanLineVisibilityTest(useScanline);
533  tracker.setCovarianceComputation(computeCovariance);
534  tracker.setProjectionErrorComputation(projectionError);
535  tracker.initFromPose(I, cMo);
536  }
537 
538  // Test to set an initial pose
539  if (reader.getFrameIndex() == reader.getFirstFrameIndex() + 50) {
540  cMo.buildFrom(0.0439540832, 0.0845870108, 0.5477322481, 2.179498458, 0.8611798108, -0.3491961946);
541  vpTRACE("Test set pose");
542  tracker.setPose(I, cMo);
543  // if (opt_display) {
544  // // display the 3D model
545  // tracker.display(I, cMo, cam, vpColor::darkRed);
546  // // display the frame
547  // vpDisplay::displayFrame (I, cMo, cam, 0.05);
552  // }
553  }
554 
555  // track the object: stop tracking from frame 40 to 50
556  if (reader.getFrameIndex() - reader.getFirstFrameIndex() < 40 ||
557  reader.getFrameIndex() - reader.getFirstFrameIndex() >= 50) {
558  tracker.track(I);
559  tracker.getPose(cMo);
560  if (opt_display) {
561  // display the 3D model
562  tracker.display(I, cMo, cam, vpColor::darkRed);
563  // display the frame
564  vpDisplay::displayFrame(I, cMo, cam, 0.05);
565  }
566  }
567 
568  if (opt_click_allowed) {
569  vpDisplay::displayText(I, 10, 10, "Click to quit", vpColor::red);
570  if (vpDisplay::getClick(I, false)) {
571  quit = true;
572  break;
573  }
574  }
575 
576  if (computeCovariance) {
577  std::cout << "Covariance matrix: \n" << tracker.getCovarianceMatrix() << std::endl << std::endl;
578  }
579 
580  if (projectionError) {
581  std::cout << "Projection error: " << tracker.getProjectionError() << std::endl << std::endl;
582  }
583 
584  if (opt_display)
585  vpDisplay::flush(I);
586  }
587 
588  std::cout << "Reached last frame: " << reader.getFrameIndex() << std::endl;
589 
590  if (opt_click_allowed && !quit) {
592  }
593  reader.close();
594 
595 #if defined(VISP_HAVE_XML2)
596  // Cleanup memory allocated by xml library used to parse the xml config
597  // file in vpMbEdgeKltTracker::loadConfigFile()
599 #endif
600 
601 #if defined(VISP_HAVE_COIN3D) && (COIN_MAJOR_VERSION >= 2)
602  // Cleanup memory allocated by Coin library used to load a vrml model in
603  // vpMbEdgeKltTracker::loadModel() We clean only if Coin was used.
604  if (!cao3DModel)
605  SoDB::finish();
606 #endif
607 
608  return EXIT_SUCCESS;
609  } catch (const vpException &e) {
610  std::cout << "Catch an exception: " << e << std::endl;
611  return EXIT_FAILURE;
612  }
613 }
614 
615 #else
616 
617 int main()
618 {
619  std::cout << "visp_mbt, visp_gui modules and OpenCV are required to run "
620  "this example."
621  << std::endl;
622  return EXIT_SUCCESS;
623 }
624 
625 #endif
virtual void setKltOpencv(const vpKltOpencv &t)
virtual void setDisplayFeatures(const bool displayF)
Definition: vpMbTracker.h:503
virtual void setCovarianceComputation(const bool &flag)
Definition: vpMbTracker.h:485
virtual void setOgreShowConfigDialog(const bool showConfigDialog)
Definition: vpMbTracker.h:629
void setMovingEdge(const vpMe &me)
VISP_EXPORT int wait(double t0, double t)
Definition: vpTime.cpp:150
long getFrameIndex() const
static bool getClick(const vpImage< unsigned char > &I, bool blocking=true)
static std::string getViSPImagesDataPath()
Definition: vpIoTools.cpp:1316
virtual void setScanLineVisibilityTest(const bool &v)
void setHarrisFreeParameter(double harris_k)
virtual unsigned int getClipping() const
Definition: vpMbTracker.h:256
virtual void setAngleDisappear(const double &a)
Definition: vpMbTracker.h:466
Implementation of an homogeneous matrix and operations on such kind of matrices.
void setMaskNumber(const unsigned int &a)
Definition: vpMe.cpp:454
virtual void loadConfigFile(const std::string &configFile)
static const vpColor darkRed
Definition: vpColor.h:181
Display for windows using GDI (available on any windows 32 platform).
Definition: vpDisplayGDI.h:129
virtual void loadModel(const std::string &modelFile, const bool verbose=false, const vpHomogeneousMatrix &T=vpHomogeneousMatrix())
void setMaxFeatures(const int maxCount)
void setSampleStep(const double &s)
Definition: vpMe.h:278
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:151
Class that enables to manipulate easily a video file or a sequence of images. As it inherits from the...
void setMinDistance(double minDistance)
error that can be emited by ViSP classes.
Definition: vpException.h:71
Definition: vpMe.h:60
virtual void setClipping(const unsigned int &flags)
void setKltMaskBorder(const unsigned int &e)
virtual void initFromPose(const vpImage< unsigned char > &I, const std::string &initFile)
static void flush(const vpImage< unsigned char > &I)
long getFirstFrameIndex()
virtual void setFarClippingDistance(const double &dist)
void setMu1(const double &mu_1)
Definition: vpMe.h:241
static bool parse(int *argcPtr, const char **argv, vpArgvInfo *argTable, int flags)
Definition: vpParseArgv.cpp:69
static const vpColor red
Definition: vpColor.h:180
void setQuality(double qualityLevel)
void initPersProjWithoutDistortion(const double px, const double py, const double u0, const double v0)
void open(vpImage< vpRGBa > &I)
long getLastFrameIndex()
virtual void setOgreVisibilityTest(const bool &v)
Display for windows using Direct3D 3rd party. Thus to enable this class Direct3D should be installed...
Definition: vpDisplayD3D.h:107
static std::string createFilePath(const std::string &parent, const std::string &child)
Definition: vpIoTools.cpp:1541
void setMaskSize(const unsigned int &a)
Definition: vpMe.cpp:461
virtual void setProjectionErrorComputation(const bool &flag)
#define vpTRACE
Definition: vpDebug.h:416
static void display(const vpImage< unsigned char > &I)
The vpDisplayOpenCV allows to display image using the OpenCV library. Thus to enable this class OpenC...
virtual void setPose(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cdMo)
virtual void track(const vpImage< unsigned char > &I)
virtual void getCameraParameters(vpCameraParameters &camera) const
Definition: vpMbTracker.h:248
virtual void display(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam, const vpColor &col, const unsigned int thickness=1, const bool displayFullModel=false)
virtual double getProjectionError() const
Definition: vpMbTracker.h:310
Generic class defining intrinsic camera parameters.
The vpDisplayGTK allows to display image using the GTK 3rd party library. Thus to enable this class G...
Definition: vpDisplayGTK.h:138
void acquire(vpImage< vpRGBa > &I)
void setFileName(const char *filename)
virtual void setAngleAppear(const double &a)
Definition: vpMbTracker.h:455
void setPyramidLevels(const int pyrMaxLevel)
void buildFrom(const vpTranslationVector &t, const vpRotationMatrix &R)
static double rad(double deg)
Definition: vpMath.h:102
virtual void setCameraParameters(const vpCameraParameters &cam)
void init(vpImage< unsigned char > &I, int winx=-1, int winy=-1, const std::string &title="")
Hybrid tracker based on moving-edges and keypoints tracked using KLT tracker.
static void cleanup()
Definition: vpXmlParser.h:310
void setMu2(const double &mu_2)
Definition: vpMe.h:248
void setWindowSize(const int winSize)
void setLastFrameIndex(const long last_frame)
static void displayFrame(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam, double size, const vpColor &color=vpColor::none, unsigned int thickness=1, const vpImagePoint &offset=vpImagePoint(0, 0))
Wrapper for the KLT (Kanade-Lucas-Tomasi) feature tracker implemented in OpenCV. Thus to enable this ...
Definition: vpKltOpencv.h:78
virtual void getPose(vpHomogeneousMatrix &cMo_) const
Definition: vpMbTracker.h:414
void setBlockSize(const int blockSize)
void setThreshold(const double &t)
Definition: vpMe.h:300
virtual void initClick(const vpImage< unsigned char > &I, const std::string &initFile, const bool displayHelp=false, const vpHomogeneousMatrix &T=vpHomogeneousMatrix())
void setRange(const unsigned int &r)
Definition: vpMe.h:271
virtual void setNearClippingDistance(const double &dist)
virtual vpMatrix getCovarianceMatrix() const
Definition: vpMbTracker.h:265