Visual Servoing Platform  version 3.3.1 under development (2020-12-02)
tutorial-mb-generic-tracker-apriltag-rs2.cpp
1 #include <fstream>
3 #include <ios>
4 #include <iostream>
5 
6 #include <visp3/gui/vpDisplayGDI.h>
7 #include <visp3/gui/vpDisplayOpenCV.h>
8 #include <visp3/gui/vpDisplayX.h>
9 #include <visp3/core/vpXmlParserCamera.h>
10 #include <visp3/sensor/vpRealSense2.h>
11 #include <visp3/detection/vpDetectorAprilTag.h>
12 #include <visp3/mbt/vpMbGenericTracker.h>
13 
14 typedef enum {
15  state_detection,
16  state_tracking,
17  state_quit
18 } state_t;
19 
20 // Creates a cube.cao file in your current directory
21 // cubeEdgeSize : size of cube edges in meters
22 void createCaoFile(double cubeEdgeSize)
23 {
24  std::ofstream fileStream;
25  fileStream.open("cube.cao", std::ofstream::out | std::ofstream::trunc);
26  fileStream << "V1\n";
27  fileStream << "# 3D Points\n";
28  fileStream << "8 # Number of points\n";
29  fileStream << cubeEdgeSize / 2 << " " << cubeEdgeSize / 2 << " " << 0 << " # Point 0: (X, Y, Z)\n";
30  fileStream << cubeEdgeSize / 2 << " " << -cubeEdgeSize / 2 << " " << 0 << " # Point 1\n";
31  fileStream << -cubeEdgeSize / 2 << " " << -cubeEdgeSize / 2 << " " << 0 << " # Point 2\n";
32  fileStream << -cubeEdgeSize / 2 << " " << cubeEdgeSize / 2 << " " << 0 << " # Point 3\n";
33  fileStream << -cubeEdgeSize / 2 << " " << cubeEdgeSize / 2 << " " << -cubeEdgeSize << " # Point 4\n";
34  fileStream << -cubeEdgeSize / 2 << " " << -cubeEdgeSize / 2 << " " << -cubeEdgeSize << " # Point 5\n";
35  fileStream << cubeEdgeSize / 2 << " " << -cubeEdgeSize / 2 << " " << -cubeEdgeSize << " # Point 6\n";
36  fileStream << cubeEdgeSize / 2 << " " << cubeEdgeSize / 2 << " " << -cubeEdgeSize << " # Point 7\n";
37  fileStream << "# 3D Lines\n";
38  fileStream << "0 # Number of lines\n";
39  fileStream << "# Faces from 3D lines\n";
40  fileStream << "0 # Number of faces\n";
41  fileStream << "# Faces from 3D points\n";
42  fileStream << "6 # Number of faces\n";
43  fileStream << "4 0 3 2 1 # Face 0: [number of points] [index of the 3D points]...\n";
44  fileStream << "4 1 2 5 6\n";
45  fileStream << "4 4 7 6 5\n";
46  fileStream << "4 0 7 4 3\n";
47  fileStream << "4 5 2 3 4\n";
48  fileStream << "4 0 1 6 7 # Face 5\n";
49  fileStream << "# 3D cylinders\n";
50  fileStream << "0 # Number of cylinders\n";
51  fileStream << "# 3D circles\n";
52  fileStream << "0 # Number of circles\n";
53  fileStream.close();
54 }
55 
56 #if defined(VISP_HAVE_APRILTAG)
57 state_t detectAprilTag(const vpImage<unsigned char> &I, vpDetectorAprilTag &detector,
58  double tagSize, const vpCameraParameters &cam, vpHomogeneousMatrix &cMo)
59 {
60  std::vector<vpHomogeneousMatrix> cMo_vec;
61 
62  // Detection
63  bool ret = detector.detect(I, tagSize, cam, cMo_vec);
64 
65  // Display camera pose
66  for (size_t i = 0; i < cMo_vec.size(); i++) {
67  vpDisplay::displayFrame(I, cMo_vec[i], cam, tagSize / 2, vpColor::none, 3);
68  }
69 
70  vpDisplay::displayText(I, 40, 20, "State: waiting tag detection", vpColor::red);
71 
72  if (ret && detector.getNbObjects() > 0) { // if tag detected, we pick the first one
73  cMo = cMo_vec[0];
74  return state_tracking;
75  }
76 
77  return state_detection;
78 }
79 #endif // #if defined(VISP_HAVE_APRILTAG)
80 
81 state_t track(const vpImage<unsigned char> &I, vpMbGenericTracker &tracker,
82  double projection_error_threshold, vpHomogeneousMatrix &cMo)
83 {
85  tracker.getCameraParameters(cam);
86 
87  // Track the object
88  try {
89  tracker.track(I);
90  }
91  catch (...) {
92  return state_detection;
93  }
94 
95  tracker.getPose(cMo);
96 
97  // Detect tracking error
98  double projection_error = tracker.computeCurrentProjectionError(I, cMo, cam);
99  if (projection_error > projection_error_threshold) {
100  return state_detection;
101  }
102 
103  // Display
104  tracker.display(I, cMo, cam, vpColor::red, 2);
105  vpDisplay::displayFrame(I, cMo, cam, 0.025, vpColor::none, 3);
106  vpDisplay::displayText(I, 40, 20, "State: tracking in progress", vpColor::red);
107  {
108  std::stringstream ss;
109  ss << "Features: edges " << tracker.getNbFeaturesEdge() << ", klt " << tracker.getNbFeaturesKlt();
110  vpDisplay::displayText(I, 60, 20, ss.str(), vpColor::red);
111  }
112 
113  return state_tracking;
114 }
115 
116 state_t track(std::map<std::string, const vpImage<unsigned char> *>mapOfImages,
117  #ifdef VISP_HAVE_PCL
118  std::map<std::string, pcl::PointCloud< pcl::PointXYZ >::ConstPtr>mapOfPointclouds,
119  #else
120  std::map<std::string, const std::vector<vpColVector> *>mapOfPointclouds,
121  std::map<std::string, unsigned int> mapOfWidths,
122  std::map<std::string, unsigned int> mapOfHeights,
123  #endif
124  const vpImage<unsigned char> &I_gray,
125  const vpImage<unsigned char> &I_depth,
126  const vpHomogeneousMatrix &depth_M_color,
127  vpMbGenericTracker &tracker,
128  double projection_error_threshold, vpHomogeneousMatrix &cMo)
129 {
130  vpCameraParameters cam_color, cam_depth;
131  tracker.getCameraParameters(cam_color, cam_depth);
132 
133  // Track the object
134  try {
135 #ifdef VISP_HAVE_PCL
136  tracker.track(mapOfImages, mapOfPointclouds);
137 #else
138  tracker.track(mapOfImages, mapOfPointclouds, mapOfWidths, mapOfHeights);
139 #endif
140  }
141  catch (...) {
142  return state_detection;
143  }
144 
145  tracker.getPose(cMo);
146 
147  // Detect tracking error
148  double projection_error = tracker.computeCurrentProjectionError(I_gray, cMo, cam_color);
149  if (projection_error > projection_error_threshold) {
150  return state_detection;
151  }
152 
153  // Display
154  tracker.display(I_gray, I_depth, cMo, depth_M_color*cMo, cam_color, cam_depth, vpColor::red, 3);
155  vpDisplay::displayFrame(I_gray, cMo, cam_color, 0.05, vpColor::none, 3);
156  vpDisplay::displayFrame(I_depth, depth_M_color*cMo, cam_depth, 0.05, vpColor::none, 3);
157 
158  return state_tracking;
159 }
160 
161 int main(int argc, const char **argv)
162 {
164 #if defined(VISP_HAVE_APRILTAG) && defined(VISP_HAVE_REALSENSE2) && defined(VISP_HAVE_MODULE_MBT)
165 
168  double opt_tag_size = 0.08;
169  float opt_quad_decimate = 1.0;
170  int opt_nthreads = 1;
171  double opt_cube_size = 0.125; // 12.5cm by default
172 #ifdef VISP_HAVE_OPENCV
173  bool opt_use_texture = false;
174 #endif
175  bool opt_use_depth = false;
176  double opt_projection_error_threshold = 40.;
177 
178 #if !(defined(VISP_HAVE_X11) || defined(VISP_HAVE_GDI) || defined(VISP_HAVE_OPENCV))
179  bool display_off = true;
180 #else
181  bool display_off = false;
182 #endif
183 
184  for (int i = 1; i < argc; i++) {
185  if (std::string(argv[i]) == "--tag_size" && i + 1 < argc) {
186  opt_tag_size = atof(argv[i + 1]);
187  } else if (std::string(argv[i]) == "--quad_decimate" && i + 1 < argc) {
188  opt_quad_decimate = (float)atof(argv[i + 1]);
189  } else if (std::string(argv[i]) == "--nthreads" && i + 1 < argc) {
190  opt_nthreads = atoi(argv[i + 1]);
191  } else if (std::string(argv[i]) == "--display_off") {
192  display_off = true;
193  } else if (std::string(argv[i]) == "--tag_family" && i + 1 < argc) {
194  opt_tag_family = (vpDetectorAprilTag::vpAprilTagFamily)atoi(argv[i + 1]);
195  } else if (std::string(argv[i]) == "--cube_size" && i + 1 < argc) {
196  opt_cube_size = atof(argv[i + 1]);
197 #ifdef VISP_HAVE_OPENCV
198  } else if (std::string(argv[i]) == "--texture") {
199  opt_use_texture = true;
200 #endif
201  } else if (std::string(argv[i]) == "--depth") {
202  opt_use_depth = true;
203  } else if (std::string(argv[i]) == "--projection_error" && i + 1 < argc) {
204  opt_projection_error_threshold = atof(argv[i + 1]);
205  } else if (std::string(argv[i]) == "--help" || std::string(argv[i]) == "-h") {
206  std::cout << "Usage: " << argv[0] << " [--cube_size <size in m>] [--tag_size <size in m>]"
207  " [--quad_decimate <decimation>] [--nthreads <nb>]"
208  " [--tag_family <0: TAG_36h11, 1: TAG_36h10, 2: TAG_36ARTOOLKIT, "
209  " 3: TAG_25h9, 4: TAG_25h7, 5: TAG_16h5>]";
210 #if (defined(VISP_HAVE_X11) || defined(VISP_HAVE_GDI) || defined(VISP_HAVE_OPENCV))
211  std::cout << " [--display_off]";
212 #endif
213  std::cout << " [--texture] [--depth] [--projection_error <30 - 100>] [--help]" << std::endl;
214  return EXIT_SUCCESS;
215  }
216  }
217 
218  createCaoFile(opt_cube_size);
219 
220  try {
222  vpRealSense2 realsense;
223  rs2::config config;
224  int width = 640, height = 480, stream_fps = 30;
225  config.enable_stream(RS2_STREAM_COLOR, width, height, RS2_FORMAT_RGBA8, stream_fps);
226  config.enable_stream(RS2_STREAM_DEPTH, width, height, RS2_FORMAT_Z16, stream_fps);
227  config.disable_stream(RS2_STREAM_INFRARED);
228  realsense.open(config);
229 
230  vpCameraParameters cam_color, cam_depth;
231  vpHomogeneousMatrix depth_M_color;
232  cam_color = realsense.getCameraParameters(RS2_STREAM_COLOR, vpCameraParameters::perspectiveProjWithoutDistortion);
233  if (opt_use_depth) {
234  cam_depth = realsense.getCameraParameters(RS2_STREAM_DEPTH, vpCameraParameters::perspectiveProjWithoutDistortion);
235  depth_M_color = realsense.getTransformation(RS2_STREAM_COLOR, RS2_STREAM_DEPTH);
236  }
237 
238  vpImage<vpRGBa> I_color(height, width);
239  vpImage<unsigned char> I_gray(height, width);
240  vpImage<unsigned char> I_depth(height, width);
241  vpImage<uint16_t> I_depth_raw(height, width);
242  std::map<std::string, vpHomogeneousMatrix> mapOfCameraTransformations;
243  std::map<std::string, const vpImage<unsigned char> *> mapOfImages;
244 #ifdef VISP_HAVE_PCL
245  std::map<std::string, pcl::PointCloud< pcl::PointXYZ >::ConstPtr> mapOfPointclouds;
246  pcl::PointCloud<pcl::PointXYZ>::Ptr pointcloud(new pcl::PointCloud<pcl::PointXYZ>());
247 #else
248  std::map<std::string, const std::vector<vpColVector> *> mapOfPointclouds;
249  std::map<std::string, unsigned int> mapOfWidths, mapOfHeights;
250  std::vector<vpColVector> pointcloud;
251 #endif
252 
253  std::map<std::string, vpHomogeneousMatrix> mapOfCameraPoses;
254 
255  std::cout << "Cube size: " << opt_cube_size << std::endl;
256  std::cout << "AprilTag size: " << opt_tag_size << std::endl;
257  std::cout << "AprilTag family: " << opt_tag_family << std::endl;
258  std::cout << "Camera parameters:" << std::endl;
259  std::cout << " Color:\n" << cam_color << std::endl;
260  if (opt_use_depth)
261  std::cout << " Depth:\n" << cam_depth << std::endl;
262  std::cout << "Detection: " << std::endl;
263  std::cout << " Quad decimate: " << opt_quad_decimate << std::endl;
264  std::cout << " Threads number: " << opt_nthreads << std::endl;
265  std::cout << "Tracker: " << std::endl;
266  std::cout << " Use edges : 1" << std::endl;
267  std::cout << " Use texture: "
268 #ifdef VISP_HAVE_OPENCV
269  << opt_use_texture << std::endl;
270 #else
271  << " na" << std::endl;
272 #endif
273  std::cout << " Use depth : " << opt_use_depth << std::endl;
274  std::cout << " Projection error: " << opt_projection_error_threshold << std::endl;
275 
276  // Construct display
277  vpDisplay *d_gray = NULL;
278  vpDisplay *d_depth = NULL;
279 
280  if (!display_off) {
281 #ifdef VISP_HAVE_X11
282  d_gray = new vpDisplayX(I_gray, 50, 50, "Color stream");
283  if (opt_use_depth)
284  d_depth = new vpDisplayX(I_depth, 80+I_gray.getWidth(), 50, "Depth stream");
285 #elif defined(VISP_HAVE_GDI)
286  d_gray = new vpDisplayGDI(I_gray);
287  if (opt_use_depth)
288  d_depth = new vpDisplayGDI(I_depth);
289 #elif defined(VISP_HAVE_OPENCV)
290  d_gray = new vpDisplayOpenCV(I_gray);
291  if (opt_use_depth)
292  d_depth = new vpDisplayOpenCV(I_depth);
293 #endif
294  }
295 
296  // Initialize AprilTag detector
297  vpDetectorAprilTag detector(opt_tag_family);
298  detector.setAprilTagQuadDecimate(opt_quad_decimate);
299  detector.setAprilTagNbThreads(opt_nthreads);
300 
301  // Prepare MBT
302  std::vector<int> trackerTypes;
303 #ifdef VISP_HAVE_OPENCV
304  if (opt_use_texture)
306  else
307 #endif
308  trackerTypes.push_back(vpMbGenericTracker::EDGE_TRACKER );
309 
310  if (opt_use_depth)
311  trackerTypes.push_back(vpMbGenericTracker::DEPTH_DENSE_TRACKER);
312 
313  vpMbGenericTracker tracker(trackerTypes);
314  // edges
315  vpMe me;
316  me.setMaskSize(5);
317  me.setMaskNumber(180);
319  me.setRange(12);
321  me.setThreshold(10000);
322  me.setMu1(0.5);
323  me.setMu2(0.5);
324  me.setSampleStep(4);
325  tracker.setMovingEdge(me);
326 
327 #ifdef VISP_HAVE_OPENCV
328  if (opt_use_texture) {
329  vpKltOpencv klt_settings;
330  klt_settings.setMaxFeatures(300);
331  klt_settings.setWindowSize(5);
332  klt_settings.setQuality(0.015);
333  klt_settings.setMinDistance(8);
334  klt_settings.setHarrisFreeParameter(0.01);
335  klt_settings.setBlockSize(3);
336  klt_settings.setPyramidLevels(3);
337  tracker.setKltOpencv(klt_settings);
338  tracker.setKltMaskBorder(5);
339  }
340 #endif
341 
342  if (opt_use_depth) {
343  // camera calibration params
344  tracker.setCameraParameters(cam_color, cam_depth);
345  // model definition
346  tracker.loadModel("cube.cao", "cube.cao");
347  mapOfCameraTransformations["Camera2"] = depth_M_color;
348  tracker.setCameraTransformationMatrix(mapOfCameraTransformations);
349  tracker.setAngleAppear(vpMath::rad(70), vpMath::rad(70));
350  tracker.setAngleDisappear(vpMath::rad(80), vpMath::rad(80));
351  }
352  else {
353  // camera calibration params
354  tracker.setCameraParameters(cam_color);
355  // model definition
356  tracker.loadModel("cube.cao");
357  tracker.setAngleAppear(vpMath::rad(70));
358  tracker.setAngleDisappear(vpMath::rad(80));
359  }
360  tracker.setDisplayFeatures(true);
361 
363  state_t state = state_detection;
364 
365  // wait for a tag detection
366  while (state != state_quit) {
367  if (opt_use_depth) {
368 #ifdef VISP_HAVE_PCL
369  realsense.acquire((unsigned char *) I_color.bitmap, (unsigned char *) I_depth_raw.bitmap, NULL, pointcloud, NULL);
370 #else
371  realsense.acquire((unsigned char *) I_color.bitmap, (unsigned char *) I_depth_raw.bitmap, &pointcloud, NULL, NULL);
372 #endif
373  vpImageConvert::convert(I_color, I_gray);
374  vpImageConvert::createDepthHistogram(I_depth_raw, I_depth);
375  vpDisplay::display(I_gray);
376  vpDisplay::display(I_depth);
377 
378  mapOfImages["Camera1"] = &I_gray;
379  mapOfImages["Camera2"] = &I_depth;
380 #ifdef VISP_HAVE_PCL
381  mapOfPointclouds["Camera2"] = pointcloud;
382 #else
383  mapOfPointclouds["Camera2"] = &pointcloud;
384  mapOfWidths["Camera2"] = width;
385  mapOfHeights["Camera2"] = height;
386 #endif
387  }
388  else {
389  realsense.acquire(I_gray);
390  vpDisplay::display(I_gray);
391  }
392 
393  if (state == state_detection) {
394  state = detectAprilTag(I_gray, detector, opt_tag_size, cam_color, cMo);
395 
396  // Initialize the tracker with the result of the detection
397  if (state == state_tracking) {
398  if (opt_use_depth) {
399  mapOfCameraPoses["Camera1"] = cMo;
400  mapOfCameraPoses["Camera2"] = depth_M_color * cMo;
401  tracker.initFromPose(mapOfImages, mapOfCameraPoses);
402  }
403  else {
404  tracker.initFromPose(I_gray, cMo);
405  }
406  }
407  }
408 
409  if (state == state_tracking) {
410  if (opt_use_depth) {
411 #ifdef VISP_HAVE_PCL
412  state = track(mapOfImages, mapOfPointclouds,
413  I_gray, I_depth, depth_M_color, tracker, opt_projection_error_threshold, cMo);
414 #else
415  state = track(mapOfImages, mapOfPointclouds, mapOfWidths, mapOfHeights,
416  I_gray, I_depth, depth_M_color, tracker, opt_projection_error_threshold, cMo);
417 #endif
418  }
419  else {
420  state = track(I_gray, tracker, opt_projection_error_threshold, cMo);
421  }
422  {
423  std::stringstream ss;
424  ss << "Features: edges " << tracker.getNbFeaturesEdge()
425  << ", klt " << tracker.getNbFeaturesKlt()
426  << ", depth " << tracker.getNbFeaturesDepthDense();
427  vpDisplay::displayText(I_gray, I_gray.getHeight() - 30, 20, ss.str(), vpColor::red);
428  }
429  }
430 
431  vpDisplay::displayText(I_gray, 20, 20, "Click to quit...", vpColor::red);
432  if (vpDisplay::getClick(I_gray, false)) { // exit
433  state = state_quit;
434  }
435  vpDisplay::flush(I_gray);
436 
437  if (opt_use_depth) {
438  vpDisplay::displayText(I_depth, 20, 20, "Click to quit...", vpColor::red);
439  if (vpDisplay::getClick(I_depth, false)) { // exit
440  state = state_quit;
441  }
442  vpDisplay::flush(I_depth);
443  }
444  }
445 
446  if (!display_off) {
447  delete d_gray;
448  if (opt_use_depth)
449  delete d_depth;
450  }
451  } catch (const vpException &e) {
452  std::cerr << "Catch an exception: " << e.getMessage() << std::endl;
453  }
454 
455  return EXIT_SUCCESS;
456 #else
457  (void)argc;
458  (void)argv;
459 #ifndef VISP_HAVE_APRILTAG
460  std::cout << "ViSP is not build with Apriltag support" << std::endl;
461 #endif
462 #ifndef VISP_HAVE_REALSENSE2
463  std::cout << "ViSP is not build with librealsense2 support" << std::endl;
464 #endif
465  std::cout << "Install missing 3rd parties, configure and build ViSP to run this tutorial" << std::endl;
466 #endif
467  return EXIT_SUCCESS;
468 }
void setMaxFeatures(int maxCount)
Class that defines generic functionnalities for display.
Definition: vpDisplay.h:177
virtual void track(const vpImage< unsigned char > &I)
static bool getClick(const vpImage< unsigned char > &I, bool blocking=true)
virtual unsigned int getNbFeaturesKlt() const
virtual void display(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam, const vpColor &col, unsigned int thickness=1, bool displayFullModel=false)
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.
AprilTag 36h11 pattern (recommended)
void setMaskNumber(const unsigned int &a)
Definition: vpMe.cpp:452
Display for windows using GDI (available on any windows 32 platform).
Definition: vpDisplayGDI.h:128
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)
virtual void setDisplayFeatures(bool displayF)
Use the X11 console to display images on unix-like OS. Thus to enable this class X11 should be instal...
Definition: vpDisplayX.h:150
static const vpColor none
Definition: vpColor.h:229
void setMinDistance(double minDistance)
virtual void setAngleDisappear(const double &a)
error that can be emited by ViSP classes.
Definition: vpException.h:71
Definition: vpMe.h:60
size_t getNbObjects() const
const char * getMessage() const
Definition: vpException.cpp:90
void open(const rs2::config &cfg=rs2::config())
virtual void setMovingEdge(const vpMe &me)
Real-time 6D object pose tracking using its CAD model.
static void flush(const vpImage< unsigned char > &I)
void setMu1(const double &mu_1)
Definition: vpMe.h:241
virtual unsigned int getNbFeaturesEdge() const
static const vpColor red
Definition: vpColor.h:217
void setQuality(double qualityLevel)
void setAprilTagQuadDecimate(float quadDecimate)
vpHomogeneousMatrix getTransformation(const rs2_stream &from, const rs2_stream &to, int from_index=-1) const
virtual void setKltMaskBorder(const unsigned int &e)
virtual void loadModel(const std::string &modelFile, bool verbose=false, const vpHomogeneousMatrix &T=vpHomogeneousMatrix())
void setMaskSize(const unsigned int &a)
Definition: vpMe.cpp:459
void setPyramidLevels(int pyrMaxLevel)
static void display(const vpImage< unsigned char > &I)
The vpDisplayOpenCV allows to display image using the OpenCV library. Thus to enable this class OpenC...
Generic class defining intrinsic camera parameters.
void setAprilTagNbThreads(int nThreads)
virtual void initFromPose(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo)
virtual void setAngleAppear(const double &a)
void setWindowSize(int winSize)
virtual void getCameraParameters(vpCameraParameters &camera) const
static double rad(double deg)
Definition: vpMath.h:110
virtual void setCameraParameters(const vpCameraParameters &camera)
void setMu2(const double &mu_2)
Definition: vpMe.h:248
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
vpCameraParameters getCameraParameters(const rs2_stream &stream, vpCameraParameters::vpCameraParametersProjType type=vpCameraParameters::perspectiveProjWithDistortion, int index=-1) const
void setThreshold(const double &t)
Definition: vpMe.h:300
virtual unsigned int getNbFeaturesDepthDense() const
void setRange(const unsigned int &r)
Definition: vpMe.h:271
virtual void setKltOpencv(const vpKltOpencv &t)
unsigned int getWidth() const
Definition: vpImage.h:246
void setBlockSize(int blockSize)
void acquire(vpImage< unsigned char > &grey, double *ts=NULL)
virtual void getPose(vpHomogeneousMatrix &cMo) const
static void createDepthHistogram(const vpImage< uint16_t > &src_depth, vpImage< vpRGBa > &dest_rgba)
virtual void setCameraTransformationMatrix(const std::string &cameraName, const vpHomogeneousMatrix &cameraTransformationMatrix)
bool detect(const vpImage< unsigned char > &I)
virtual double computeCurrentProjectionError(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &_cMo, const vpCameraParameters &_cam)