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