Visual Servoing Platform  version 3.2.0 under development (2019-01-22)
tutorial-mb-generic-tracker-live.cpp
1 #include <visp3/core/vpConfig.h>
3 #ifdef VISP_HAVE_MODULE_SENSOR
4 #include <visp3/sensor/vpV4l2Grabber.h>
5 #include <visp3/sensor/vp1394CMUGrabber.h>
6 #include <visp3/sensor/vp1394TwoGrabber.h>
7 #include <visp3/sensor/vpFlyCaptureGrabber.h>
8 #include <visp3/sensor/vpRealSense2.h>
9 #endif
10 #include <visp3/core/vpIoTools.h>
11 #include <visp3/core/vpXmlParserCamera.h>
12 #include <visp3/gui/vpDisplayGDI.h>
13 #include <visp3/gui/vpDisplayOpenCV.h>
14 #include <visp3/gui/vpDisplayX.h>
15 #include <visp3/io/vpImageIo.h>
16 #include <visp3/vision/vpKeyPoint.h>
18 #include <visp3/mbt/vpMbGenericTracker.h>
20 
22 //#undef VISP_HAVE_V4L2
23 //#undef VISP_HAVE_DC1394
24 //#undef VISP_HAVE_CMU1394
25 //#undef VISP_HAVE_FLYCAPTURE
26 //#undef VISP_HAVE_REALSENSE2
27 //#undef VISP_HAVE_OPENCV
29 
30 int main(int argc, char **argv)
31 {
32 #if defined(VISP_HAVE_OPENCV) && \
33  (defined(VISP_HAVE_V4L2) || defined(VISP_HAVE_DC1394) || defined(VISP_HAVE_CMU1394) || (VISP_HAVE_OPENCV_VERSION >= 0x020100) || defined(VISP_HAVE_FLYCAPTURE) || defined(VISP_HAVE_REALSENSE2) )
34 
35  try {
36  std::string opt_modelname = "teabox";
37  int opt_tracker = 2;
38  int opt_device = 0; // For OpenCV and V4l2 grabber to set the camera device
39  double opt_proj_error_threshold = 20.;
40  bool opt_use_ogre = false;
41  bool opt_use_scanline = false;
42  bool opt_display_projection_error = false;
43  bool opt_learn = false;
44  bool opt_auto_init = false;
45  std::string opt_learning_data = "learning/data-learned.bin";
46  std::string opt_intrinsic_file = "";
47  std::string opt_camera_name = "";
48 
49  for (int i = 0; i < argc; i++) {
50  if (std::string(argv[i]) == "--model") {
51  opt_modelname = std::string(argv[i + 1]);
52  }
53  else if (std::string(argv[i]) == "--tracker") {
54  opt_tracker = atoi(argv[i + 1]);
55  }
56  else if (std::string(argv[i]) == "--camera_device" && i + 1 < argc) {
57  opt_device = atoi(argv[i + 1]);
58  }
59  else if (std::string(argv[i]) == "--max_proj_error") {
60  opt_proj_error_threshold = atof(argv[i + 1]);
61  } else if (std::string(argv[i]) == "--use_ogre") {
62  opt_use_ogre = true;
63  } else if (std::string(argv[i]) == "--use_scanline") {
64  opt_use_scanline = true;
65  } else if (std::string(argv[i]) == "--learn") {
66  opt_learn = true;
67  } else if (std::string(argv[i]) == "--learning_data" && i+1 < argc) {
68  opt_learning_data = argv[i+1];
69  } else if (std::string(argv[i]) == "--auto_init") {
70  opt_auto_init = true;
71  } else if (std::string(argv[i]) == "--display_proj_error") {
72  opt_display_projection_error = true;
73  } else if (std::string(argv[i]) == "--intrinsic" && i + 1 < argc) {
74  opt_intrinsic_file = std::string(argv[i + 1]);
75  } else if (std::string(argv[i]) == "--camera_name" && i + 1 < argc) {
76  opt_camera_name = std::string(argv[i + 1]);
77  }
78  else if (std::string(argv[i]) == "--help" || std::string(argv[i]) == "-h") {
79  std::cout << "\nUsage: " << argv[0]
80  << " [--camera_device <camera device> (default: 0)]"
81  << " [--intrinsic <intrinsic file> (default: empty)]"
82  << " [--camera_name <camera name>] (default: empty)"
83  << " [--model <model name> (default: teabox)]"
84  << " [--tracker <0=egde|1=keypoint|2=hybrid> (default: 2)]"
85  << " [--use_ogre] [--use_scanline]"
86  << " [--max_proj_error <allowed projection error> (default: 20)]"
87  << " [--learn] [--auto_init] [--learning_data <data-learned.bin> (default: learning/data-learned.bin)]"
88  << " [--display_proj_error]"
89  << " [--help] [-h]\n"
90  << std::endl;
91  return 0;
92  }
93  }
94  std::string parentname = vpIoTools::getParent(opt_modelname);
95  std::string objectname = vpIoTools::getNameWE(opt_modelname);
96 
97  if (!parentname.empty())
98  objectname = parentname + "/" + objectname;
99 
100  std::cout << "Tracker requested config files: " << objectname << ".[init, cao]" << std::endl;
101  std::cout << "Tracker optional config files: " << objectname << ".[ppm]" << std::endl;
102 
103  std::cout << "Tracked features: " << std::endl;
104  std::cout << " Use edges : " << (opt_tracker == 0 || opt_tracker == 2) << std::endl;
105  std::cout << " Use klt : " << (opt_tracker == 1 || opt_tracker == 2) << std::endl;
106  std::cout << "Tracker options: " << std::endl;
107  std::cout << " Use ogre : " << opt_use_ogre << std::endl;
108  std::cout << " Use scanline: " << opt_use_scanline << std::endl;
109  std::cout << " Proj. error : " << opt_proj_error_threshold << std::endl;
110  std::cout << " Display proj. error: " << opt_display_projection_error << std::endl;
111  std::cout << "Config files: " << std::endl;
112  std::cout << " Config file: " << "\"" << objectname + ".xml" << "\"" << std::endl;
113  std::cout << " Model file : " << "\"" << objectname + ".cao" << "\"" << std::endl;
114  std::cout << " Init file : " << "\"" << objectname + ".init" << "\"" << std::endl;
115  std::cout << "Learning options : " << std::endl;
116  std::cout << " Learn : " << opt_learn << std::endl;
117  std::cout << " Auto init : " << opt_auto_init << std::endl;
118  std::cout << " Learning data: " << opt_learning_data << std::endl;
119 
123 
125  vpCameraParameters cam;
126  cam.initPersProjWithoutDistortion(839, 839, 325, 243);
128 #ifdef VISP_HAVE_XML2
129  vpXmlParserCamera parser;
130  if (!opt_intrinsic_file.empty() && !opt_camera_name.empty())
131  parser.parse(cam, opt_intrinsic_file, opt_camera_name, vpCameraParameters::perspectiveProjWithoutDistortion);
132 #endif
133 
137 
139 #if defined(VISP_HAVE_V4L2)
140  vpV4l2Grabber g;
141  std::ostringstream device;
142  device << "/dev/video" << opt_device;
143  std::cout << "Use Video 4 Linux grabber on device " << device.str() << std::endl;
144  g.setDevice(device.str());
145  g.setScale(1);
146  g.open(I);
147 #elif defined(VISP_HAVE_DC1394)
148  (void)opt_device; // To avoid non used warning
149  std::cout << "Use DC1394 grabber" << std::endl;
151  g.open(I);
152 #elif defined(VISP_HAVE_CMU1394)
153  (void)opt_device; // To avoid non used warning
154  std::cout << "Use CMU1394 grabber" << std::endl;
156  g.open(I);
157 #elif defined(VISP_HAVE_FLYCAPTURE)
158  (void)opt_device; // To avoid non used warning
159  std::cout << "Use FlyCapture grabber" << std::endl;
161  g.open(I);
162 #elif defined(VISP_HAVE_REALSENSE2)
163  (void)opt_device; // To avoid non used warning
164  std::cout << "Use Realsense 2 grabber" << std::endl;
165  vpRealSense2 g;
166  rs2::config config;
167  config.disable_stream(RS2_STREAM_DEPTH);
168  config.disable_stream(RS2_STREAM_INFRARED);
169  config.enable_stream(RS2_STREAM_COLOR, 640, 480, RS2_FORMAT_RGBA8, 30);
170  g.open(config);
171  g.acquire(I);
172 
173  std::cout << "Read camera parameters from Realsense device" << std::endl;
175 
176 #elif defined(VISP_HAVE_OPENCV)
177  std::cout << "Use OpenCV grabber on device " << opt_device << std::endl;
178  cv::VideoCapture g(opt_device); // Open the default camera
179  if (!g.isOpened()) { // Check if we succeeded
180  std::cout << "Failed to open the camera" << std::endl;
181  return -1;
182  }
183  cv::Mat frame;
184  g >> frame; // get a new frame from camera
185  vpImageConvert::convert(frame, I);
186 #endif
187 
189  vpDisplay *display = NULL;
190 #if defined(VISP_HAVE_X11)
191  display = new vpDisplayX;
192 #elif defined(VISP_HAVE_GDI)
193  display = new vpDisplayGDI;
194 #else
195  display = new vpDisplayOpenCV;
196 #endif
197  display->init(I, 100, 100, "Model-based tracker");
198 
199  while (true) {
200 #if defined(VISP_HAVE_V4L2) || defined(VISP_HAVE_DC1394) || defined(VISP_HAVE_CMU1394) || defined(VISP_HAVE_FLYCAPTURE) || defined(VISP_HAVE_REALSENSE2)
201  g.acquire(I);
202 #elif defined(VISP_HAVE_OPENCV)
203  g >> frame;
204  vpImageConvert::convert(frame, I);
205 #endif
206 
208  vpDisplay::displayText(I, 20, 20, "Click when ready.", vpColor::red);
209  vpDisplay::flush(I);
210 
211  if (vpDisplay::getClick(I, false)) {
212  break;
213  }
214  }
215 
217  vpMbGenericTracker tracker;
218  tracker.setProjectionErrorComputation(true); // To detect tracking failure
219  if (opt_tracker == 0)
221 #if defined(VISP_HAVE_MODULE_KLT) && defined(VISP_HAVE_OPENCV)
222  else if (opt_tracker == 1)
224  else
226 #else
227  else {
228 # if !defined(VISP_HAVE_MODULE_KLT)
229  std::cout << "klt and hybrid model-based tracker are not available since visp_klt module is not available. "
230  "In CMakeGUI turn visp_klt module ON, configure and build ViSP again."
231  << std::endl;
232 # else
233  std::cout << "Hybrid tracking is impossible since OpenCV is not enabled. "
234  << "Install OpenCV, configure and build ViSP again to run this tutorial."
235  << std::endl;
236 # endif
237  return EXIT_SUCCESS;
238  }
239 #endif
240 
242  bool usexml = false;
244 #ifdef VISP_HAVE_XML2
245  if (vpIoTools::checkFilename(objectname + ".xml")) {
246  tracker.loadConfigFile(objectname + ".xml");
247  usexml = true;
248  }
249 #endif
250 
252  if (!usexml) {
254  if (opt_tracker == 0 || opt_tracker == 2) {
256  vpMe me;
257  me.setMaskSize(5);
258  me.setMaskNumber(180);
259  me.setRange(8);
260  me.setThreshold(10000);
261  me.setMu1(0.5);
262  me.setMu2(0.5);
263  me.setSampleStep(4);
264  tracker.setMovingEdge(me);
266  }
267 
268 #ifdef VISP_HAVE_MODULE_KLT
269  if (opt_tracker == 1 || opt_tracker == 2) {
271  vpKltOpencv klt_settings;
272  klt_settings.setMaxFeatures(300);
273  klt_settings.setWindowSize(5);
274  klt_settings.setQuality(0.015);
275  klt_settings.setMinDistance(8);
276  klt_settings.setHarrisFreeParameter(0.01);
277  klt_settings.setBlockSize(3);
278  klt_settings.setPyramidLevels(3);
279  tracker.setKltOpencv(klt_settings);
280  tracker.setKltMaskBorder(5);
282  }
283 #endif
284  }
285 
286  tracker.setCameraParameters(cam);
288 
290  tracker.loadModel(objectname + ".cao");
293  tracker.setDisplayFeatures(true);
296  tracker.setOgreVisibilityTest(opt_use_ogre);
297  tracker.setScanLineVisibilityTest(opt_use_scanline);
300  tracker.setProjectionErrorComputation(true);
301  tracker.setProjectionErrorDisplay(opt_display_projection_error);
303 
304 #if (defined(VISP_HAVE_OPENCV_NONFREE) || defined(VISP_HAVE_OPENCV_XFEATURES2D))
305  std::string detectorName = "SIFT";
306  std::string extractorName = "SIFT";
307  std::string matcherName = "BruteForce";
308 #else
309  std::string detectorName = "FAST";
310  std::string extractorName = "ORB";
311  std::string matcherName = "BruteForce-Hamming";
312 #endif
313  vpKeyPoint keypoint;
314  if (opt_learn || opt_auto_init) {
315  keypoint.setDetector(detectorName);
316  keypoint.setExtractor(extractorName);
317  keypoint.setMatcher(matcherName);
318 #if !(defined(VISP_HAVE_OPENCV_NONFREE) || defined(VISP_HAVE_OPENCV_XFEATURES2D))
319 # if (VISP_HAVE_OPENCV_VERSION < 0x030000)
320  keypoint.setDetectorParameter("ORB", "nLevels", 1);
321 # else
322  cv::Ptr<cv::ORB> orb_detector = keypoint.getDetector("ORB").dynamicCast<cv::ORB>();
323  if (orb_detector) {
324  orb_detector->setNLevels(1);
325  }
326 # endif
327 #endif
328  }
329 
330  if (opt_auto_init) {
331  if (!vpIoTools::checkFilename(opt_learning_data)) {
332  std::cout << "Cannot enable auto detection. Learning file \"" << opt_learning_data << "\" doesn't exist" << std::endl;
333  return EXIT_FAILURE;
334  }
335  keypoint.loadLearningData(opt_learning_data, true);
336  }
337  else {
338  tracker.initClick(I, objectname + ".init", true);
339  }
340 
341  bool learn_position = false;
342  bool run_auto_init = false;
343  if (opt_auto_init) {
344  run_auto_init = true;
345  }
346 
347  //To be able to display keypoints matching with test-detection-rs2
348  int learn_id = 1;
349  bool quit = false;
350 
351  while (!quit) {
352  double t_begin = vpTime::measureTimeMs();
353  bool tracking_failed = false;
354 #if defined(VISP_HAVE_V4L2) || defined(VISP_HAVE_DC1394) || defined(VISP_HAVE_CMU1394) || defined(VISP_HAVE_FLYCAPTURE) || defined(VISP_HAVE_REALSENSE2)
355  g.acquire(I);
356 #elif defined(VISP_HAVE_OPENCV)
357  g >> frame;
358  vpImageConvert::convert(frame, I);
359 #endif
361 
362  // Run auto initialization from learned data
363  if (run_auto_init) {
364  if (keypoint.matchPoint(I, cam, cMo)) {
365  std::cout << "Auto init succeed" << std::endl;
366  tracker.initFromPose(I, cMo);
367  } else {
368  vpDisplay::flush(I);
369  continue;
370  }
371  }
372 
373  // Run the tracker
374  try {
375  if (run_auto_init) {
376  // Turn display features off just after auto init to not display wrong moving-edge if the tracker fails
377  tracker.setDisplayFeatures(false);
378 
379  run_auto_init = false;
380  }
381  tracker.track(I);
382  } catch (const vpException &e) {
383  std::cout << "Tracker exception: " << e.getStringMessage() << std::endl;
384  tracking_failed = true;
385  if (opt_auto_init) {
386  std::cout << "Tracker needs to restart (tracking exception)" << std::endl;
387  run_auto_init = true;
388  }
389  }
390 
391  if (! tracking_failed) {
392  double proj_error = 0;
394  // Check tracking errors
395  proj_error = tracker.getProjectionError();
396  }
397  else {
398  tracker.getPose(cMo);
399  tracker.getCameraParameters(cam);
400  proj_error = tracker.computeCurrentProjectionError(I, cMo, cam);
401  }
402  if (proj_error > opt_proj_error_threshold) {
403  std::cout << "Tracker needs to restart (projection error detected: " << proj_error << ")" << std::endl;
404  if (opt_auto_init) {
405  run_auto_init = true;
406  }
407  tracking_failed = true;
408  }
409  }
410 
411  if (! tracking_failed) {
412  tracker.setDisplayFeatures(true);
414  tracker.getPose(cMo);
417  tracker.getCameraParameters(cam);
418  tracker.display(I, cMo, cam, vpColor::green, 2, false);
420  vpDisplay::displayFrame(I, cMo, cam, 0.025, vpColor::none, 3);
421 
422  { // Display estimated pose in [m] and [deg]
423  vpPoseVector pose(cMo);
424  std::stringstream ss;
425  ss << "Translation: " << std::setprecision(5) << pose[0] << " " << pose[1] << " " << pose[2] << " [m]";
426  vpDisplay::displayText(I, 80, 20, ss.str(), vpColor::green);
427  ss.str(""); // erase ss
428  ss << "Rotation tu: " << std::setprecision(4) << vpMath::deg(pose[3]) << " " << vpMath::deg(pose[4]) << " " << vpMath::deg(pose[5]) << " [deg]";
429  vpDisplay::displayText(I, 100, 20, ss.str(), vpColor::green);
430  }
431  }
432 
433  if (learn_position) {
434  // Detect keypoints on the current image
435  std::vector<cv::KeyPoint> trainKeyPoints;
436  keypoint.detect(I, trainKeyPoints);
437 
438  // Keep only keypoints on the cube
439  std::vector<vpPolygon> polygons;
440  std::vector<std::vector<vpPoint> > roisPt;
441  std::pair<std::vector<vpPolygon>, std::vector<std::vector<vpPoint> > > pair = tracker.getPolygonFaces();
442  polygons = pair.first;
443  roisPt = pair.second;
444 
445  // Compute the 3D coordinates
446  std::vector<cv::Point3f> points3f;
447  vpKeyPoint::compute3DForPointsInPolygons(cMo, cam, trainKeyPoints, polygons, roisPt, points3f);
448 
449  // Build the reference keypoints
450  keypoint.buildReference(I, trainKeyPoints, points3f, true, learn_id++);
451 
452  // Display learned data
453  for (std::vector<cv::KeyPoint>::const_iterator it = trainKeyPoints.begin(); it != trainKeyPoints.end(); ++it) {
454  vpDisplay::displayCross(I, (int)it->pt.y, (int)it->pt.x, 10, vpColor::yellow, 3);
455  }
456  learn_position = false;
457  std::cout << "Data learned" << std::endl;
458  }
459 
460  std::stringstream ss;
461  ss << "Loop time: " << vpTime::measureTimeMs() - t_begin << " ms";
462  vpDisplay::displayText(I, 20, 20, ss.str(), vpColor::red);
463  if (opt_learn)
464  vpDisplay::displayText(I, 35, 20, "Left click: learn Right click: quit", vpColor::red);
465  else if (opt_auto_init)
466  vpDisplay::displayText(I, 35, 20, "Left click: auto_init Right click: quit", vpColor::red);
467  else
468  vpDisplay::displayText(I, 35, 20, "Right click: quit", vpColor::red);
469 
471  if (vpDisplay::getClick(I, button, false)) {
472  if (button == vpMouseButton::button3) {
473  quit = true;
474  } else if (button == vpMouseButton::button1 && opt_learn) {
475  learn_position = true;
476  } else if (button == vpMouseButton::button1 && opt_auto_init && !opt_learn) {
477  run_auto_init = true;
478  }
479  }
480 
481  vpDisplay::flush(I);
482  }
483  if (opt_learn) {
484  std::cout << "Save learning file: " << opt_learning_data << std::endl;
485  keypoint.saveLearningData(opt_learning_data, true, true);
486  }
487 
489  delete display;
491  } catch (const vpException &e) {
492  std::cout << "Catch a ViSP exception: " << e << std::endl;
493  }
494 #elif defined(VISP_HAVE_OPENCV)
495  (void) argc;
496  (void) argv;
497  std::cout << "Install a 3rd party dedicated to frame grabbing (dc1394, cmu1394, v4l2, OpenCV, FlyCapture, Realsense2), configure and build ViSP again to use this example" << std::endl;
498 #else
499  (void) argc;
500  (void) argv;
501  std::cout << "Install OpenCV 3rd party, configure and build ViSP again to use this example" << std::endl;
502 #endif
503 }
virtual void setDisplayFeatures(const bool displayF)
virtual void loadConfigFile(const std::string &configFile)
Class that defines generic functionnalities for display.
Definition: vpDisplay.h:171
virtual void track(const vpImage< unsigned char > &I)
static bool getClick(const vpImage< unsigned char > &I, bool blocking=true)
virtual std::pair< std::vector< vpPolygon >, std::vector< std::vector< vpPoint > > > getPolygonFaces(const bool orderPolygons=true, const bool useVisibility=true, const bool clipPolygon=false)
void open(vpImage< unsigned char > &I)
void setHarrisFreeParameter(double harris_k)
static void convert(const vpImage< unsigned char > &src, vpImage< vpRGBa > &dest)
Implementation of an homogeneous matrix and operations on such kind of matrices.
void open(vpImage< unsigned char > &I)
void setMaskNumber(const unsigned int &a)
Definition: vpMe.cpp:454
Display for windows using GDI (available on any windows 32 platform).
Definition: vpDisplayGDI.h:129
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
void setDevice(const std::string &devname)
static const vpColor none
Definition: vpColor.h:192
virtual void setProjectionErrorDisplay(const bool display)
void setMinDistance(double minDistance)
error that can be emited by ViSP classes.
Definition: vpException.h:71
Definition: vpMe.h:60
virtual void getCameraParameters(vpCameraParameters &cam1, vpCameraParameters &cam2) const
void open(const rs2::config &cfg=rs2::config())
virtual void setMovingEdge(const vpMe &me)
static std::string getParent(const std::string &pathname)
Definition: vpIoTools.cpp:1477
XML parser to load and save intrinsic camera parameters.
static const vpColor green
Definition: vpColor.h:183
Real-time 6D object pose tracking using its CAD model.
static void flush(const vpImage< unsigned char > &I)
vpCameraParameters getCameraParameters(const rs2_stream &stream, vpCameraParameters::vpCameraParametersProjType type=vpCameraParameters::perspectiveProjWithDistortion) const
VISP_EXPORT double measureTimeMs()
Definition: vpTime.cpp:88
void setMu1(const double &mu_1)
Definition: vpMe.h:241
void open(vpImage< unsigned char > &I)
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)
static bool checkFilename(const char *filename)
Definition: vpIoTools.cpp:675
void open(vpImage< unsigned char > &I)
void setMatcher(const std::string &matcherName)
Definition: vpKeyPoint.h:868
static void compute3DForPointsInPolygons(const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam, std::vector< cv::KeyPoint > &candidates, const std::vector< vpPolygon > &polygons, const std::vector< std::vector< vpPoint > > &roisPt, std::vector< cv::Point3f > &points, cv::Mat *descriptors=NULL)
Definition: vpKeyPoint.cpp:528
virtual void setKltMaskBorder(const unsigned int &e)
virtual void initFromPose(const vpImage< unsigned char > &I1, const vpImage< unsigned char > &I2, const std::string &initFile1, const std::string &initFile2)
Firewire cameras video capture based on CMU 1394 Digital Camera SDK.
void setMaskSize(const unsigned int &a)
Definition: vpMe.cpp:461
virtual void setProjectionErrorComputation(const bool &flag)
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 void initClick(const vpImage< unsigned char > &I1, const vpImage< unsigned char > &I2, const std::string &initFile1, const std::string &initFile2, const bool displayHelp=false, const vpHomogeneousMatrix &T1=vpHomogeneousMatrix(), const vpHomogeneousMatrix &T2=vpHomogeneousMatrix())
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 double getProjectionError() const
Definition: vpMbTracker.h:310
Generic class defining intrinsic camera parameters.
void setDetector(const vpFeatureDetectorType &detectorType)
Definition: vpKeyPoint.h:734
unsigned int buildReference(const vpImage< unsigned char > &I)
Definition: vpKeyPoint.cpp:236
void acquire(vpImage< unsigned char > &grey)
void setScale(unsigned scale=vpV4l2Grabber::DEFAULT_SCALE)
void setPyramidLevels(const int pyrMaxLevel)
virtual void loadModel(const std::string &modelFile, const bool verbose=false, const vpHomogeneousMatrix &T=vpHomogeneousMatrix())
unsigned int matchPoint(const vpImage< unsigned char > &I)
virtual void setCameraParameters(const vpCameraParameters &camera)
static void displayCross(const vpImage< unsigned char > &I, const vpImagePoint &ip, unsigned int size, const vpColor &color, unsigned int thickness=1)
virtual void setScanLineVisibilityTest(const bool &v)
void setMu2(const double &mu_2)
Definition: vpMe.h:248
Class that is a wrapper over the Video4Linux2 (V4L2) driver.
void setWindowSize(const int winSize)
void loadLearningData(const std::string &filename, const bool binaryMode=false, const bool append=false)
static double deg(double rad)
Definition: vpMath.h:95
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))
virtual void setOgreVisibilityTest(const bool &v)
Class that allows keypoints detection (and descriptors extraction) and matching thanks to OpenCV libr...
Definition: vpKeyPoint.h:228
void saveLearningData(const std::string &filename, const bool binaryMode=false, const bool saveTrainingImages=true)
Implementation of a pose vector and operations on poses.
Definition: vpPoseVector.h:92
static std::string getNameWE(const std::string &pathname)
Definition: vpIoTools.cpp:1464
Wrapper for the KLT (Kanade-Lucas-Tomasi) feature tracker implemented in OpenCV. Thus to enable this ...
Definition: vpKltOpencv.h:78
void setBlockSize(const int blockSize)
virtual void getPose(vpHomogeneousMatrix &c1Mo, vpHomogeneousMatrix &c2Mo) const
void setThreshold(const double &t)
Definition: vpMe.h:300
virtual void setTrackerType(const int type)
Class for firewire ieee1394 video devices using libdc1394-2.x api.
const std::string & getStringMessage(void) const
Send a reference (constant) related the error message (can be empty).
Definition: vpException.cpp:92
void setRange(const unsigned int &r)
Definition: vpMe.h:271
int parse(vpCameraParameters &cam, const std::string &filename, const std::string &camera_name, const vpCameraParameters::vpCameraParametersProjType &projModel, const unsigned int image_width=0, const unsigned int image_height=0)
virtual void setKltOpencv(const vpKltOpencv &t)
static const vpColor yellow
Definition: vpColor.h:188
cv::Ptr< cv::FeatureDetector > getDetector(const vpFeatureDetectorType &type) const
Definition: vpKeyPoint.h:461
void setExtractor(const vpFeatureDescriptorType &extractorType)
Definition: vpKeyPoint.h:792
virtual int getTrackerType() const
void detect(const vpImage< unsigned char > &I, std::vector< cv::KeyPoint > &keyPoints, const vpRect &rectangle=vpRect())
virtual double computeCurrentProjectionError(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &_cMo, const vpCameraParameters &_cam)