MRPT  2.0.3
test.cpp
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | https://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2020, Individual contributors, see AUTHORS file |
6  | See: https://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See: https://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 
16 #include <iostream>
17 
18 using mrpt::format;
19 using namespace mrpt::gui;
20 using namespace mrpt::vision;
21 using namespace mrpt::img;
22 using namespace mrpt::opengl;
23 using namespace mrpt::system;
24 using namespace std;
25 
26 #include <mrpt/examples_config.h>
27 string myDataDir(
28  MRPT_EXAMPLES_BASE_DIRECTORY +
29  string("vision_keypoint_matching_example/imgs/"));
30 
31 // ------------------------------------------------------
32 // TestExtractMatchProjectAndPaint
33 // ------------------------------------------------------
35 {
36  CFeatureExtraction fExt;
37  CFeatureList featsHarris_L, featsHarris_R;
38  CMatchedFeatureList mHarris, mSIFT, mSURF;
39  CImage imL, imR;
40 
41  string imgL = myDataDir + string("imL_p01.jpg"); // Left image
42  string imgR = myDataDir + string("imR_p01.jpg"); // Right image
43 
44  // Load and check images
45  if (!imL.loadFromFile(imgL))
46  {
47  cerr << "Cannot load " << imgL << endl;
48  return;
49  }
50  cout << "Loaded test image: " << imgL << endl;
51 
52  if (!imR.loadFromFile(imgR))
53  {
54  cerr << "Cannot load " << imgR << endl;
55  return;
56  }
57  cout << "Loaded test image: " << imgR << endl;
58 
59  cout << "***************************************************" << endl;
60  cout << "***************************************************" << endl;
61 
62  // Extract features:
63  // HARRIS
64  cout << "Detecting HARRIS features in LEFT image" << endl;
65  fExt.options.featsType = featKLT;
66  fExt.detectFeatures(imL, featsHarris_L);
67  cout << "Detected " << featsHarris_L.size() << endl;
68 
69  cout << "Detecting HARRIS features in RIGHT image" << endl;
70  fExt.detectFeatures(imR, featsHarris_R);
71  cout << "Detected " << featsHarris_R.size() << endl;
72 
73  cout << "***************************************************" << endl;
74  cout << "***************************************************" << endl;
75 
76  // Match features:
77  TMatchingOptions opt;
78  cout << "Matching HARRIS features by CORRELATION" << endl;
79  matchFeatures(featsHarris_L, featsHarris_R, mHarris);
80  cout << "Matches found: " << mHarris.size() << endl;
81 
82  cout << "***************************************************" << endl;
83 
84  // Project features:
86  TStereoSystemParams stereoOptions; // Default options: Bumblebee + 640x480
87  cout << "Projecting matched features" << endl;
88  mrpt::vision::projectMatchedFeatures(mHarris, stereoOptions, outMap);
89 
90  CDisplayWindow3D win3D("3D Map");
91  COpenGLScene::Ptr& scene3D = win3D.get3DSceneAndLock();
92  CSetOfObjects::Ptr map3D = CSetOfObjects::Create();
93  outMap.getAs3DObject(map3D);
94  CGridPlaneXY::Ptr gridXY = CGridPlaneXY::Create(-10, 10, -10, 10, 0, 1);
95 
96  scene3D->insert(gridXY);
97  scene3D->insert(map3D);
98 
99  win3D.unlockAccess3DScene();
100  win3D.repaint();
101 
103 
104 } // end TestExtractMatchProjectAndPaint
105 
106 // ------------------------------------------------------
107 // TestMatchFeatures
108 // ------------------------------------------------------
109 void TestMatchFeatures(bool showMatches)
110 {
111  CFeatureExtraction fExt;
112  CFeatureList featsHarris_L, featsHarris_R, featsSIFT_L, featsSIFT_R,
113  featsSURF_L, featsSURF_R, featsFAST_L, featsFAST_R;
114  CMatchedFeatureList mHarris, mSIFT, mSURF, mHarris_SAD, mFAST_CC, mFAST_SAD;
115  CImage imL, imR;
116 
117  string imgL = myDataDir + string("imL_p01.jpg"); // Left image
118  string imgR = myDataDir + string("imR_p01.jpg"); // Right image
119 
120  // Load and check images
121  if (!imL.loadFromFile(imgL))
122  {
123  cerr << "Cannot load " << imgL << endl;
124  return;
125  }
126  cout << "Loaded LEFT image: " << endl << imgL << endl;
127 
128  if (!imR.loadFromFile(imgR))
129  {
130  cerr << "Cannot load " << imgR << endl;
131  return;
132  }
133  cout << "Loaded RIGHT image: " << endl << imgR << endl;
134 
135  cout << "***************************************************" << endl;
136  cout << "***************************************************" << endl;
137 
138  // Extract features:
139  // HARRIS
140  cout << "Detecting HARRIS features in LEFT image" << endl;
142  fExt.detectFeatures(imL, featsHarris_L, 250);
143  cout << "Detected " << featsHarris_L.size() << endl;
144 
145  cout << "Detecting HARRIS features in RIGHT image" << endl;
146  fExt.detectFeatures(imR, featsHarris_R, 250);
147  cout << "Detected " << featsHarris_R.size() << endl;
148  cout << "***************************************************" << endl;
149 
150  // SIFT
151  cout << "Detecting SIFT features in LEFT image" << endl;
152  fExt.options.featsType = featSIFT;
153  // fExt.options.SIFTOptions.implementation = CFeatureExtraction::Hess;
154  fExt.options.SIFTOptions.implementation = CFeatureExtraction::OpenCV;
155  fExt.detectFeatures(imL, featsSIFT_L);
156  cout << "Detected " << featsSIFT_L.size() << endl;
157 
158  cout << "Detecting SIFT features in RIGHT image" << endl;
159  fExt.options.featsType = featSIFT;
160  // fExt.options.SIFTOptions.implementation = CFeatureExtraction::Hess;
161  fExt.options.SIFTOptions.implementation = CFeatureExtraction::OpenCV;
162  fExt.detectFeatures(imR, featsSIFT_R);
163  cout << "Detected " << featsSIFT_R.size() << endl;
164  cout << "***************************************************" << endl;
165 
166  // SURF
167  cout << "Detecting SURF features in LEFT image" << endl;
168  fExt.options.featsType = featSURF;
169  fExt.detectFeatures(imL, featsSURF_L);
170  cout << "Detected " << featsSURF_L.size() << endl;
171 
172  cout << "Detecting SURF features in RIGHT image" << endl;
173  fExt.detectFeatures(imR, featsSURF_R);
174  cout << "Detected " << featsSURF_R.size() << endl;
175  cout << "***************************************************" << endl;
176 
177  // FAST
178  cout << "Detecting FAST features in LEFT image" << endl;
179  fExt.options.featsType = featFAST;
180  fExt.detectFeatures(imL, featsFAST_L, 0, 250);
181  cout << "Detected " << featsFAST_L.size() << endl;
182 
183  cout << "Detecting FAST features in RIGHT image" << endl;
184  fExt.detectFeatures(imR, featsFAST_R, 0, 250);
185  cout << "Detected " << featsFAST_R.size() << endl;
186  cout << "***************************************************" << endl;
187  cout << "***************************************************" << endl;
188 
189  // Match features:
190  TMatchingOptions opt;
191 
192  // // HARRIS
193  CTicTac tictac;
194  double T = 0.0;
195  cout << "Matching HARRIS features" << endl;
196  tictac.Tic();
197  matchFeatures(featsHarris_L, featsHarris_R, mHarris);
198  T = tictac.Tac();
199  cout << "[NCC] Matches found: " << mHarris.size() << " in " << T * 1000.0f
200  << " ms " << endl;
201 
202  opt.matching_method = TMatchingOptions::mmSAD;
203  tictac.Tic();
204  matchFeatures(featsHarris_L, featsHarris_R, mHarris_SAD, opt);
205  T = tictac.Tac();
206  cout << "[SAD] Matches found: " << mHarris_SAD.size() << " in "
207  << T * 1000.0f << " ms " << endl;
208  cout << "***************************************************" << endl;
209 
210  // SIFT
211  cout << "Matching SIFT features by DESCRIPTOR" << endl;
212  opt.matching_method = TMatchingOptions::mmDescriptorSIFT;
213  tictac.Tic();
214  matchFeatures(featsSIFT_L, featsSIFT_R, mSIFT, opt);
215  T = tictac.Tac();
216  cout << "Matches found: " << mSIFT.size() << " in " << T * 1000.0f << " ms "
217  << endl;
218  cout << "***************************************************" << endl;
219 
220  // SURF
221  cout << "Matching SURF features by DESCRIPTOR" << endl;
222  opt.matching_method = TMatchingOptions::mmDescriptorSURF;
223  tictac.Tic();
224  matchFeatures(featsSURF_L, featsSURF_R, mSURF, opt);
225  T = tictac.Tac();
226  cout << "Matches found: " << mSURF.size() << " in " << T * 1000.0f << " ms "
227  << endl;
228  cout << "***************************************************" << endl;
229 
230  // FAST
231  cout << "Matching FAST features" << endl;
232  tictac.Tic();
233  matchFeatures(featsFAST_L, featsFAST_R, mFAST_CC);
234  T = tictac.Tac();
235  cout << "[NCC] Matches found: " << mFAST_CC.size() << " in " << T * 1000.0f
236  << " ms " << endl;
237 
238  opt.matching_method = TMatchingOptions::mmSAD;
239  tictac.Tic();
240  matchFeatures(featsFAST_L, featsFAST_R, mFAST_SAD, opt);
241  T = tictac.Tac();
242  cout << "[SAD] Matches found: " << mFAST_SAD.size() << " in " << T * 1000.0f
243  << " ms " << endl;
244  cout << "***************************************************" << endl;
245 
246  if (showMatches)
247  {
248  CDisplayWindow winHarrisSAD, winHarrisNCC, winFASTSAD, winFASTNCC,
249  winSIFT, winSURF;
250 
251  winHarrisSAD.setWindowTitle("Matches with Harris + SAD");
252  winHarrisNCC.setWindowTitle("Matches with Harris + NCC");
253  winFASTSAD.setWindowTitle("Matches with FAST + SAD");
254  winFASTNCC.setWindowTitle("Matches with FAST + NCC");
255  winSIFT.setWindowTitle("Matches with SIFT");
256  winSURF.setWindowTitle("Matches with SURF");
257 
258  winHarrisNCC.showImagesAndMatchedPoints(
259  imL, imR, mHarris, TColor(0, 0, 255));
260  winHarrisSAD.showImagesAndMatchedPoints(
261  imL, imR, mHarris_SAD, TColor(0, 0, 255));
262  winSIFT.showImagesAndMatchedPoints(imL, imR, mSIFT, TColor(0, 255, 0));
263  winSURF.showImagesAndMatchedPoints(imL, imR, mSURF, TColor(0, 255, 0));
264  winFASTSAD.showImagesAndMatchedPoints(
265  imL, imR, mFAST_SAD, TColor(0, 255, 0));
266  winFASTNCC.showImagesAndMatchedPoints(
267  imL, imR, mFAST_CC, TColor(0, 255, 0));
268 
270  }
271 
272 } // end TestMatchFeatures
273 
274 // ------------------------------------------------------
275 // TestMatchingComparative
276 // ------------------------------------------------------
278 {
279  // Take two images
280  string imgL = myDataDir + string("imL_p01.jpg"); // Left image
281  string imgR = myDataDir + string("imR_p01.jpg"); // Right image
282 
283  CImage im1, im2;
284  im1.loadFromFile(imgL);
285  im2.loadFromFile(imgR);
286 
287  size_t imW = im1.getWidth();
288  size_t imH = im1.getHeight();
289 
290  CFeatureExtraction fExt;
291  fExt.options.featsType = featFAST;
292  fExt.options.patchSize = 21;
293  fExt.options.SIFTOptions.implementation = CFeatureExtraction::Hess;
294 
295  // Find FAST features
296  CFeatureList list1, list2;
297  fExt.detectFeatures(im1, list1, 150);
298  // Compute SIFT & SURF descriptors
299  fExt.computeDescriptors(im1, list1, descSIFT);
300  fExt.computeDescriptors(im1, list1, descSURF);
301 
302  fExt.detectFeatures(im2, list2, 150);
303  // Compute SIFT & SURF descriptors
304  fExt.computeDescriptors(im2, list2, descSIFT);
305  fExt.computeDescriptors(im2, list2, descSURF);
306 
307  im1.drawFeatures(list1);
308  im2.drawFeatures(list2);
309 
310  CDisplayWindow win, win2;
311  win.setPos(0, 0);
312  win2.setPos(0, imH * 1.5);
313  CImage joinimage, copyjoinimage, copyInfoImage;
314  size_t imW2 = 1280;
315  size_t imH2 = 150;
316 
317  CImage infoimage(imW2, imH2, CH_RGB);
318 
319  joinimage.joinImagesHorz(im1, im2);
320  infoimage.filledRectangle(0, 0, imW2, imH2, TColor(150, 150, 150));
321  infoimage.textOut(20, imH2 - 53, "SAD", TColor::blue());
322  infoimage.textOut(20, imH2 - 41, "NCC", TColor::blue());
323  infoimage.textOut(20, imH2 - 29, "SIFT", TColor::blue());
324  infoimage.textOut(20, imH2 - 17, "SURF", TColor::blue());
325  for (auto it1 = list1.begin(); it1 != list1.end(); ++it1)
326  {
327  const auto& pt1 = it1->keypoint.pt;
328 
329  copyInfoImage = infoimage;
330  copyjoinimage = joinimage;
331  copyjoinimage.line(pt1.x, 0, pt1.x, imH, TColor::green()); // Horiz
332  copyjoinimage.line(
333  pt1.x + imW, 0, pt1.x + imW, imH,
334  TColor::green()); // Horiz
335  copyjoinimage.line(
336  0, pt1.y, imW + imW, pt1.y, TColor::green()); // Epipolar
337  copyjoinimage.drawCircle(
338  pt1.x, pt1.y, 4, TColor::green(), 2); // Keypoint
339 
340  copyInfoImage.update_patch(*it1->patch, 0, 0);
341  bool firstMatch = true;
342  int cnt = 0;
343  int px = 80;
344  double minsad = 1.0, maxncc = 0.0;
345  float minsiftd = 1.0f, minsurfd = 1.0f;
346  int idxsad = 0, idxncc = 0, idxsiftd = 0, idxsurfd = 0;
347 
348  for (auto it2 = list2.begin(); it2 != list2.end(); ++it2)
349  {
350  const auto& pt2 = it2->keypoint.pt;
351 
352  if (fabs(pt1.y - pt2.y) <= 1.0 && pt1.x > pt2.x)
353  {
354  // Compute matching with SAD and Correlation and SIFT/SURF?
355  // Use epipolar constraints
356  // Compute SAD
357  double sad = mrpt::vision::computeSAD(*it1->patch, *it2->patch);
358  if (sad < minsad)
359  {
360  minsad = sad;
361  idxsad = cnt;
362  }
363  // Compute Correlation
364  double ncc;
365  size_t u, v;
367  *it1->patch, *it2->patch, u, v, ncc);
368  if (ncc > maxncc)
369  {
370  maxncc = ncc;
371  idxncc = cnt;
372  }
373 
374  // Compute distance between descriptors SIFT
375  float siftd = it1->descriptorSIFTDistanceTo(*it2);
376  if (siftd < minsiftd)
377  {
378  minsiftd = siftd;
379  idxsiftd = cnt;
380  }
381 
382  // Compute distance between descriptors SIFT
383  float surfd = it1->descriptorSURFDistanceTo(*it2);
384  if (surfd < minsurfd)
385  {
386  minsurfd = surfd;
387  idxsurfd = cnt;
388  }
389 
390  // Plot images + features + each candidate + difference score
391  if (firstMatch)
392  {
393  copyjoinimage.line(
394  pt1.x + imW, 0, pt1.x + imW, imH,
395  TColor::green()); // Limit line (only the first time)
396  firstMatch = false;
397  } // end-if
398 
399  copyjoinimage.drawCircle(
400  pt2.x + imW, pt2.y, 4, TColor::blue(),
401  2); // Keypoint
402  double rx0, rx1, ry0, ry1, tx, ty;
403  rx0 = pt2.x + imW - 15;
404  rx1 = pt2.x + imW;
405  tx = pt2.x + imW - 13;
406  if (cnt % 2)
407  {
408  ry0 = pt2.y - 20;
409  ry1 = pt2.y - 10;
410  ty = pt2.y - 22;
411  }
412  else
413  {
414  ry0 = pt2.y + 10;
415  ry1 = pt2.y + 20;
416  ty = pt2.y + 8;
417  }
418  copyjoinimage.filledRectangle(
419  rx0, ry0, rx1, ry1, TColor(150, 150, 150));
420  copyjoinimage.textOut(
421  tx, ty, format("%d", cnt), TColor::blue());
422 
423  px = 80 + cnt * 50;
424  if (px + fExt.options.patchSize > imW2) continue;
425 
426  copyInfoImage.update_patch(*it2->patch, px, 30);
427 
428  copyInfoImage.textOut(
429  px, imH2 - 70, format("%d", cnt), TColor::blue());
430  copyInfoImage.textOut(
431  px, imH2 - 53, format("%.2f", sad), TColor::blue());
432  copyInfoImage.textOut(
433  px, imH2 - 41, format("%.2f", ncc), TColor::blue());
434  copyInfoImage.textOut(
435  px, imH2 - 29, format("%.2f", siftd), TColor::blue());
436  copyInfoImage.textOut(
437  px, imH2 - 17, format("%.2f", surfd), TColor::blue());
438 
439  cnt++;
440  } // end if
441  } // end for it2
442  copyInfoImage.textOut(
443  80 + idxsad * 50, imH2 - 53, format("%.2f", minsad),
444  TColor::green());
445  copyInfoImage.textOut(
446  80 + idxncc * 50, imH2 - 41, format("%.2f", maxncc),
447  TColor::green());
448  copyInfoImage.textOut(
449  80 + idxsiftd * 50, imH2 - 29, format("%.2f", minsiftd),
450  TColor::green());
451  copyInfoImage.textOut(
452  80 + idxsurfd * 50, imH2 - 17, format("%.2f", minsurfd),
453  TColor::green());
454 
455  win.showImage(copyjoinimage);
456  win2.showImage(copyInfoImage);
458  } // end for it1
459 
460  // Save to file
461  // Check number of good features
462 
463 } // end TestMatchingComparative
464 
465 int main(int argc, char** argv)
466 {
467  try
468  {
469  if (argc == 1)
470  {
471  cerr << "Usage: " << argv[0] << endl;
472  cerr << "Options:" << endl;
473  cerr << " -match [-s]: TestMatchFeatures (if -s is set, final "
474  "matches in images will be shown)."
475  << endl;
476  cerr << " -comp: TestMatchingComparative." << endl;
477  cerr << " -proj: TestExtractMatchProjectAndPaint." << endl;
478  }
479  else
480  {
481  if (!strcmp(argv[1], "-match"))
482  {
483  if (argc == 3 && !strcmp(argv[2], "-s"))
484  TestMatchFeatures(true);
485  else
486  TestMatchFeatures(false);
487  }
488  else if (!strcmp(argv[1], "-proj"))
490  else if (!strcmp(argv[1], "-comp"))
491  {
492  cout << "Press ^C to finish program." << endl;
494  }
495  else
496  {
497  cerr << "Usage: " << argv[0] << endl;
498  cerr << "Options:" << endl;
499  cerr << " -match [-s]: TestMatchFeatures (if -s is set, final "
500  "matches in images will be shown)."
501  << endl;
502  cerr << " -comp: TestMatchingComparative." << endl;
503  cerr << " -proj: TestExtractMatchProjectAndPaint." << endl;
504  }
505  }
506  return 0;
507  }
508  catch (const std::exception& e)
509  {
510  std::cerr << "MRPT error: " << mrpt::exception_to_str(e) << std::endl;
511  return -1;
512  }
513  catch (...)
514  {
515  printf("Another exception!!");
516  return -1;
517  }
518 }
mrpt::vision::CFeatureList::size
size_t size() const
Definition: CFeature.h:352
TestMatchingComparative
void TestMatchingComparative()
Definition: vision_stereo_rectify/test.cpp:251
mrpt::vision::CFeatureExtraction
The central class from which images can be analyzed in search of different kinds of interest points a...
Definition: CFeatureExtraction.h:71
mrpt::img::CImage::getWidth
size_t getWidth() const override
Returns the width of the image in pixels.
Definition: CImage.cpp:818
mrpt::vision::featHarris
@ featHarris
Harris border and corner detector [HARRIS].
Definition: vision/include/mrpt/vision/types.h:51
mrpt::vision::featKLT
@ featKLT
Kanade-Lucas-Tomasi feature [SHI'94].
Definition: vision/include/mrpt/vision/types.h:49
mrpt::vision::featFAST
@ featFAST
FAST feature detector, OpenCV's implementation ("Faster and better: A machine learning approach to...
Definition: vision/include/mrpt/vision/types.h:63
mrpt::opengl::CSetOfObjects::Ptr
std::shared_ptr< mrpt::opengl ::CSetOfObjects > Ptr
Definition: CSetOfObjects.h:28
mrpt::vision::matchFeatures
size_t matchFeatures(const CFeatureList &list1, const CFeatureList &list2, CMatchedFeatureList &matches, const TMatchingOptions &options=TMatchingOptions(), const TStereoSystemParams &params=TStereoSystemParams())
Find the matches between two lists of features which must be of the same type.
Definition: vision_utils.cpp:315
mrpt::opengl::CGridPlaneXY::Ptr
std::shared_ptr< mrpt::opengl ::CGridPlaneXY > Ptr
Definition: CGridPlaneXY.h:31
mrpt::system::CTicTac
A high-performance stopwatch, with typical resolution of nanoseconds.
Definition: system/CTicTac.h:17
mrpt::vision
Copyright (C) 2010 Hauke Strasdat Imperial College London Copyright (c) 2005-2020,...
Definition: bundle_adjustment.h:35
mrpt::vision::CFeatureExtraction::computeDescriptors
void computeDescriptors(const mrpt::img::CImage &in_img, CFeatureList &inout_features, TDescriptorType in_descriptor_list)
Compute one (or more) descriptors for the given set of interest points onto the image,...
Definition: CFeatureExtraction_common.cpp:86
mrpt::vision::featSURF
@ featSURF
Speeded Up Robust Feature [BAY'06].
Definition: vision/include/mrpt/vision/types.h:56
mrpt::img::CCanvas::drawFeatures
void drawFeatures(const FEATURELIST &list, const TColor &color=TColor::red(), const bool showIDs=false, const bool showResponse=false, const bool showScale=false, const char marker='+')
Draws a set of marks (or scaled circles for features with scale) onto the image, given a generic cont...
Definition: CCanvas.h:280
mrpt::vision::CFeatureExtraction::TOptions::TSIFTOptions::implementation
TSIFTImplementation implementation
Default: OpenCV.
Definition: CFeatureExtraction.h:184
myDataDir
std::string myDataDir
Definition: vision_stereo_rectify/test.cpp:23
mrpt::gui::CDisplayWindow::setPos
void setPos(int x, int y) override
Changes the position of the window on the screen.
Definition: CDisplayWindow.cpp:555
TestExtractMatchProjectAndPaint
void TestExtractMatchProjectAndPaint()
Definition: vision_stereo_rectify/test.cpp:29
mrpt::vision::descSURF
@ descSURF
SURF descriptors.
Definition: vision/include/mrpt/vision/types.h:83
mrpt::vision::CFeatureList::begin
iterator begin()
Definition: CFeature.h:337
mrpt::vision::CFeatureExtraction::TOptions::patchSize
unsigned int patchSize
Size of the patch to extract, or 0 if no patch is desired (default=21).
Definition: CFeatureExtraction.h:104
CDisplayWindow3D.h
mrpt::vision::openCV_cross_correlation
void openCV_cross_correlation(const mrpt::img::CImage &img, const mrpt::img::CImage &patch_img, size_t &x_max, size_t &y_max, double &max_val, int x_search_ini=-1, int y_search_ini=-1, int x_search_size=-1, int y_search_size=-1)
Computes the correlation between this image and another one, encapsulating the openCV function cvMatc...
Definition: vision_utils.cpp:49
mrpt::gui::CDisplayWindow::showImage
void showImage(const mrpt::img::CImage &img)
Show a given color or grayscale image on the window.
Definition: CDisplayWindow.cpp:364
mrpt::vision::CFeatureExtraction::detectFeatures
void detectFeatures(const mrpt::img::CImage &img, CFeatureList &feats, const unsigned int init_ID=0, const unsigned int nDesiredFeatures=0, const TImageROI &ROI=TImageROI())
Extract features from the image based on the method defined in TOptions.
Definition: CFeatureExtraction_common.cpp:37
mrpt::system::CTicTac::Tac
double Tac() noexcept
Stops the stopwatch.
Definition: CTicTac.cpp:86
mrpt::vision::CFeatureList
A list of visual features, to be used as output by detectors, as input/output by trackers,...
Definition: CFeature.h:275
main
int main()
Definition: vision_stereo_rectify/test.cpp:78
mrpt::gui::CDisplayWindow::showImagesAndMatchedPoints
void showImagesAndMatchedPoints(const mrpt::img::CImage &img1, const mrpt::img::CImage &img2, const MATCHEDLIST &mList, const mrpt::img::TColor &color=mrpt::img::TColor::red(), bool showNumbers=false)
Show a pair of given color or grayscale images (put together) on the window and print a set of matche...
Definition: CDisplayWindow.h:139
TestMatchFeatures
void TestMatchFeatures()
Definition: vision_stereo_rectify/test.cpp:93
mrpt::vision::CFeatureExtraction::TOptions::featsType
TKeyPointMethod featsType
Type of the extracted features.
Definition: CFeatureExtraction.h:99
mrpt::img
Definition: CCanvas.h:16
mrpt::vision::CMatchedFeatureList
A list of features.
Definition: CFeature.h:494
CLandmarksMap.h
COpenGLScene.h
win
mrpt::gui::CDisplayWindow3D::Ptr win
Definition: vision_stereo_rectify/test.cpp:31
mrpt::img::CImage::line
void line(int x0, int y0, int x1, int y1, const mrpt::img::TColor color, unsigned int width=1, TPenStyle penStyle=psSolid) override
Draws a line.
Definition: CImage.cpp:1117
CFeatureExtraction.h
mrpt::img::TColor
A RGB color - 8bit.
Definition: TColor.h:25
argv
const char * argv[]
Definition: RawlogGrabberApp_unittest.cpp:40
mrpt::img::CImage::drawCircle
void drawCircle(int x, int y, int radius, const mrpt::img::TColor &color=mrpt::img::TColor(255, 255, 255), unsigned int width=1) override
Draws a circle of a given radius.
Definition: CImage.cpp:1130
mrpt::img::CH_RGB
@ CH_RGB
Definition: img/CImage.h:62
mrpt::system::CTicTac::Tic
void Tic() noexcept
Starts the stopwatch.
Definition: CTicTac.cpp:75
mrpt::img::CImage::joinImagesHorz
void joinImagesHorz(const CImage &im1, const CImage &im2)
Joins two images side-by-side horizontally.
Definition: CImage.cpp:1887
mrpt::gui::CDisplayWindow
This class creates a window as a graphical user interface (GUI) for displaying images to the user.
Definition: CDisplayWindow.h:33
mrpt::vision::CFeatureExtraction::options
TOptions options
Set all the parameters of the desired method here before calling detectFeatures()
Definition: CFeatureExtraction.h:295
mrpt::gui
Classes for creating GUI windows for 2D and 3D visualization.
Definition: about_box.h:14
mrpt::img::CImage
A class for storing images as grayscale or RGB bitmaps.
Definition: img/CImage.h:148
mrpt::vision::featSIFT
@ featSIFT
Scale Invariant Feature Transform [LOWE'04].
Definition: vision/include/mrpt/vision/types.h:54
mrpt::vision::CFeatureList::end
iterator end()
Definition: CFeature.h:338
mrpt::opengl::COpenGLScene::Ptr
std::shared_ptr< mrpt::opengl ::COpenGLScene > Ptr
Definition: COpenGLScene.h:58
mrpt::vision::descSIFT
@ descSIFT
SIFT descriptors.
Definition: vision/include/mrpt/vision/types.h:81
mrpt::img::CImage::getHeight
size_t getHeight() const override
Returns the height of the image in pixels.
Definition: CImage.cpp:849
mrpt::vision::projectMatchedFeatures
void projectMatchedFeatures(const CMatchedFeatureList &matches, const mrpt::img::TStereoCamera &stereo_camera, std::vector< mrpt::math::TPoint3D > &out_points)
Definition: vision_utils.cpp:770
argc
const int argc
Definition: RawlogGrabberApp_unittest.cpp:41
mrpt::gui::CDisplayWindow::setWindowTitle
void setWindowTitle(const std::string &str) override
Changes the window title text.
Definition: CDisplayWindow.cpp:578
mrpt::vision::TStereoSystemParams
Parameters associated to a stereo system.
Definition: vision/include/mrpt/vision/types.h:233
mrpt::img::CImage::update_patch
void update_patch(const CImage &patch, const unsigned int col, const unsigned int row)
Update a part of this image with the "patch" given as argument.
Definition: CImage.cpp:1154
mrpt::maps::CLandmarksMap
A class for storing a map of 3D probabilistic landmarks.
Definition: CLandmarksMap.h:74
mrpt::img::CCanvas::textOut
virtual void textOut(int x0, int y0, const std::string &str, const mrpt::img::TColor color)
Renders 2D text using bitmap fonts.
Definition: CCanvas.cpp:374
mrpt::exception_to_str
std::string exception_to_str(const std::exception &e)
Builds a nice textual representation of a nested exception, which if generated using MRPT macros (THR...
Definition: exceptions.cpp:59
mrpt::vision::TMatchingOptions::matching_method
TMatchingMethod matching_method
Matching method.
Definition: vision/include/mrpt/vision/types.h:395
mrpt::img::CImage::loadFromFile
bool loadFromFile(const std::string &fileName, int isColor=-1)
Load image from a file, whose format is determined from the extension (internally uses OpenCV).
Definition: CImage.cpp:305
CGridPlaneXY.h
mrpt::vision::CFeatureExtraction::TOptions::SIFTOptions
struct mrpt::vision::CFeatureExtraction::TOptions::TSIFTOptions SIFTOptions
mrpt::maps::CLandmarksMap::getAs3DObject
void getAs3DObject(mrpt::opengl::CSetOfObjects::Ptr &outObj) const override
Returns a 3D object representing the map.
Definition: CLandmarksMap.cpp:2466
mrpt::opengl
The namespace for 3D scene representation and rendering.
Definition: CGlCanvasBase.h:13
CDisplayWindow.h
mrpt::gui::CDisplayWindow3D
A graphical user interface (GUI) for efficiently rendering 3D scenes in real-time.
Definition: CDisplayWindow3D.h:117
mrpt::vision::computeSAD
double computeSAD(const mrpt::img::CImage &patch1, const mrpt::img::CImage &patch2)
Calculates the Sum of Absolutes Differences (range [0,1]) between two patches.
Definition: vision_utils.cpp:736
mrpt::format
std::string std::string format(std::string_view fmt, ARGS &&... args)
Definition: format.h:26
mrpt::system::pause
void pause(const std::string &msg=std::string("Press any key to continue...")) noexcept
Shows the message "Press any key to continue" (or other custom message) to the current standard outpu...
Definition: os.cpp:430
mrpt::system
Definition: backtrace.h:14
mrpt::img::CCanvas::filledRectangle
virtual void filledRectangle(int x0, int y0, int x1, int y1, const mrpt::img::TColor color)
Draws a filled rectangle.
Definition: CCanvas.cpp:205
mrpt::vision::TMatchingOptions
A structure containing options for the matching.
Definition: vision/include/mrpt/vision/types.h:342



Page generated by Doxygen 1.8.17 for MRPT 2.0.3 at Fri May 15 23:51:15 UTC 2020