Main MRPT website > C++ reference for MRPT 1.9.9
test.cpp
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2018, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://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  // size_t nMatches;
78  TMatchingOptions opt;
79  cout << "Matching HARRIS features by CORRELATION" << endl;
80  // nMatches =
81  matchFeatures(featsHarris_L, featsHarris_R, mHarris);
82  cout << "Matches found: " << mHarris.size() << endl;
83 
84  cout << "***************************************************" << endl;
85 
86  // Project features:
88  TStereoSystemParams stereoOptions; // Default options: Bumblebee + 640x480
89  cout << "Projecting matched features" << endl;
90  mrpt::vision::projectMatchedFeatures(mHarris, stereoOptions, outMap);
91 
92  CDisplayWindow3D win3D("3D Map");
93  COpenGLScene::Ptr& scene3D = win3D.get3DSceneAndLock();
94  CSetOfObjects::Ptr map3D = mrpt::make_aligned_shared<CSetOfObjects>();
95  outMap.getAs3DObject(map3D);
96  CGridPlaneXY::Ptr gridXY =
97  mrpt::make_aligned_shared<CGridPlaneXY>(-10, 10, -10, 10, 0, 1);
98 
99  scene3D->insert(gridXY);
100  scene3D->insert(map3D);
101 
102  win3D.unlockAccess3DScene();
103  win3D.repaint();
104 
106 
107 } // end TestExtractMatchProjectAndPaint
108 
109 // ------------------------------------------------------
110 // TestMatchFeatures
111 // ------------------------------------------------------
112 void TestMatchFeatures(bool showMatches)
113 {
114  CFeatureExtraction fExt;
115  CFeatureList featsHarris_L, featsHarris_R, featsSIFT_L, featsSIFT_R,
116  featsSURF_L, featsSURF_R, featsFAST_L, featsFAST_R;
117  CMatchedFeatureList mHarris, mSIFT, mSURF, mHarris_SAD, mFAST_CC, mFAST_SAD;
118  CImage imL, imR;
119 
120  string imgL = myDataDir + string("imL_p01.jpg"); // Left image
121  string imgR = myDataDir + string("imR_p01.jpg"); // Right image
122 
123  // Load and check images
124  if (!imL.loadFromFile(imgL))
125  {
126  cerr << "Cannot load " << imgL << endl;
127  return;
128  }
129  cout << "Loaded LEFT image: " << endl << imgL << endl;
130 
131  if (!imR.loadFromFile(imgR))
132  {
133  cerr << "Cannot load " << imgR << endl;
134  return;
135  }
136  cout << "Loaded RIGHT image: " << endl << imgR << endl;
137 
138  cout << "***************************************************" << endl;
139  cout << "***************************************************" << endl;
140 
141  // Extract features:
142  // HARRIS
143  cout << "Detecting HARRIS features in LEFT image" << endl;
145  fExt.detectFeatures(imL, featsHarris_L, 250);
146  cout << "Detected " << featsHarris_L.size() << endl;
147 
148  cout << "Detecting HARRIS features in RIGHT image" << endl;
149  fExt.detectFeatures(imR, featsHarris_R, 250);
150  cout << "Detected " << featsHarris_R.size() << endl;
151  cout << "***************************************************" << endl;
152 
153  // SIFT
154  cout << "Detecting SIFT features in LEFT image" << endl;
155  fExt.options.featsType = featSIFT;
156  // fExt.options.SIFTOptions.implementation = CFeatureExtraction::Hess;
157  fExt.options.SIFTOptions.implementation = CFeatureExtraction::OpenCV;
158  fExt.detectFeatures(imL, featsSIFT_L);
159  cout << "Detected " << featsSIFT_L.size() << endl;
160 
161  cout << "Detecting SIFT features in RIGHT image" << endl;
162  fExt.options.featsType = featSIFT;
163  // fExt.options.SIFTOptions.implementation = CFeatureExtraction::Hess;
164  fExt.options.SIFTOptions.implementation = CFeatureExtraction::OpenCV;
165  fExt.detectFeatures(imR, featsSIFT_R);
166  cout << "Detected " << featsSIFT_R.size() << endl;
167  cout << "***************************************************" << endl;
168 
169  // SURF
170  cout << "Detecting SURF features in LEFT image" << endl;
171  fExt.options.featsType = featSURF;
172  fExt.detectFeatures(imL, featsSURF_L);
173  cout << "Detected " << featsSURF_L.size() << endl;
174 
175  cout << "Detecting SURF features in RIGHT image" << endl;
176  fExt.detectFeatures(imR, featsSURF_R);
177  cout << "Detected " << featsSURF_R.size() << endl;
178  cout << "***************************************************" << endl;
179 
180  // FAST
181  cout << "Detecting FAST features in LEFT image" << endl;
182  fExt.options.featsType = featFAST;
183  fExt.detectFeatures(imL, featsFAST_L, 0, 250);
184  cout << "Detected " << featsFAST_L.size() << endl;
185 
186  cout << "Detecting FAST features in RIGHT image" << endl;
187  fExt.detectFeatures(imR, featsFAST_R, 0, 250);
188  cout << "Detected " << featsFAST_R.size() << endl;
189  cout << "***************************************************" << endl;
190  cout << "***************************************************" << endl;
191 
192  // Match features:
193  size_t nMatches;
194  TMatchingOptions opt;
195 
196  // // HARRIS
197  CTicTac tictac;
198  double T = 0.0;
199  cout << "Matching HARRIS features" << endl;
200  tictac.Tic();
201  nMatches = matchFeatures(featsHarris_L, featsHarris_R, mHarris);
202  T = tictac.Tac();
203  cout << "[NCC] Matches found: " << mHarris.size() << " in " << T * 1000.0f
204  << " ms " << endl;
205 
206  opt.matching_method = TMatchingOptions::mmSAD;
207  tictac.Tic();
208  nMatches = matchFeatures(featsHarris_L, featsHarris_R, mHarris_SAD, opt);
209  T = tictac.Tac();
210  cout << "[SAD] Matches found: " << mHarris_SAD.size() << " in "
211  << T * 1000.0f << " ms " << endl;
212  cout << "***************************************************" << endl;
213 
214  // SIFT
215  cout << "Matching SIFT features by DESCRIPTOR" << endl;
216  opt.matching_method = TMatchingOptions::mmDescriptorSIFT;
217  tictac.Tic();
218  nMatches = matchFeatures(featsSIFT_L, featsSIFT_R, mSIFT, opt);
219  T = tictac.Tac();
220  cout << "Matches found: " << mSIFT.size() << " in " << T * 1000.0f << " ms "
221  << endl;
222  cout << "***************************************************" << endl;
223 
224  // SURF
225  cout << "Matching SURF features by DESCRIPTOR" << endl;
226  opt.matching_method = TMatchingOptions::mmDescriptorSURF;
227  tictac.Tic();
228  nMatches = matchFeatures(featsSURF_L, featsSURF_R, mSURF, opt);
229  T = tictac.Tac();
230  cout << "Matches found: " << mSURF.size() << " in " << T * 1000.0f << " ms "
231  << endl;
232  cout << "***************************************************" << endl;
233 
234  // FAST
235  cout << "Matching FAST features" << endl;
236  tictac.Tic();
237  nMatches = matchFeatures(featsFAST_L, featsFAST_R, mFAST_CC);
238  T = tictac.Tac();
239  cout << "[NCC] Matches found: " << mFAST_CC.size() << " in " << T * 1000.0f
240  << " ms " << endl;
241 
242  opt.matching_method = TMatchingOptions::mmSAD;
243  tictac.Tic();
244  nMatches = matchFeatures(featsFAST_L, featsFAST_R, mFAST_SAD, opt);
245  T = tictac.Tac();
246  cout << "[SAD] Matches found: " << mFAST_SAD.size() << " in " << T * 1000.0f
247  << " ms " << endl;
248  cout << "***************************************************" << endl;
249 
250  if (showMatches)
251  {
252  CDisplayWindow winHarrisSAD, winHarrisNCC, winFASTSAD, winFASTNCC,
253  winSIFT, winSURF;
254 
255  winHarrisSAD.setWindowTitle("Matches with Harris + SAD");
256  winHarrisNCC.setWindowTitle("Matches with Harris + NCC");
257  winFASTSAD.setWindowTitle("Matches with FAST + SAD");
258  winFASTNCC.setWindowTitle("Matches with FAST + NCC");
259  winSIFT.setWindowTitle("Matches with SIFT");
260  winSURF.setWindowTitle("Matches with SURF");
261 
262  winHarrisNCC.showImagesAndMatchedPoints(
263  imL, imR, mHarris, TColor(0, 0, 255));
264  winHarrisSAD.showImagesAndMatchedPoints(
265  imL, imR, mHarris_SAD, TColor(0, 0, 255));
266  winSIFT.showImagesAndMatchedPoints(imL, imR, mSIFT, TColor(0, 255, 0));
267  winSURF.showImagesAndMatchedPoints(imL, imR, mSURF, TColor(0, 255, 0));
268  winFASTSAD.showImagesAndMatchedPoints(
269  imL, imR, mFAST_SAD, TColor(0, 255, 0));
270  winFASTNCC.showImagesAndMatchedPoints(
271  imL, imR, mFAST_CC, TColor(0, 255, 0));
272 
274  }
275 
276 } // end TestMatchFeatures
277 
278 // ------------------------------------------------------
279 // TestMatchingComparative
280 // ------------------------------------------------------
282 {
283  // Take two images
284  string imgL = myDataDir + string("imL_p01.jpg"); // Left image
285  string imgR = myDataDir + string("imR_p01.jpg"); // Right image
286 
287  CImage im1, im2;
288  im1.loadFromFile(imgL);
289  im2.loadFromFile(imgR);
290 
291  size_t imW = im1.getWidth();
292  size_t imH = im1.getHeight();
293 
294  CFeatureExtraction fExt;
295  fExt.options.featsType = featFAST;
296  fExt.options.patchSize = 21;
297  fExt.options.SIFTOptions.implementation = CFeatureExtraction::Hess;
298 
299  // Find FAST features
300  CFeatureList list1, list2;
301  fExt.detectFeatures(im1, list1, 150);
302  // Compute SIFT & SURF descriptors
303  fExt.computeDescriptors(im1, list1, descSIFT);
304  fExt.computeDescriptors(im1, list1, descSURF);
305 
306  fExt.detectFeatures(im2, list2, 150);
307  // Compute SIFT & SURF descriptors
308  fExt.computeDescriptors(im2, list2, descSIFT);
309  fExt.computeDescriptors(im2, list2, descSURF);
310 
311  CFeatureList::iterator it1, it2;
312  for (it1 = list1.begin(); it1 != list1.end(); ++it1)
313  im1.cross((*it1)->x, (*it1)->y, TColor::red(), '+');
314  for (it2 = list2.begin(); it2 != list2.end(); ++it2)
315  im2.cross((*it2)->x, (*it2)->y, TColor::red(), '+');
316 
317  CDisplayWindow win, win2;
318  win.setPos(0, 0);
319  win2.setPos(0, imH * 1.5);
320  CImage joinimage, copyjoinimage, copyInfoImage;
321  size_t imW2 = 1280;
322  size_t imH2 = 150;
323 
324  CImage infoimage(imW2, imH2, CH_RGB);
325 
326  joinimage.joinImagesHorz(im1, im2);
327  infoimage.filledRectangle(0, 0, imW2, imH2, TColor(150, 150, 150));
328  infoimage.textOut(20, imH2 - 53, "SAD", TColor::blue());
329  infoimage.textOut(20, imH2 - 41, "NCC", TColor::blue());
330  infoimage.textOut(20, imH2 - 29, "SIFT", TColor::blue());
331  infoimage.textOut(20, imH2 - 17, "SURF", TColor::blue());
332  for (it1 = list1.begin(); it1 != list1.end(); ++it1)
333  {
334  copyInfoImage = infoimage;
335  copyjoinimage = joinimage;
336  copyjoinimage.line(
337  (*it1)->x, 0, (*it1)->x, imH, TColor::green()); // Horiz
338  copyjoinimage.line(
339  (*it1)->x + imW, 0, (*it1)->x + imW, imH,
340  TColor::green()); // Horiz
341  copyjoinimage.line(
342  0, (*it1)->y, imW + imW, (*it1)->y, TColor::green()); // Epipolar
343  copyjoinimage.drawCircle(
344  (*it1)->x, (*it1)->y, 4, TColor::green(), 2); // Keypoint
345 
346  copyInfoImage.update_patch((*it1)->patch, 0, 0);
347  bool firstMatch = true;
348  int cnt = 0;
349  int px = 80;
350  double minsad = 1.0, maxncc = 0.0;
351  float minsiftd = 1.0f, minsurfd = 1.0f;
352  int idxsad = 0, idxncc = 0, idxsiftd = 0, idxsurfd = 0;
353 
354  for (it2 = list2.begin(); it2 != list2.end(); ++it2)
355  {
356  if (fabs((*it1)->y - (*it2)->y) <= 1.0 && (*it1)->x > (*it2)->x)
357  {
358  // Compute matching with SAD and Correlation and SIFT/SURF?
359  // Use epipolar constraints
360  // Compute SAD
361  double sad =
362  mrpt::vision::computeSAD((*it1)->patch, (*it2)->patch);
363  if (sad < minsad)
364  {
365  minsad = sad;
366  idxsad = cnt;
367  }
368  // Compute Correlation
369  double ncc;
370  size_t u, v;
372  (*it1)->patch, (*it2)->patch, u, v, ncc);
373  if (ncc > maxncc)
374  {
375  maxncc = ncc;
376  idxncc = cnt;
377  }
378 
379  // Compute distance between descriptors SIFT
380  float siftd = (*it1)->descriptorSIFTDistanceTo(*(*it2));
381  if (siftd < minsiftd)
382  {
383  minsiftd = siftd;
384  idxsiftd = cnt;
385  }
386 
387  // Compute distance between descriptors SIFT
388  float surfd = (*it1)->descriptorSURFDistanceTo(*(*it2));
389  if (surfd < minsurfd)
390  {
391  minsurfd = surfd;
392  idxsurfd = cnt;
393  }
394 
395  // Plot images + features + each candidate + difference score
396  if (firstMatch)
397  {
398  copyjoinimage.line(
399  (*it1)->x + imW, 0, (*it1)->x + imW, imH,
400  TColor::green()); // Limit line (only the first time)
401  firstMatch = false;
402  } // end-if
403 
404  copyjoinimage.drawCircle(
405  (*it2)->x + imW, (*it2)->y, 4, TColor::blue(),
406  2); // Keypoint
407  double rx0, rx1, ry0, ry1, tx, ty;
408  rx0 = (*it2)->x + imW - 15;
409  rx1 = (*it2)->x + imW;
410  tx = (*it2)->x + imW - 13;
411  if (cnt % 2)
412  {
413  ry0 = (*it2)->y - 20;
414  ry1 = (*it2)->y - 10;
415  ty = (*it2)->y - 22;
416  }
417  else
418  {
419  ry0 = (*it2)->y + 10;
420  ry1 = (*it2)->y + 20;
421  ty = (*it2)->y + 8;
422  }
423  copyjoinimage.filledRectangle(
424  rx0, ry0, rx1, ry1, TColor(150, 150, 150));
425  copyjoinimage.textOut(
426  tx, ty, format("%d", cnt), TColor::blue());
427 
428  px = 80 + cnt * 50;
429  if (px + fExt.options.patchSize > imW2) continue;
430 
431  copyInfoImage.update_patch((*it2)->patch, px, 30);
432 
433  copyInfoImage.textOut(
434  px, imH2 - 70, format("%d", cnt), TColor::blue());
435  copyInfoImage.textOut(
436  px, imH2 - 53, format("%.2f", sad), TColor::blue());
437  copyInfoImage.textOut(
438  px, imH2 - 41, format("%.2f", ncc), TColor::blue());
439  copyInfoImage.textOut(
440  px, imH2 - 29, format("%.2f", siftd), TColor::blue());
441  copyInfoImage.textOut(
442  px, imH2 - 17, format("%.2f", surfd), TColor::blue());
443 
444  cnt++;
445  } // end if
446  } // end for it2
447  copyInfoImage.textOut(
448  80 + idxsad * 50, imH2 - 53, format("%.2f", minsad),
449  TColor::green());
450  copyInfoImage.textOut(
451  80 + idxncc * 50, imH2 - 41, format("%.2f", maxncc),
452  TColor::green());
453  copyInfoImage.textOut(
454  80 + idxsiftd * 50, imH2 - 29, format("%.2f", minsiftd),
455  TColor::green());
456  copyInfoImage.textOut(
457  80 + idxsurfd * 50, imH2 - 17, format("%.2f", minsurfd),
458  TColor::green());
459 
460  win.showImage(copyjoinimage);
461  win2.showImage(copyInfoImage);
463  } // end for it1
464 
465  // Save to file
466  // Check number of good features
467 
468 } // end TestMatchingComparative
469 
470 int main(int argc, char** argv)
471 {
472  try
473  {
474  if (argc == 1)
475  {
476  cerr << "Usage: " << argv[0] << endl;
477  cerr << "Options:" << endl;
478  cerr << " -match [-s]: TestMatchFeatures (if -s is set, final "
479  "matches in images will be shown)."
480  << endl;
481  cerr << " -comp: TestMatchingComparative." << endl;
482  cerr << " -proj: TestExtractMatchProjectAndPaint." << endl;
483  }
484  else
485  {
486  if (!strcmp(argv[1], "-match"))
487  {
488  if (argc == 3 && !strcmp(argv[2], "-s"))
489  TestMatchFeatures(true);
490  else
491  TestMatchFeatures(false);
492  }
493  else if (!strcmp(argv[1], "-proj"))
495  else if (!strcmp(argv[1], "-comp"))
496  {
497  cout << "Press ^C to finish program." << endl;
499  }
500  else
501  {
502  cerr << "Usage: " << argv[0] << endl;
503  cerr << "Options:" << endl;
504  cerr << " -match [-s]: TestMatchFeatures (if -s is set, final "
505  "matches in images will be shown)."
506  << endl;
507  cerr << " -comp: TestMatchingComparative." << endl;
508  cerr << " -proj: TestExtractMatchProjectAndPaint." << endl;
509  }
510  }
511  return 0;
512  }
513  catch (std::exception& e)
514  {
515  std::cout << "MRPT exception caught: " << e.what() << std::endl;
516  return -1;
517  }
518  catch (...)
519  {
520  printf("Another exception!!");
521  return -1;
522  }
523 }
mrpt::vision::CFeatureList::size
size_t size() const
Definition: CFeature.h:388
TestMatchingComparative
void TestMatchingComparative()
Definition: vision_stereo_rectify/test.cpp:279
mrpt::opengl::CGridPlaneXY::Ptr
std::shared_ptr< CGridPlaneXY > Ptr
Definition: CGridPlaneXY.h:34
mrpt::vision::CFeatureExtraction
The central class from which images can be analyzed in search of different kinds of interest points a...
Definition: CFeatureExtraction.h:82
mrpt::img::CImage::getWidth
size_t getWidth() const override
Returns the width of the image in pixels.
Definition: CImage.cpp:864
mrpt::vision::featFAST
@ featFAST
FAST feature detector, OpenCV's implementation ("Faster and better: A machine learning approac...
Definition: vision/include/mrpt/vision/types.h:70
mrpt::vision::CFeatureExtraction::computeDescriptors
void computeDescriptors(const mrpt::img::CImage &in_img, CFeatureList &inout_features, TDescriptorType in_descriptor_list) const
Compute one (or more) descriptors for the given set of interest points onto the image,...
Definition: CFeatureExtraction_common.cpp:234
red
unsigned char red[10]
Definition: PbMapMaker.cpp:1298
green
GLclampf green
Definition: glext.h:3525
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:456
mrpt::system::CTicTac
A high-performance stopwatch, with typical resolution of nanoseconds.
Definition: system/CTicTac.h:19
mrpt::vision
Classes for computer vision, detectors, features, etc.
Definition: CCamModel.h:20
mrpt::img::CCanvas::cross
void cross(int x0, int y0, const mrpt::img::TColor color, char type, unsigned int size=5, unsigned int width=1)
Draw a cross.
Definition: CCanvas.cpp:305
CH_RGB
#define CH_RGB
Definition: img/CImage.h:45
mrpt::vision::CFeatureExtraction::TOptions::TSIFTOptions::implementation
TSIFTImplementation implementation
Default: Hess (OpenCV.
Definition: CFeatureExtraction.h:196
mrpt::vision::CFeatureList::iterator
TInternalFeatList::iterator iterator
Definition: CFeature.h:367
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:621
TestExtractMatchProjectAndPaint
void TestExtractMatchProjectAndPaint()
Definition: vision_stereo_rectify/test.cpp:57
mrpt::vision::featKLT
@ featKLT
Kanade-Lucas-Tomasi feature [SHI'94].
Definition: vision/include/mrpt/vision/types.h:55
mrpt::vision::CFeatureExtraction::TOptions::featsType
TFeatureType featsType
Type of the extracted features.
Definition: CFeatureExtraction.h:108
mrpt::vision::CFeatureList::begin
iterator begin()
Definition: CFeature.h:373
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:113
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:56
mrpt::gui::CDisplayWindow::showImage
void showImage(const mrpt::img::CImage &img)
Show a given color or grayscale image on the window.
Definition: CDisplayWindow.cpp:417
ty
GLbyte ty
Definition: glext.h:6092
mrpt::system::CTicTac::Tac
double Tac() noexcept
Stops the stopwatch.
Definition: CTicTac.cpp:90
mrpt::vision::CFeatureList
A list of visual features, to be used as output by detectors, as input/output by trackers,...
Definition: CFeature.h:304
v
const GLdouble * v
Definition: glext.h:3678
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:138
TestMatchFeatures
void TestMatchFeatures()
Definition: vision_stereo_rectify/test.cpp:121
mrpt::vision::descSIFT
@ descSIFT
SIFT descriptors.
Definition: vision/include/mrpt/vision/types.h:100
mrpt::img
Definition: CCanvas.h:17
mrpt::vision::CMatchedFeatureList
A list of features.
Definition: CFeature.h:503
CLandmarksMap.h
COpenGLScene.h
win
mrpt::gui::CDisplayWindow3D::Ptr win
Definition: vision_stereo_rectify/test.cpp:31
mrpt::format
std::string format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
Definition: format.cpp:16
mrpt::vision::featSIFT
@ featSIFT
Scale Invariant Feature Transform [LOWE'04].
Definition: vision/include/mrpt/vision/types.h:61
mrpt::vision::descSURF
@ descSURF
SURF descriptors.
Definition: vision/include/mrpt/vision/types.h:102
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:1296
CFeatureExtraction.h
mrpt::img::TColor
A RGB color - 8bit.
Definition: TColor.h:22
mrpt::vision::featHarris
@ featHarris
Harris border and corner detector [HARRIS].
Definition: vision/include/mrpt/vision/types.h:57
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:1315
mrpt::system::CTicTac::Tic
void Tic() noexcept
Starts the stopwatch.
Definition: CTicTac.cpp:79
mrpt::img::CImage::joinImagesHorz
void joinImagesHorz(const CImage &im1, const CImage &im2)
Joins two images side-by-side horizontally.
Definition: CImage.cpp:2437
mrpt::gui::CDisplayWindow
This class creates a window as a graphical user interface (GUI) for displaying images to the user.
Definition: CDisplayWindow.h:30
mrpt::vision::CFeatureExtraction::options
TOptions options
Set all the parameters of the desired method here.
Definition: CFeatureExtraction.h:317
mrpt::opengl::CSetOfObjects::Ptr
std::shared_ptr< CSetOfObjects > Ptr
Definition: CSetOfObjects.h:30
mrpt::gui
Classes for creating GUI windows for 2D and 3D visualization.
Definition: about_box.h:16
mrpt::img::CImage
A class for storing images as grayscale or RGB bitmaps.
Definition: img/CImage.h:130
mrpt::vision::CFeatureList::end
iterator end()
Definition: CFeature.h:374
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()) const
Extract features from the image based on the method defined in TOptions.
Definition: CFeatureExtraction_common.cpp:38
mrpt::img::CImage::getHeight
size_t getHeight() const override
Returns the height of the image in pixels.
Definition: CImage.cpp:892
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:988
mrpt::vision::featSURF
@ featSURF
Speeded Up Robust Feature [BAY'06].
Definition: vision/include/mrpt/vision/types.h:63
mrpt::gui::CDisplayWindow::setWindowTitle
void setWindowTitle(const std::string &str) override
Changes the window title text.
Definition: CDisplayWindow.cpp:648
mrpt::vision::TStereoSystemParams
Parameters associated to a stereo system.
Definition: vision/include/mrpt/vision/types.h:253
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:1332
blue
GLclampf GLclampf blue
Definition: glext.h:3525
string
GLsizei const GLchar ** string
Definition: glext.h:4101
mrpt::opengl::COpenGLScene::Ptr
std::shared_ptr< COpenGLScene > Ptr
Definition: COpenGLScene.h:61
mrpt::maps::CLandmarksMap
A class for storing a map of 3D probabilistic landmarks.
Definition: CLandmarksMap.h:75
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:369
mrpt::vision::TMatchingOptions::matching_method
TMatchingMethod matching_method
Matching method.
Definition: vision/include/mrpt/vision/types.h:412
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:271
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:2581
mrpt::opengl
The namespace for 3D scene representation and rendering.
Definition: CGlCanvasBase.h:15
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:949
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:428
mrpt::system
This namespace provides a OS-independent interface to many useful functions: filenames manipulation,...
Definition: math_frwds.h:25
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:214
mrpt::vision::TMatchingOptions
A structure containing options for the matching.
Definition: vision/include/mrpt/vision/types.h:359



Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST