Main MRPT website > C++ reference for MRPT 1.9.9
CFeatureExtraction_common.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-2017, 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  */
10 
11 #include "vision-precomp.h" // Precompiled headers
12 
14 #include <mrpt/utils/CTicTac.h>
15 #include <mrpt/utils/CStream.h>
16 
17 using namespace mrpt;
18 using namespace mrpt::vision;
19 using namespace mrpt::utils;
20 using namespace mrpt::system;
21 using namespace std;
22 
23 /************************************************************************************************
24 * Constructor *
25 ************************************************************************************************/
27 /************************************************************************************************
28 * Destructor *
29 ************************************************************************************************/
31 struct sort_pred
32 {
33  bool operator()(
34  const std::vector<unsigned int>& left,
35  const std::vector<unsigned int>& right)
36  {
37  return left[1] < right[1];
38  }
39 };
40 
41 /************************************************************************************************
42 * extractFeatures *
43 ************************************************************************************************/
45  const CImage& img, CFeatureList& feats, const unsigned int init_ID,
46  const unsigned int nDesiredFeatures, const TImageROI& ROI) const
47 {
48  switch (options.featsType)
49  {
50  case featHarris:
51  MRPT_TODO(
52  "Refactor: check if OpenCV's tile method can be directly "
53  "called to save space here?")
54  if (options.harrisOptions.tile_image)
55  {
56  mrpt::utils::CTicTac tictac;
57 
58  if (!(ROI.xMax == 0 && ROI.xMin == 0 && ROI.yMax == 0 &&
59  ROI.yMin == 0)) // ROI must be not active for this option
60  std::cout << "Warning: Image ROI is not taken into "
61  "account, as harrisOptions.tile is set to YES"
62  << std::endl;
63 
64  TImageROI newROI;
65 
66  unsigned int wd = img.getWidth();
67  unsigned int hg = img.getHeight();
68 
69  unsigned int tt =
70  0; // Total number of features detected in the whole image
71  std::vector<std::vector<unsigned int>> tam(8);
72  std::vector<CFeatureList> aux_feats(
73  8); // 2x4 tiles into the image -> 8 sets of features
74 
75  for (unsigned int k = 0; k < 4;
76  k++) // Search over the 2x4 tiled image
77  {
78  // Resize the inner vector
79  tam[k].resize(2);
80  tam[k + 4].resize(2);
81 
82  // First row
83  newROI.xMin = k * wd / 4.f;
84  newROI.yMin = 0;
85  newROI.xMax = wd / 4.f + k * wd / 4.f - 1;
86  newROI.yMax = hg / 2.f - 1;
87 
88  tictac.Tic();
89  extractFeaturesKLT(
90  img, aux_feats[k], init_ID, nDesiredFeatures, newROI);
91  cout << "Tiempo en extraer una tile: "
92  << tictac.Tac() * 1000.0f << endl;
93 
94  tam[k][0] = k;
95  tam[k][1] = aux_feats[k].size();
96 
97  // Second row
98  newROI.xMin = k * wd / 4;
99  newROI.yMin = hg / 2;
100  newROI.xMax = wd / 4 + k * wd / 4 - 1;
101  newROI.yMax = hg - 1;
102 
103  tictac.Tic();
104  extractFeaturesKLT(
105  img, aux_feats[k + 4], init_ID, nDesiredFeatures,
106  newROI);
107  cout << "Tiempo en extraer una tile: "
108  << tictac.Tac() * 1000.0f << endl;
109 
110  tam[k + 4][0] = k + 4;
111  tam[k + 4][1] = aux_feats[k + 4].size();
112 
113  tt += aux_feats[k].size() + aux_feats[k + 4].size();
114  }
115 
116  // Merge all the features
117  unsigned int new_nDesiredFeatures =
118  nDesiredFeatures <= 0 ? 300 : nDesiredFeatures;
119  unsigned int o_n_per_tile = floor(new_nDesiredFeatures / 8.0f);
120  feats.clear();
121  if (tt > new_nDesiredFeatures) // We have found too many
122  // features, we have to select
123  // them
124  {
125  // Order the size vector
126  std::sort(tam.begin(), tam.end(), sort_pred());
127 
128  if (tam[0][1] > o_n_per_tile) // The smallest subset
129  {
130  // Everything goes right -> Get o_n_per_tile features
131  // from each tile.
132  for (unsigned int m = 0; m < 8; m++)
133  for (unsigned int k = 0; k < o_n_per_tile; k++)
134  feats.push_back(aux_feats[m][k]);
135  }
136  else
137  {
138  std::vector<std::vector<unsigned int>>::iterator
139  itVector;
140  unsigned int n_per_tile = o_n_per_tile;
141 
142  for (itVector = tam.begin(); itVector != tam.end();
143  itVector++)
144  {
145  if ((*itVector)[1] <
146  n_per_tile) // Size of the subset
147  {
148  // We have to distribute the features among the
149  // tiles
150  for (unsigned int k = 0; k < (*itVector)[1];
151  k++)
152  {
153  feats.push_back(
154  aux_feats[(*itVector)[0]][k]);
155  n_per_tile += (n_per_tile - (*itVector)[1]);
156  } // end for
157  } // end if
158  else
159  {
160  for (unsigned int k = 0; k < n_per_tile; k++)
161  {
162  feats.push_back(
163  aux_feats[(*itVector)[0]][k]);
164  n_per_tile = o_n_per_tile;
165  } // end for
166  } // end else
167  } // end for 'itVector'
168  } // end else
169  } // end if tt > nDesiredFeatures
170  else // We have found less features than the desired
171  {
172  CFeatureList::iterator itList;
173  for (unsigned int m = 0; m < 8; m++)
174  for (itList = aux_feats[m].begin();
175  itList != aux_feats[m].end(); itList++)
176  feats.push_back(*itList);
177  ;
178  }
179 
180  } // end if
181 
182  else
183  extractFeaturesKLT(img, feats, init_ID, nDesiredFeatures, ROI);
184  break;
185 
186  case featKLT:
187  extractFeaturesKLT(img, feats, init_ID, nDesiredFeatures, ROI);
188  break;
189 
190  case featSIFT:
191  extractFeaturesSIFT(img, feats, init_ID, nDesiredFeatures, ROI);
192  break;
193 
194  case featBCD:
195  extractFeaturesBCD(img, feats, init_ID, nDesiredFeatures, ROI);
196  break;
197 
198  case featSURF:
199  extractFeaturesSURF(img, feats, init_ID, nDesiredFeatures, ROI);
200  break;
201 
202  case featFAST:
203  extractFeaturesFAST(img, feats, init_ID, nDesiredFeatures, ROI);
204  break;
205 
206  case featFASTER9:
207  extractFeaturesFASTER_N(
208  9, img, feats, init_ID, nDesiredFeatures, ROI);
209  break;
210  case featFASTER10:
211  extractFeaturesFASTER_N(
212  10, img, feats, init_ID, nDesiredFeatures, ROI);
213  break;
214  case featFASTER12:
215  extractFeaturesFASTER_N(
216  12, img, feats, init_ID, nDesiredFeatures, ROI);
217  break;
218 
219  case featORB:
220  extractFeaturesORB(img, feats, init_ID, nDesiredFeatures, ROI);
221  break;
222 
223  // # added by Raghavender Sahdev
224  case featAKAZE:
225  extractFeaturesAKAZE(img, feats, init_ID, nDesiredFeatures, ROI);
226  break;
227  case featLSD:
228  extractFeaturesLSD(img, feats, init_ID, nDesiredFeatures, ROI);
229  break;
230 
231  default:
232  THROW_EXCEPTION("options.method has an invalid value!");
233  break;
234  }
235 }
236 
237 /************************************************************************************************
238  computeDescriptors
239 ************************************************************************************************/
241  const CImage& in_img, CFeatureList& inout_features,
242  TDescriptorType in_descriptor_list) const
243 {
244  MRPT_START
245 
246  int nDescComputed = 0;
247 
248  if ((in_descriptor_list & descSIFT) != 0)
249  {
250  this->internal_computeSiftDescriptors(in_img, inout_features);
251  ++nDescComputed;
252  }
253  if ((in_descriptor_list & descSURF) != 0)
254  {
255  this->internal_computeSurfDescriptors(in_img, inout_features);
256  ++nDescComputed;
257  }
258  if ((in_descriptor_list & descSpinImages) != 0)
259  {
260  this->internal_computeSpinImageDescriptors(in_img, inout_features);
261  ++nDescComputed;
262  }
263  if ((in_descriptor_list & descPolarImages) != 0)
264  {
265  this->internal_computePolarImageDescriptors(in_img, inout_features);
266  ++nDescComputed;
267  }
268  if ((in_descriptor_list & descLogPolarImages) != 0)
269  {
270  this->internal_computeLogPolarImageDescriptors(in_img, inout_features);
271  ++nDescComputed;
272  }
273  if ((in_descriptor_list & descORB) != 0)
274  {
275  this->internal_computeORBDescriptors(in_img, inout_features);
276  ++nDescComputed;
277  }
278  // # added by Raghavender Sahdev
279  if ((in_descriptor_list & descBLD) != 0)
280  {
281  this->internal_computeBLDLineDescriptors(in_img, inout_features);
282  ++nDescComputed;
283  }
284  if ((in_descriptor_list & descLATCH) != 0)
285  {
286  this->internal_computeLATCHDescriptors(in_img, inout_features);
287  ++nDescComputed;
288  }
289  if (!nDescComputed)
291  "No known descriptor value found in in_descriptor_list=%u",
292  (unsigned)in_descriptor_list)
293 
294  MRPT_END
295 }
296 
297 /************************************************************************************************
298 * extractFeaturesBCD *
299 ************************************************************************************************/
301  const CImage& img, CFeatureList& feats, unsigned int init_ID,
302  unsigned int nDesiredFeatures, const TImageROI& ROI) const
303 {
305  MRPT_UNUSED_PARAM(feats);
306  MRPT_UNUSED_PARAM(init_ID);
307  MRPT_UNUSED_PARAM(nDesiredFeatures);
308  MRPT_UNUSED_PARAM(ROI);
309 
310  THROW_EXCEPTION("Not implemented yet!");
311 } // end extractFeaturesBCD
312 
313 /*------------------------------------------------------------
314  TOptions()
315 -------------------------------------------------------------*/
317  : featsType(_featsType) // Default Method: Kanade-Lucas-Tomasi
318 {
319  // General options
320  patchSize = 21; // Patch size
321  FIND_SUBPIXEL = true; // Find subpixel
322  useMask = false; // Use mask for finding features
323  addNewFeatures = false; // Add to existing feature list
324 
325  // Harris Options
326  harrisOptions.k = 0.04f;
327  harrisOptions.radius = 3; // 15;
329  0.005f; // 0.01f; The lower this is, more features will be found
330  harrisOptions.sigma = 3.0f;
331  harrisOptions.min_distance = 5; // 10;
332  harrisOptions.tile_image = false;
333 
334  // KLT Options
335  KLTOptions.min_distance = 5; // 10;
336  KLTOptions.threshold = 0.1f; // 0.005 ; 0.01f;
337  KLTOptions.radius = 15; // 3;
338  KLTOptions.tile_image = false;
339 
340  // SIFT Options
341  SIFTOptions.implementation = Hess; // Default implementation: Hess
342 
343  // SURF Options
344 
345  // BCD Options
346 
347  // FAST:
348  FASTOptions.threshold = 20;
352 
353  // ORB:
354  ORBOptions.extract_patch = false;
356  ORBOptions.n_levels = 8;
357  ORBOptions.scale_factor = 1.2f;
358 
359  // SpinImages Options:
365 
366  // TPolarImagesOptions
370 
371  // LogPolarImagesOptions
374  16; // Log-Polar image patch will have dimensions WxH, with:
375  // W=num_angles, H= rho_scale * log(radius)
377 
378  // added by Raghavender Sahdev
379  // AKAZEOptions
380  AKAZEOptions.diffusivity = 1; // KAZE::DIFF_PM_G2 maps to 1;
381  // http://docs.opencv.org/trunk/d3/d61/classcv_1_1KAZE.html
384  AKAZEOptions.threshold = 0.001f;
388  5; // AKAZE::DESCRIPTOR_MLDB maps to 5 in open cv;
389  // http://docs.opencv.org/trunk/d8/d30/classcv_1_1AKAZE.html
390 
391  // LSD Options
392  LSDOptions.scale = 2;
393  LSDOptions.nOctaves = 1;
394 
395  // BLD Options
396  // BLDOptions.ksize_ = 11;
400 
401  LATCHOptions.bytes = 32;
404 }
405 
406 /*---------------------------------------------------------------
407  dumpToTextStream
408  ---------------------------------------------------------------*/
410  mrpt::utils::CStream& out) const
411 {
412  out.printf(
413  "\n----------- [CFeatureExtraction::TOptions] ------------ \n\n");
414 
415  LOADABLEOPTS_DUMP_VAR(featsType, int)
416  LOADABLEOPTS_DUMP_VAR(patchSize, int)
417  LOADABLEOPTS_DUMP_VAR(FIND_SUBPIXEL, bool)
418  LOADABLEOPTS_DUMP_VAR(useMask, bool)
419  LOADABLEOPTS_DUMP_VAR(addNewFeatures, bool)
420 
421  LOADABLEOPTS_DUMP_VAR(harrisOptions.k, double)
422  LOADABLEOPTS_DUMP_VAR(harrisOptions.radius, int)
423  LOADABLEOPTS_DUMP_VAR(harrisOptions.threshold, float)
424  LOADABLEOPTS_DUMP_VAR(harrisOptions.sigma, float)
425  LOADABLEOPTS_DUMP_VAR(harrisOptions.min_distance, float)
426 
427  LOADABLEOPTS_DUMP_VAR(KLTOptions.min_distance, float)
428  LOADABLEOPTS_DUMP_VAR(KLTOptions.threshold, float)
429  LOADABLEOPTS_DUMP_VAR(KLTOptions.radius, int)
430 
431  LOADABLEOPTS_DUMP_VAR(SIFTOptions.implementation, int)
432 
433  LOADABLEOPTS_DUMP_VAR(SURFOptions.rotation_invariant, bool)
434  LOADABLEOPTS_DUMP_VAR(SURFOptions.hessianThreshold, int)
435  LOADABLEOPTS_DUMP_VAR(SURFOptions.nOctaves, int)
436  LOADABLEOPTS_DUMP_VAR(SURFOptions.nLayersPerOctave, int)
437 
438  LOADABLEOPTS_DUMP_VAR(FASTOptions.threshold, int)
439  LOADABLEOPTS_DUMP_VAR(FASTOptions.nonmax_suppression, bool)
440  LOADABLEOPTS_DUMP_VAR(FASTOptions.min_distance, float)
441  LOADABLEOPTS_DUMP_VAR(FASTOptions.use_KLT_response, bool)
442 
443  LOADABLEOPTS_DUMP_VAR(ORBOptions.scale_factor, float)
444  LOADABLEOPTS_DUMP_VAR(ORBOptions.min_distance, int)
445  LOADABLEOPTS_DUMP_VAR(ORBOptions.n_levels, int)
446  LOADABLEOPTS_DUMP_VAR(ORBOptions.extract_patch, bool)
447 
448  LOADABLEOPTS_DUMP_VAR(SpinImagesOptions.hist_size_distance, int)
449  LOADABLEOPTS_DUMP_VAR(SpinImagesOptions.hist_size_intensity, int)
450  LOADABLEOPTS_DUMP_VAR(SpinImagesOptions.radius, int)
451  LOADABLEOPTS_DUMP_VAR(SpinImagesOptions.std_dist, float)
452  LOADABLEOPTS_DUMP_VAR(SpinImagesOptions.std_intensity, float)
453 
454  LOADABLEOPTS_DUMP_VAR(PolarImagesOptions.bins_angle, int)
455  LOADABLEOPTS_DUMP_VAR(PolarImagesOptions.bins_distance, int)
456  LOADABLEOPTS_DUMP_VAR(PolarImagesOptions.radius, int)
457 
458  LOADABLEOPTS_DUMP_VAR(LogPolarImagesOptions.radius, int)
459  LOADABLEOPTS_DUMP_VAR(LogPolarImagesOptions.num_angles, int)
460  LOADABLEOPTS_DUMP_VAR(LogPolarImagesOptions.rho_scale, double)
461 
462  // # added by Raghavender Sahdev
463  LOADABLEOPTS_DUMP_VAR(AKAZEOptions.descriptor_type, int)
464  LOADABLEOPTS_DUMP_VAR(AKAZEOptions.descriptor_size, int)
465  LOADABLEOPTS_DUMP_VAR(AKAZEOptions.descriptor_channels, int)
466  LOADABLEOPTS_DUMP_VAR(AKAZEOptions.threshold, float)
467  LOADABLEOPTS_DUMP_VAR(AKAZEOptions.nOctaves, int)
468  LOADABLEOPTS_DUMP_VAR(AKAZEOptions.nOctaveLayers, int)
469  LOADABLEOPTS_DUMP_VAR(AKAZEOptions.diffusivity, int)
470 
471  LOADABLEOPTS_DUMP_VAR(LSDOptions.nOctaves, int)
472  LOADABLEOPTS_DUMP_VAR(LSDOptions.scale, int)
473 
474  LOADABLEOPTS_DUMP_VAR(BLDOptions.numOfOctave, int)
475  LOADABLEOPTS_DUMP_VAR(BLDOptions.reductionRatio, int)
476  LOADABLEOPTS_DUMP_VAR(BLDOptions.widthOfBand, int)
477 
478  LOADABLEOPTS_DUMP_VAR(LATCHOptions.bytes, int)
479  LOADABLEOPTS_DUMP_VAR(LATCHOptions.half_ssd_size, int)
480  LOADABLEOPTS_DUMP_VAR(LATCHOptions.rotationInvariance, bool)
481 
482  out.printf("\n");
483 }
484 
485 /*---------------------------------------------------------------
486  loadFromConfigFile
487  ---------------------------------------------------------------*/
489  const mrpt::utils::CConfigFileBase& iniFile, const std::string& section)
490 {
491  featsType = iniFile.read_enum(section, "featsType", featsType);
492 
493  MRPT_LOAD_CONFIG_VAR(patchSize, int, iniFile, section)
494  MRPT_LOAD_CONFIG_VAR(FIND_SUBPIXEL, bool, iniFile, section)
495  MRPT_LOAD_CONFIG_VAR(useMask, bool, iniFile, section)
496  MRPT_LOAD_CONFIG_VAR(addNewFeatures, bool, iniFile, section)
497 
498  // string sect = section;
499  MRPT_LOAD_CONFIG_VAR(harrisOptions.k, double, iniFile, section)
500  MRPT_LOAD_CONFIG_VAR(harrisOptions.radius, int, iniFile, section)
501  MRPT_LOAD_CONFIG_VAR(harrisOptions.threshold, float, iniFile, section)
502  MRPT_LOAD_CONFIG_VAR(harrisOptions.sigma, float, iniFile, section)
503  MRPT_LOAD_CONFIG_VAR(harrisOptions.min_distance, float, iniFile, section)
504 
505  MRPT_LOAD_CONFIG_VAR(KLTOptions.min_distance, float, iniFile, section)
506  MRPT_LOAD_CONFIG_VAR(KLTOptions.threshold, float, iniFile, section)
507  MRPT_LOAD_CONFIG_VAR(KLTOptions.radius, int, iniFile, section)
508 
510  SIFTOptions.implementation, int, TSIFTImplementation, iniFile, section)
511  MRPT_LOAD_CONFIG_VAR(SIFTOptions.threshold, double, iniFile, section)
512  MRPT_LOAD_CONFIG_VAR(SIFTOptions.edgeThreshold, double, iniFile, section)
513 
514  MRPT_LOAD_CONFIG_VAR(SURFOptions.rotation_invariant, bool, iniFile, section)
515  MRPT_LOAD_CONFIG_VAR(SURFOptions.hessianThreshold, int, iniFile, section)
516  MRPT_LOAD_CONFIG_VAR(SURFOptions.nOctaves, int, iniFile, section)
517  MRPT_LOAD_CONFIG_VAR(SURFOptions.nLayersPerOctave, int, iniFile, section)
518 
519  MRPT_LOAD_CONFIG_VAR(FASTOptions.threshold, int, iniFile, section)
520  MRPT_LOAD_CONFIG_VAR(FASTOptions.nonmax_suppression, bool, iniFile, section)
521  MRPT_LOAD_CONFIG_VAR(FASTOptions.min_distance, float, iniFile, section)
522  MRPT_LOAD_CONFIG_VAR(FASTOptions.use_KLT_response, bool, iniFile, section)
523 
524  MRPT_LOAD_CONFIG_VAR(ORBOptions.extract_patch, bool, iniFile, section)
525  MRPT_LOAD_CONFIG_VAR(ORBOptions.min_distance, int, iniFile, section)
526  MRPT_LOAD_CONFIG_VAR(ORBOptions.n_levels, int, iniFile, section)
527  MRPT_LOAD_CONFIG_VAR(ORBOptions.scale_factor, float, iniFile, section)
528 
530  SpinImagesOptions.hist_size_distance, int, iniFile, section)
532  SpinImagesOptions.hist_size_intensity, int, iniFile, section)
533  MRPT_LOAD_CONFIG_VAR(SpinImagesOptions.radius, int, iniFile, section)
534  MRPT_LOAD_CONFIG_VAR(SpinImagesOptions.std_dist, float, iniFile, section)
536  SpinImagesOptions.std_intensity, float, iniFile, section)
537 
538  MRPT_LOAD_CONFIG_VAR(PolarImagesOptions.bins_angle, int, iniFile, section)
540  PolarImagesOptions.bins_distance, int, iniFile, section)
541  MRPT_LOAD_CONFIG_VAR(PolarImagesOptions.radius, int, iniFile, section)
542 
543  MRPT_LOAD_CONFIG_VAR(LogPolarImagesOptions.radius, int, iniFile, section)
545  LogPolarImagesOptions.num_angles, int, iniFile, section)
547  LogPolarImagesOptions.rho_scale, double, iniFile, section)
548 
549  // #added by Raghavender Sahdev
550  MRPT_LOAD_CONFIG_VAR(AKAZEOptions.descriptor_type, int, iniFile, section)
551  MRPT_LOAD_CONFIG_VAR(AKAZEOptions.descriptor_size, int, iniFile, section)
553  AKAZEOptions.descriptor_channels, int, iniFile, section)
554  MRPT_LOAD_CONFIG_VAR(AKAZEOptions.threshold, float, iniFile, section)
555  MRPT_LOAD_CONFIG_VAR(AKAZEOptions.nOctaves, int, iniFile, section)
556  MRPT_LOAD_CONFIG_VAR(AKAZEOptions.nOctaveLayers, int, iniFile, section)
557  MRPT_LOAD_CONFIG_VAR(AKAZEOptions.diffusivity, int, iniFile, section)
558 
559  MRPT_LOAD_CONFIG_VAR(LSDOptions.nOctaves, int, iniFile, section)
560  MRPT_LOAD_CONFIG_VAR(LSDOptions.scale, int, iniFile, section)
561 
562  MRPT_LOAD_CONFIG_VAR(BLDOptions.numOfOctave, int, iniFile, section)
563  MRPT_LOAD_CONFIG_VAR(BLDOptions.widthOfBand, int, iniFile, section)
564  MRPT_LOAD_CONFIG_VAR(BLDOptions.reductionRatio, int, iniFile, section)
565 
566  MRPT_LOAD_CONFIG_VAR(LATCHOptions.bytes, int, iniFile, section)
567  MRPT_LOAD_CONFIG_VAR(LATCHOptions.half_ssd_size, int, iniFile, section)
569  LATCHOptions.rotationInvariance, bool, iniFile, section)
570 }
#define MRPT_LOAD_CONFIG_VAR_CAST( variableName, variableType, variableTypeCast, configFileObject, sectionNameStr)
#define MRPT_LOAD_CONFIG_VAR( variableName, variableType, configFileObject, sectionNameStr)
An useful macro for loading variables stored in a INI-like file under a key with the same name that t...
#define LOADABLEOPTS_DUMP_VAR(variableName, variableType)
Macro for dumping a variable to a stream, within the method "dumpToTextStream(out)" (Variable types a...
This class allows loading and storing values and vectors of different types from a configuration text...
ENUMTYPE read_enum(const std::string &section, const std::string &name, const ENUMTYPE &defaultValue, bool failIfNotFound=false) const
Reads an "enum" value, where the value in the config file can be either a numerical value or the symb...
A class for storing images as grayscale or RGB bitmaps.
Definition: CImage.h:119
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
Definition: CStream.h:42
virtual int printf(const char *fmt,...) MRPT_printf_format_check(2
Writes a string to the stream in a textual form.
Definition: CStream.cpp:597
This class implements a high-performance stopwatch.
Definition: CTicTac.h:24
double Tac()
Stops the stopwatch.
Definition: CTicTac.cpp:97
void Tic()
Starts the stopwatch.
Definition: CTicTac.cpp:82
CFeatureExtraction()
before calling "detectFeatures"
void computeDescriptors(const mrpt::utils::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,...
void detectFeatures(const mrpt::utils::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.
virtual ~CFeatureExtraction()
Virtual destructor.
void extractFeaturesBCD(const mrpt::utils::CImage &img, CFeatureList &feats, unsigned int init_ID=0, unsigned int nDesiredFeatures=0, const TImageROI &ROI=TImageROI()) const
Extract features from the image based on the BCD method.
A list of visual features, to be used as output by detectors, as input/output by trackers,...
Definition: CFeature.h:306
void push_back(const CFeature::Ptr &f)
Definition: CFeature.h:399
TInternalFeatList::iterator iterator
Definition: CFeature.h:366
Scalar * iterator
Definition: eigen_plugins.h:26
EIGEN_STRONG_INLINE iterator begin()
Definition: eigen_plugins.h:29
GLint GLvoid * img
Definition: glext.h:3763
GLsizei const GLchar ** string
Definition: glext.h:4101
TDescriptorType
The bitwise OR combination of values of TDescriptorType are used in CFeatureExtraction::computeDescri...
TFeatureType
Types of features - This means that the point has been detected with this algorithm,...
@ descLATCH
LATCH Line descriptor.
@ descBLD
BLD Line descriptor.
@ descLogPolarImages
Log-Polar image descriptor.
@ descSpinImages
Intensity-domain spin image descriptors.
@ descPolarImages
Polar image descriptor.
@ descORB
Bit-based feature descriptor.
@ featSURF
Speeded Up Robust Feature [BAY'06].
@ featLSD
LSD detector, OpenCV's implementation.
@ featAKAZE
AKAZE detector, OpenCV's implementation.
@ featHarris
Harris border and corner detector [HARRIS].
@ featFAST
FAST feature detector, OpenCV's implementation ("Faster and better: A machine learning approac...
@ featSIFT
Scale Invariant Feature Transform [LOWE'04].
@ featFASTER10
FASTER-9 detector, Edward Rosten's libcvd implementation optimized for SSE2.
@ featFASTER12
FASTER-9 detector, Edward Rosten's libcvd implementation optimized for SSE2.
@ featFASTER9
FASTER-9 detector, Edward Rosten's libcvd implementation optimized for SSE2.
@ featORB
ORB detector and descriptor, OpenCV's implementation ("ORB: an efficient alternative to SIFT o...
@ featBCD
Binary corder detector.
@ featKLT
Kanade-Lucas-Tomasi feature [SHI'94].
#define MRPT_TODO(x)
Definition: mrpt_macros.h:82
#define MRPT_START
Definition: mrpt_macros.h:425
#define MRPT_END
Definition: mrpt_macros.h:429
#define THROW_EXCEPTION(msg)
Definition: mrpt_macros.h:111
#define MRPT_UNUSED_PARAM(a)
Can be used to avoid "not used parameters" warnings from the compiler.
Definition: mrpt_macros.h:365
#define THROW_EXCEPTION_FMT(_FORMAT_STRING,...)
Definition: mrpt_macros.h:121
This namespace provides a OS-independent interface to many useful functions: filenames manipulation,...
Definition: math_frwds.h:31
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values,...
Classes for computer vision, detectors, features, etc.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
float min_distance
(default=5) minimum distance between
unsigned int num_angles
log polar image is built, in pixel units (default=30 pixels)
double rho_scale
will have dimensions WxH, with: W=num_angles, H= rho_scale * log(radius)
unsigned int radius
Maximum radius of the area of which the.
unsigned int bins_distance
of the polar image (default=8).
unsigned int radius
axis of the polar image (default=6).
unsigned int bins_angle
Number of bins in the "angular" axis.
TSIFTImplementation implementation
Default: Hess (OpenCV.
float std_intensity
"soft histogram" (default=0.4 pixels)
unsigned int radius
for the "soft histogram" (default=20 units [0,255])
unsigned int hist_size_distance
"intensity" axis of the 2D histogram (default=10).
float std_dist
"distance" axis of the 2D histogram (default=10).
struct mrpt::vision::CFeatureExtraction::TOptions::TPolarImagesOptions PolarImagesOptions
struct mrpt::vision::CFeatureExtraction::TOptions::TKLTOptions KLTOptions
struct mrpt::vision::CFeatureExtraction::TOptions::TFASTOptions FASTOptions
unsigned int patchSize
Size of the patch to extract, or 0 if no patch is desired (default=21).
struct mrpt::vision::CFeatureExtraction::TOptions::TORBOptions ORBOptions
struct mrpt::vision::CFeatureExtraction::TOptions::TSpinImagesOptions SpinImagesOptions
struct mrpt::vision::CFeatureExtraction::TOptions::TLATCHOptions LATCHOptions
bool addNewFeatures
Whether to add the found features to the input feature list or clear it before adding them (default=f...
struct mrpt::vision::CFeatureExtraction::TOptions::THarrisOptions harrisOptions
struct mrpt::vision::CFeatureExtraction::TOptions::TLogPolarImagesOptions LogPolarImagesOptions
bool useMask
Whether to use a mask for determining the regions where not to look for keypoints (default=false).
struct mrpt::vision::CFeatureExtraction::TOptions::TAKAZEOptions AKAZEOptions
struct mrpt::vision::CFeatureExtraction::TOptions::TLSDOptions LSDOptions
TOptions(const TFeatureType featsType=featKLT)
Initalizer.
struct mrpt::vision::CFeatureExtraction::TOptions::TBLDOptions BLDOptions
void dumpToTextStream(mrpt::utils::CStream &out) const override
This method should clearly display all the contents of the structure in textual form,...
bool FIND_SUBPIXEL
Indicates if subpixel accuracy is desired for the extracted points (only applicable to KLT and Harris...
void loadFromConfigFile(const mrpt::utils::CConfigFileBase &source, const std::string &section) override
This method load the options from a ".ini"-like file or memory-stored string list.
struct mrpt::vision::CFeatureExtraction::TOptions::TSIFTOptions SIFTOptions
A structure for defining a ROI within an image.
float yMin
Y coordinate limits [0,imageHeight)
float xMin
X coordinate limits [0,imageWidth)
bool operator()(const std::vector< unsigned int > &left, const std::vector< unsigned int > &right)



Page generated by Doxygen 1.9.1 for MRPT 1.9.9 Git: 63ea9d1f1 Thu Nov 23 00:06:53 2017 +0100 at mar 26 may 2026 12:19:29 CEST