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



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 8fe78517f Sun Jul 14 19:43:28 2019 +0200 at lun oct 28 02:10:00 CET 2019