Main MRPT website > C++ reference for MRPT 1.9.9
CFeatureExtraction.h
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  */
10 #ifndef CFeatureExtraction_H
11 #define CFeatureExtraction_H
12 
13 #include <mrpt/img/CImage.h>
14 #include <mrpt/system/CTicTac.h>
15 #include <mrpt/vision/utils.h>
16 #include <mrpt/vision/CFeature.h>
18 
19 namespace mrpt
20 {
21 namespace vision
22 {
23 /** The central class from which images can be analyzed in search of different
24  *kinds of interest points and descriptors computed for them.
25  * To extract features from an image, create an instance of
26  *CFeatureExtraction,
27  * fill out its CFeatureExtraction::options field, including the algorithm to
28  *use (see
29  * CFeatureExtraction::TOptions::featsType), and call
30  *CFeatureExtraction::detectFeatures.
31  * This will return a set of features of the class mrpt::vision::CFeature,
32  *which include
33  * details for each interest point as well as the desired descriptors and/or
34  *patches.
35  *
36  * By default, a 21x21 patch is extracted for each detected feature. If the
37  *patch is not needed,
38  * set patchSize to 0 in CFeatureExtraction::options
39  *
40  * The implemented <b>detection</b> algorithms are (see
41  *CFeatureExtraction::TOptions::featsType):
42  * - KLT (Kanade-Lucas-Tomasi): A detector (no descriptor vector).
43  * - Harris: A detector (no descriptor vector).
44  * - BCD (Binary Corner Detector): A detector (no descriptor vector) (Not
45  *implemented yet).
46  * - SIFT: An implementation of the SIFT detector and descriptor. The
47  *implemention may be selected with
48  *CFeatureExtraction::TOptions::SIFTOptions::implementation.
49  * - SURF: OpenCV's implementation of SURF detector and descriptor.
50  * - The FAST feature detector (OpenCV's implementation)
51  * - The FASTER (9,10,12) detectors (Edward Rosten's libcvd implementation
52  *optimized for SSE2).
53  *
54  * Additionally, given a list of interest points onto an image, the following
55  * <b>descriptors</b> can be computed for each point by calling
56  *CFeatureExtraction::computeDescriptors :
57  * - SIFT descriptor (Lowe's descriptors).
58  * - SURF descriptor (OpenCV's implementation - Requires OpenCV 1.1.0 from
59  *SVN
60  *or later).
61  * - Intensity-domain spin images (SpinImage): Creates a vector descriptor
62  *with the 2D histogram as a single row.
63  * - A circular patch in polar coordinates (Polar images): The matrix
64  *descriptor is a 2D polar image centered at the interest point.
65  * - A log-polar image patch (Log-polar images): The matrix descriptor is
66  *the
67  *2D log-polar image centered at the interest point.
68  *
69  *
70  * Apart from the normal entry point \a detectFeatures(), these other
71  *low-level static methods are provided for convenience:
72  * - CFeatureExtraction::detectFeatures_SSE2_FASTER9()
73  * - CFeatureExtraction::detectFeatures_SSE2_FASTER10()
74  * - CFeatureExtraction::detectFeatures_SSE2_FASTER12()
75  *
76  * \note The descriptor "Intensity-domain spin images" is described in "A
77  *sparse texture representation using affine-invariant regions", S Lazebnik, C
78  *Schmid, J Ponce, 2003 IEEE Computer Society Conference on Computer Vision.
79  * \sa mrpt::vision::CFeature
80  * \ingroup mrptvision_features
81  */
83 {
84  public:
86  {
92  };
93 
94  /** The set of parameters for all the detectors & descriptor algorithms */
96  {
97  /** Initalizer */
99 
100  void loadFromConfigFile(
102  const std::string& section) override; // See base docs
103  void dumpToTextStream(
104  std::ostream& out) const override; // See base docs
105 
106  /** Type of the extracted features
107  */
109 
110  /** Size of the patch to extract, or 0 if no patch is desired
111  * (default=21).
112  */
113  unsigned int patchSize;
114 
115  /** Whether to use a mask for determining the regions where not to look
116  * for keypoints (default=false).
117  */
118  bool useMask;
119 
120  /** Whether to add the found features to the input feature list or clear
121  * it before adding them (default=false).
122  */
124 
125  /** Indicates if subpixel accuracy is desired for the extracted points
126  * (only applicable to KLT and Harris features)
127  */
129 
130  /** KLT Options */
131  struct TKLTOptions
132  {
133  int radius; // size of the block of pixels used
134  float threshold; // (default=0.1) for rejecting weak local maxima
135  // (with min_eig < threshold*max(eig_image))
136  float min_distance; // minimum distance between features
137  bool tile_image; // splits the image into 8 tiles and search for
138  // the best points in all of them (distribute the
139  // features over all the image)
140  } KLTOptions;
141 
142  /** Harris Options */
144  {
145  float threshold; // (default=0.005) for rejecting weak local maxima
146  // (with min_eig < threshold*max(eig_image))
147  float k; // k factor for the Harris algorithm
148  float sigma; // standard deviation for the gaussian smoothing
149  // function
150  int radius; // size of the block of pixels used
151  float min_distance; // minimum distance between features
152  bool tile_image; // splits the image into 8 tiles and search for
153  // the best points in all of them (distribute the
154  // features over all the image)
155  } harrisOptions;
156 
157  /** BCD Options */
158  struct TBCDOptions
159  {
160  } BCDOptions;
161 
162  /** FAST and FASTER Options */
164  {
165  int threshold; //!< default= 20
166  float min_distance; //!< (default=5) minimum distance between
167  //! features (in pixels)
168  bool nonmax_suppression; //!< Default = true
169  bool use_KLT_response; //!< (default=false) If true, use
170  //! CImage::KLT_response to compute the
171  //! response at each point instead of the
172  //! FAST "standard response".
173  } FASTOptions;
174 
175  /** ORB Options */
176  struct TORBOptions
177  {
179  : n_levels(8),
180  min_distance(0),
181  scale_factor(1.2f),
182  extract_patch(false)
183  {
184  }
185 
186  size_t n_levels;
187  size_t min_distance;
190  } ORBOptions;
191 
192  /** SIFT Options */
194  {
196  TSIFTImplementation implementation; //!< Default: Hess (OpenCV
197  //! should be preferred, but its
198  //! nonfree module is not always
199  //! available by default in all
200  //! systems)
201  double threshold; //!< default= 0.04
202  double edgeThreshold; //!< default= 10
203  } SIFTOptions;
204 
206  {
208  : rotation_invariant(true),
209  hessianThreshold(600),
210  nOctaves(2),
212  {
213  }
214 
215  /** SURF Options
216  */
217  bool rotation_invariant; //!< Compute the rotation invariant SURF
218  //!(dim=128) if set to true (default), or
219  //! the smaller uSURF otherwise (dim=64)
220  int hessianThreshold; //!< Default: 600
221  int nOctaves; //!< Default: 2
222  int nLayersPerOctave; //!< Default: 4
223  } SURFOptions;
224 
226  {
227  /** SpinImages Options
228  */
229  unsigned int hist_size_intensity; //!< Number of bins in the
230  //!"intensity" axis of the 2D
231  //! histogram (default=10).
232  unsigned int hist_size_distance; //!< Number of bins in the
233  //!"distance" axis of the 2D
234  //! histogram (default=10).
235  float std_dist; //!< Standard deviation in "distance", used for the
236  //!"soft histogram" (default=0.4 pixels)
237  float std_intensity; //!< Standard deviation in "intensity", used
238  //! for the "soft histogram" (default=20 units
239  //![0,255])
240  unsigned int radius; //!< Maximum radius of the area of which the
241  //! histogram is built, in pixel units
242  //!(default=20 pixels)
244 
245  /** PolarImagesOptions Options
246  */
248  {
249  unsigned int bins_angle; //!< Number of bins in the "angular" axis
250  //! of the polar image (default=8).
251  unsigned int bins_distance; //!< Number of bins in the "distance"
252  //! axis of the polar image (default=6).
253  unsigned int radius; //!< Maximum radius of the area of which the
254  //! polar image is built, in pixel units
255  //!(default=20 pixels)
257 
258  /** LogPolarImagesOptions Options
259  */
261  {
262  unsigned int radius; //!< Maximum radius of the area of which the
263  //! log polar image is built, in pixel units
264  //!(default=30 pixels)
265  unsigned int num_angles; //!< (default=16) Log-Polar image patch
266  //! will have dimensions WxH, with:
267  //! W=num_angles, H= rho_scale *
268  //! log(radius)
269  double rho_scale; //!< (default=5) Log-Polar image patch will have
270  //! dimensions WxH, with: W=num_angles, H=
271  //! rho_scale * log(radius)
273 
274  // # added by Raghavender Sahdev
275  /** AKAZEOptions Options
276  */
278  {
282  float threshold;
283  int nOctaves;
286  } AKAZEOptions;
287 
288  /** LSDOptions Options
289  */
290  struct TLSDOptions
291  {
292  int scale;
293  int nOctaves;
294  } LSDOptions;
295 
296  /** BLDOptions Descriptor Options
297  */
298  struct TBLDOptions
299  {
300  int ksize_;
304 
305  } BLDOptions;
306 
307  /** LATCHOptions Descriptor
308  */
310  {
311  int bytes; // = 32,
312  bool rotationInvariance; // = true,
313  int half_ssd_size; // = 3
314  } LATCHOptions;
315  };
316 
317  TOptions options; //!< Set all the parameters of the desired method here
318  //! before calling "detectFeatures"
319 
320  /** Virtual destructor.
321  */
322  virtual ~CFeatureExtraction();
323 
324  /** Extract features from the image based on the method defined in TOptions.
325  * \param img (input) The image from where to extract the images.
326  * \param feats (output) A complete list of features (containing a patch for
327  * each one of them if options.patchsize > 0).
328  * \param nDesiredFeatures (op. input) Number of features to be extracted.
329  * Default: all possible.
330  *
331  * \sa computeDescriptors
332  */
333  void detectFeatures(
334  const mrpt::img::CImage& img, CFeatureList& feats,
335  const unsigned int init_ID = 0, const unsigned int nDesiredFeatures = 0,
336  const TImageROI& ROI = TImageROI()) const;
337 
338  /** Compute one (or more) descriptors for the given set of interest points
339  * onto the image, which may have been filled out manually or from \a
340  * detectFeatures
341  * \param in_img (input) The image from where to compute the descriptors.
342  * \param inout_features (input/output) The list of features whose
343  * descriptors are going to be computed.
344  * \param in_descriptor_list (input) The bitwise OR of one or several
345  * descriptors defined in TDescriptorType.
346  *
347  * Each value in "in_descriptor_list" represents one descriptor to be
348  * computed, for example:
349  * \code
350  * // This call will compute both, SIFT and Spin-Image descriptors for a
351  * list of feature points lstFeats.
352  * fext.computeDescriptors(img, lstFeats, descSIFT | descSpinImages );
353  * \endcode
354  *
355  * \note The SIFT descriptors for already located features can only be
356  * computed through the Hess and
357  * CSBinary implementations which may be specified in
358  * CFeatureExtraction::TOptions::SIFTOptions.
359  *
360  * \note This call will also use additional parameters from \a options
361  */
362  void computeDescriptors(
363  const mrpt::img::CImage& in_img, CFeatureList& inout_features,
364  TDescriptorType in_descriptor_list) const;
365 
366 #if 0 // Delete? see comments in .cpp
367  /** Extract more features from the image (apart from the provided ones) based on the method defined in TOptions.
368  * \param img (input) The image from where to extract the images.
369  * \param inList (input) The actual features in the image.
370  * \param outList (output) The list of new features (containing a patch for each one of them if options.patchsize > 0).
371  * \param nDesiredFeatures (op. input) Number of features to be extracted. Default: all possible.
372  *
373  * \sa The more powerful class: mrpt::vision::CGenericFeatureTracker
374  */
375  void findMoreFeatures( const mrpt::img::CImage &img,
376  const CFeatureList &inList,
377  CFeatureList &outList,
378  unsigned int nDesiredFeats = 0) const;
379 #endif
380 
381  /** @name Static methods with low-level detector functionality
382  @{ */
383 
384  /** A SSE2-optimized implementation of FASTER-9 (requires img to be
385  * grayscale). If SSE2 is not available, it gratefully falls back to a
386  * non-optimized version.
387  *
388  * Only the pt.{x,y} fields are filled out for each feature: the rest of
389  * fields are left <b>uninitialized</b> and their content is
390  * <b>undefined</b>.
391  * Note that (x,y) are already scaled to the 0-level image coordinates if
392  * octave>0, by means of:
393  *
394  * \code
395  * pt.x = detected.x << octave;
396  * pt.y = detected.y << octave;
397  * \endcode
398  *
399  * If \a append_to_list is true, the \a corners list is not cleared before
400  * adding the newly detected feats.
401  *
402  * If a valid pointer is provided for \a out_feats_index_by_row, upon
403  * return you will find a vector with
404  * as many entries as rows in the image (the real number of rows,
405  * disregarding the value of \a octave).
406  * The number in each entry is the 0-based index (in \a corners) of
407  * the first feature that falls in that line of the image. This index can
408  * be used to fasten looking for correspondences.
409  *
410  * \ingroup mrptvision_features
411  */
412  static void detectFeatures_SSE2_FASTER9(
413  const mrpt::img::CImage& img, TSimpleFeatureList& corners,
414  const int threshold = 20, bool append_to_list = false,
415  uint8_t octave = 0,
416  std::vector<size_t>* out_feats_index_by_row = nullptr);
417 
418  /** Just like \a detectFeatures_SSE2_FASTER9() for another version of the
419  * detector.
420  * \ingroup mrptvision_features */
421  static void detectFeatures_SSE2_FASTER10(
422  const mrpt::img::CImage& img, TSimpleFeatureList& corners,
423  const int threshold = 20, bool append_to_list = false,
424  uint8_t octave = 0,
425  std::vector<size_t>* out_feats_index_by_row = nullptr);
426 
427  /** Just like \a detectFeatures_SSE2_FASTER9() for another version of the
428  * detector.
429  * \ingroup mrptvision_features */
430  static void detectFeatures_SSE2_FASTER12(
431  const mrpt::img::CImage& img, TSimpleFeatureList& corners,
432  const int threshold = 20, bool append_to_list = false,
433  uint8_t octave = 0,
434  std::vector<size_t>* out_feats_index_by_row = nullptr);
435 
436  /** @} */
437 
438  private:
439  /** Compute the SIFT descriptor of the provided features into the input
440  image
441  * \param in_img (input) The image from where to compute the descriptors.
442  * \param in_features (input/output) The list of features whose descriptors
443  are going to be computed.
444  *
445  * \note The SIFT descriptors for already located features can only be
446  computed through the Hess and
447  CSBinary implementations which may be specified in
448  CFeatureExtraction::TOptions::SIFTOptions.
449  */
451  const mrpt::img::CImage& in_img, CFeatureList& in_features) const;
452 
453  /** Compute the SURF descriptor of the provided features into the input
454  * image
455  * \param in_img (input) The image from where to compute the descriptors.
456  * \param in_features (input/output) The list of features whose descriptors
457  * are going to be computed.
458  */
460  const mrpt::img::CImage& in_img, CFeatureList& in_features) const;
461 
462  /** Compute the ORB descriptor of the provided features into the input image
463  * \param in_img (input) The image from where to compute the descriptors.
464  * \param in_features (input/output) The list of features whose descriptors
465  * are going to be computed.
466  */
468  const mrpt::img::CImage& in_img, CFeatureList& in_features) const;
469 
470  /** Compute the intensity-domain spin images descriptor of the provided
471  * features into the input image
472  * \param in_img (input) The image from where to compute the descriptors.
473  * \param in_features (input/output) The list of features whose descriptors
474  * are going to be computed.
475  *
476  * \note Additional parameters from
477  * CFeatureExtraction::TOptions::SpinImagesOptions are used in this method.
478  */
480  const mrpt::img::CImage& in_img, CFeatureList& in_features) const;
481 
482  /** Compute a polar-image descriptor of the provided features into the input
483  * image
484  * \param in_img (input) The image from where to compute the descriptors.
485  * \param in_features (input/output) The list of features whose descriptors
486  * are going to be computed.
487  *
488  * \note Additional parameters from
489  * CFeatureExtraction::TOptions::PolarImagesOptions are used in this method.
490  */
492  const mrpt::img::CImage& in_img, CFeatureList& in_features) const;
493 
494  /** Compute a log-polar image descriptor of the provided features into the
495  * input image
496  * \param in_img (input) The image from where to compute the descriptors.
497  * \param in_features (input/output) The list of features whose descriptors
498  * are going to be computed.
499  *
500  * \note Additional parameters from
501  * CFeatureExtraction::TOptions::LogPolarImagesOptions are used in this
502  * method.
503  */
505  const mrpt::img::CImage& in_img, CFeatureList& in_features) const;
506  /** Compute a BLD descriptor of the provided features into the input image
507  * \param in_img (input) The image from where to compute the descriptors.
508  * \param in_features (input/output) The list of features whose descriptors
509  * are going to be computed.
510  *
511  * \note Additional parameters from
512  * CFeatureExtraction::TOptions::LogPolarImagesOptions are used in this
513  * method.
514  */
516  const mrpt::img::CImage& in_img, CFeatureList& in_features) const;
517  /** Compute a LATCH descriptor of the provided features into the input image
518  * \param in_img (input) The image from where to compute the descriptors.
519  * \param in_features (input/output) The list of features whose descriptors
520  * are going to be computed.
521  *
522  * \note Additional parameters from
523  * CFeatureExtraction::TOptions::LogPolarImagesOptions are used in this
524  * method.
525  */
527  const mrpt::img::CImage& in_img, CFeatureList& in_features) const;
528 
529 #if 0 // Delete? see comments in .cpp
530  /** Select good features using the openCV implementation of the KLT method.
531  * \param img (input) The image from where to select extract the images.
532  * \param feats (output) A complete list of features (containing a patch for each one of them if options.patchsize > 0).
533  * \param nDesiredFeatures (op. input) Number of features to be extracted. Default: all possible.
534  */
535  void selectGoodFeaturesKLT(
536  const mrpt::img::CImage &inImg,
537  CFeatureList &feats,
538  unsigned int init_ID = 0,
539  unsigned int nDesiredFeatures = 0) const;
540 #endif
541 
542  /** Extract features from the image based on the KLT method.
543  * \param img The image from where to extract the images.
544  * \param feats The list of extracted features.
545  * \param nDesiredFeatures Number of features to be extracted. Default:
546  * authomatic.
547  */
548  void extractFeaturesKLT(
549  const mrpt::img::CImage& img, CFeatureList& feats,
550  unsigned int init_ID = 0, unsigned int nDesiredFeatures = 0,
551  const TImageROI& ROI = TImageROI()) const;
552 
553  // ------------------------------------------------------------------------------------
554  // BCD
555  // ------------------------------------------------------------------------------------
556  /** Extract features from the image based on the BCD method.
557  * \param img The image from where to extract the images.
558  * \param feats The list of extracted features.
559  * \param nDesiredFeatures Number of features to be extracted. Default:
560  * authomatic.
561  * \param ROI (op. input) Region of Interest. Default: All the image.
562  */
563  void extractFeaturesBCD(
564  const mrpt::img::CImage& img, CFeatureList& feats,
565  unsigned int init_ID = 0, unsigned int nDesiredFeatures = 0,
566  const TImageROI& ROI = TImageROI()) const;
567 
568  // ------------------------------------------------------------------------------------
569  // SIFT
570  // ------------------------------------------------------------------------------------
571  /** Extract features from the image based on the SIFT method.
572  * \param img The image from where to extract the images.
573  * \param feats The list of extracted features.
574  * \param nDesiredFeatures Number of features to be extracted. Default:
575  * authomatic.
576  * \param ROI (op. input) Region of Interest. Default: All the image.
577  */
578  void extractFeaturesSIFT(
579  const mrpt::img::CImage& img, CFeatureList& feats,
580  unsigned int init_ID = 0, unsigned int nDesiredFeatures = 0,
581  const TImageROI& ROI = TImageROI()) const;
582 
583  // ------------------------------------------------------------------------------------
584  // ORB
585  // ------------------------------------------------------------------------------------
586  /** Extract features from the image based on the ORB method.
587  * \param img The image from where to extract the images.
588  * \param feats The list of extracted features.
589  * \param nDesiredFeatures Number of features to be extracted. Default:
590  * authomatic.
591  */
592  void extractFeaturesORB(
593  const mrpt::img::CImage& img, CFeatureList& feats,
594  const unsigned int init_ID = 0, const unsigned int nDesiredFeatures = 0,
595  const TImageROI& ROI = TImageROI()) const;
596 
597  // ------------------------------------------------------------------------------------
598  // SURF
599  // ------------------------------------------------------------------------------------
600  /** Extract features from the image based on the SURF method.
601  * \param img The image from where to extract the images.
602  * \param feats The list of extracted features.
603  * \param nDesiredFeatures Number of features to be extracted. Default:
604  * authomatic.
605  */
606  void extractFeaturesSURF(
607  const mrpt::img::CImage& img, CFeatureList& feats,
608  unsigned int init_ID = 0, unsigned int nDesiredFeatures = 0,
609  const TImageROI& ROI = TImageROI()) const;
610 
611  // ------------------------------------------------------------------------------------
612  // FAST
613  // ------------------------------------------------------------------------------------
614  /** Extract features from the image based on the FAST method.
615  * \param img The image from where to extract the images.
616  * \param feats The list of extracted features.
617  * \param nDesiredFeatures Number of features to be extracted. Default:
618  * authomatic.
619  */
620  void extractFeaturesFAST(
621  const mrpt::img::CImage& img, CFeatureList& feats,
622  unsigned int init_ID = 0, unsigned int nDesiredFeatures = 0,
623  const TImageROI& ROI = TImageROI(),
624  const mrpt::math::CMatrixBool* mask = nullptr) const;
625 
626  /** Edward's "FASTER & Better" detector, N=9,10,12 */
628  const int N, const mrpt::img::CImage& img, CFeatureList& feats,
629  unsigned int init_ID = 0, unsigned int nDesiredFeatures = 0,
630  const TImageROI& ROI = TImageROI()) const;
631 
632  // # added by Raghavender Sahdev
633  //-------------------------------------------------------------------------------------
634  // AKAZE
635  //-------------------------------------------------------------------------------------
636  /** Extract features from the image based on the AKAZE method.
637  * \param img The image from where to extract the images.
638  * \param feats The list of extracted features.
639  * \param nDesiredFeatures Number of features to be extracted. Default:
640  * authomatic.
641  */
643  const mrpt::img::CImage& inImg, CFeatureList& feats,
644  unsigned int init_ID, unsigned int nDesiredFeatures,
645  const TImageROI& ROI = TImageROI()) const;
646 
647  //-------------------------------------------------------------------------------------
648  // LSD
649  //-------------------------------------------------------------------------------------
650  /** Extract features from the image based on the LSD method.
651  * \param img The image from where to extract the images.
652  * \param feats The list of extracted features.
653  * \param nDesiredFeatures Number of features to be extracted. Default:
654  * authomatic.
655  */
656  void extractFeaturesLSD(
657  const mrpt::img::CImage& inImg, CFeatureList& feats,
658  unsigned int init_ID, unsigned int nDesiredFeatures,
659  const TImageROI& ROI = TImageROI()) const;
660 
661  // ------------------------------------------------------------------------------------
662  // my_scale_space_extrema
663  // ------------------------------------------------------------------------------------
664  /** Computes extrema in the scale space.
665  * \param dog_pyr Pyramid of images.
666  * \param octvs Number of considered octaves.
667  * \param intvls Number of intervales in octaves.
668  */
670  CFeatureList& featList, void* dog_pyr, int octvs, int intvls,
671  double contr_thr, int curv_thr, void* storage) const;
672 
673  /** Adjust scale if the image was initially doubled.
674  * \param features The sequence of features.
675  */
676  void my_adjust_for_img_dbl(void* features) const;
677 
678  /** Gets the number of times that a point in the image is higher or lower
679  * than the surroundings in the image-scale space
680  * \param dog_pyr Pyramid of images.
681  * \param octvs Number of considered octaves.
682  * \param intvls Number of intervales in octaves.
683  * \param row The row of the feature in the original image.
684  * \param col The column of the feature in the original image.
685  * \param nMin [out]: Times that the feature is lower than the surroundings.
686  * \param nMax [out]: Times that the feature is higher than the surroundings.
687  */
688  void getTimesExtrema(
689  void* dog_pyr, int octvs, int intvls, float row, float col,
690  unsigned int& nMin, unsigned int& nMax) const;
691 
692  /** Computes the Laplacian value of the feature in the corresponing image in
693  * the pyramid.
694  * \param dog_pyr Pyramid of images.
695  * \param octvs Number of considered octaves.
696  * \param intvls Number of intervales in octaves.
697  * \param row The row of the feature in the original image.
698  * \param col The column of the feature in the original image.
699  */
700  double getLaplacianValue(
701  void* dog_pyr, int octvs, int intvls, float row, float col) const;
702 
703  /** Append a sequence of openCV features into an MRPT feature list.
704  * \param features The sequence of features.
705  * \param list [in-out] The list of MRPT features.
706  * \param init_ID [in] The initial ID for the new features.
707  */
709  void* features, CFeatureList& list, unsigned int init_ID = 0) const;
710 
711  /** Converts a sequence of openCV features into an MRPT feature list.
712  * \param features The sequence of features.
713  * \param list [in-out] The list of MRPT features.
714  * \param init_ID [in][optional] The initial ID for the features (default =
715  * 0).
716  * \param ROI [in][optional] The initial ID for the features (default = empty
717  * ROI -> not used).
718  */
720  void* features, CFeatureList& list, unsigned int init_ID = 0,
721  const TImageROI& ROI = TImageROI()) const;
722 
723 }; // end of class
724 } // end of namespace
725 } // end of namespace
726 #endif
int hessianThreshold
(dim=128) if set to true (default), or the smaller uSURF otherwise (dim=64)
struct mrpt::vision::CFeatureExtraction::TOptions::TLATCHOptions LATCHOptions
struct mrpt::vision::CFeatureExtraction::TOptions::TFASTOptions FASTOptions
GLenum GLint GLuint mask
Definition: glext.h:4050
struct mrpt::vision::CFeatureExtraction::TOptions::TLogPolarImagesOptions LogPolarImagesOptions
void extractFeaturesAKAZE(const mrpt::img::CImage &inImg, CFeatureList &feats, unsigned int init_ID, unsigned int nDesiredFeatures, const TImageROI &ROI=TImageROI()) const
Extract features from the image based on the AKAZE method.
bool useMask
Whether to use a mask for determining the regions where not to look for keypoints (default=false)...
Declares a matrix of booleans (non serializable).
TSIFTImplementation implementation
Default: Hess (OpenCV.
void internal_computeORBDescriptors(const mrpt::img::CImage &in_img, CFeatureList &in_features) const
Compute the ORB descriptor of the provided features into the input image.
This is a virtual base class for sets of options than can be loaded from and/or saved to configuratio...
double threshold
should be preferred, but its nonfree module is not always available by default in all systems) ...
void getTimesExtrema(void *dog_pyr, int octvs, int intvls, float row, float col, unsigned int &nMin, unsigned int &nMax) const
Gets the number of times that a point in the image is higher or lower than the surroundings in the im...
static void detectFeatures_SSE2_FASTER10(const mrpt::img::CImage &img, TSimpleFeatureList &corners, const int threshold=20, bool append_to_list=false, uint8_t octave=0, std::vector< size_t > *out_feats_index_by_row=nullptr)
Just like detectFeatures_SSE2_FASTER9() for another version of the detector.
unsigned int radius
for the "soft histogram" (default=20 units [0,255])
TFeatureType featsType
Type of the extracted features.
double rho_scale
will have dimensions WxH, with: W=num_angles, H= rho_scale * log(radius)
unsigned int num_angles
log polar image is built, in pixel units (default=30 pixels)
TOptions options
Set all the parameters of the desired method here.
bool FIND_SUBPIXEL
Indicates if subpixel accuracy is desired for the extracted points (only applicable to KLT and Harris...
The set of parameters for all the detectors & descriptor algorithms.
struct mrpt::vision::CFeatureExtraction::TOptions::TBLDOptions BLDOptions
void dumpToTextStream(std::ostream &out) const override
This method should clearly display all the contents of the structure in textual form, sending it to a std::ostream.
void extractFeaturesFASTER_N(const int N, const mrpt::img::CImage &img, CFeatureList &feats, unsigned int init_ID=0, unsigned int nDesiredFeatures=0, const TImageROI &ROI=TImageROI()) const
Edward&#39;s "FASTER & Better" detector, N=9,10,12.
TOptions(const TFeatureType featsType=featKLT)
Initalizer.
struct mrpt::vision::CFeatureExtraction::TOptions::TORBOptions ORBOptions
unsigned char uint8_t
Definition: rptypes.h:41
float std_dist
"distance" axis of the 2D histogram (default=10).
A structure for defining a ROI within an image.
struct mrpt::vision::CFeatureExtraction::TOptions::TLSDOptions LSDOptions
This class allows loading and storing values and vectors of different types from a configuration text...
virtual ~CFeatureExtraction()
before calling "detectFeatures"
float std_intensity
"soft histogram" (default=0.4 pixels)
struct mrpt::vision::CFeatureExtraction::TOptions::TBCDOptions BCDOptions
double getLaplacianValue(void *dog_pyr, int octvs, int intvls, float row, float col) const
Computes the Laplacian value of the feature in the corresponing image in the pyramid.
struct mrpt::vision::CFeatureExtraction::TOptions::TSpinImagesOptions SpinImagesOptions
GLint GLvoid * img
Definition: glext.h:3763
float min_distance
(default=5) minimum distance between
unsigned int bins_distance
of the polar image (default=8).
struct mrpt::vision::CFeatureExtraction::TOptions::TPolarImagesOptions PolarImagesOptions
void extractFeaturesKLT(const mrpt::img::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 KLT method.
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.
static void detectFeatures_SSE2_FASTER9(const mrpt::img::CImage &img, TSimpleFeatureList &corners, const int threshold=20, bool append_to_list=false, uint8_t octave=0, std::vector< size_t > *out_feats_index_by_row=nullptr)
A SSE2-optimized implementation of FASTER-9 (requires img to be grayscale).
void internal_computeLATCHDescriptors(const mrpt::img::CImage &in_img, CFeatureList &in_features) const
Compute a LATCH descriptor of the provided features into the input image.
void insertCvSeqInCFeatureList(void *features, CFeatureList &list, unsigned int init_ID=0) const
Append a sequence of openCV features into an MRPT feature list.
struct mrpt::vision::CFeatureExtraction::TOptions::THarrisOptions harrisOptions
static void detectFeatures_SSE2_FASTER12(const mrpt::img::CImage &img, TSimpleFeatureList &corners, const int threshold=20, bool append_to_list=false, uint8_t octave=0, std::vector< size_t > *out_feats_index_by_row=nullptr)
Just like detectFeatures_SSE2_FASTER9() for another version of the detector.
GLsizei const GLchar ** string
Definition: glext.h:4101
A list of visual features, to be used as output by detectors, as input/output by trackers, etc.
Definition: CFeature.h:304
void extractFeaturesORB(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 ORB method.
TDescriptorType
The bitwise OR combination of values of TDescriptorType are used in CFeatureExtraction::computeDescri...
void loadFromConfigFile(const mrpt::config::CConfigFileBase &source, const std::string &section) override
This method load the options from a ".ini"-like file or memory-stored string list.
TFeatureType
Types of features - This means that the point has been detected with this algorithm, which is independent of additional descriptors a feature may also have.
void my_adjust_for_img_dbl(void *features) const
Adjust scale if the image was initially doubled.
void internal_computeSiftDescriptors(const mrpt::img::CImage &in_img, CFeatureList &in_features) const
Compute the SIFT descriptor of the provided features into the input image.
void * my_scale_space_extrema(CFeatureList &featList, void *dog_pyr, int octvs, int intvls, double contr_thr, int curv_thr, void *storage) const
Computes extrema in the scale space.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
void extractFeaturesFAST(const mrpt::img::CImage &img, CFeatureList &feats, unsigned int init_ID=0, unsigned int nDesiredFeatures=0, const TImageROI &ROI=TImageROI(), const mrpt::math::CMatrixBool *mask=nullptr) const
Extract features from the image based on the FAST method.
struct mrpt::vision::CFeatureExtraction::TOptions::TAKAZEOptions AKAZEOptions
void internal_computePolarImageDescriptors(const mrpt::img::CImage &in_img, CFeatureList &in_features) const
Compute a polar-image descriptor of the provided features into the input image.
struct mrpt::vision::CFeatureExtraction::TOptions::TSIFTOptions SIFTOptions
void extractFeaturesSURF(const mrpt::img::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 SURF method.
GLenum GLenum GLvoid * row
Definition: glext.h:3576
unsigned int radius
axis of the polar image (default=6).
struct mrpt::vision::CFeatureExtraction::TOptions::TKLTOptions KLTOptions
GLsizei GLsizei GLchar * source
Definition: glext.h:4082
unsigned int bins_angle
Number of bins in the "angular" axis.
void extractFeaturesSIFT(const mrpt::img::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 SIFT method.
void extractFeaturesBCD(const mrpt::img::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.
void internal_computeLogPolarImageDescriptors(const mrpt::img::CImage &in_img, CFeatureList &in_features) const
Compute a log-polar image descriptor of the provided features into the input image.
void internal_computeBLDLineDescriptors(const mrpt::img::CImage &in_img, CFeatureList &in_features) const
Compute a BLD descriptor of the provided features into the input image.
unsigned int patchSize
Size of the patch to extract, or 0 if no patch is desired (default=21).
unsigned int radius
Maximum radius of the area of which the.
bool addNewFeatures
Whether to add the found features to the input feature list or clear it before adding them (default=f...
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, which may have been filled out manually or from detectFeatures.
unsigned int hist_size_distance
"intensity" axis of the 2D histogram (default=10).
Kanade-Lucas-Tomasi feature [SHI&#39;94].
void internal_computeSpinImageDescriptors(const mrpt::img::CImage &in_img, CFeatureList &in_features) const
Compute the intensity-domain spin images descriptor of the provided features into the input image...
struct mrpt::vision::CFeatureExtraction::TOptions::TSURFOptions SURFOptions
void convertCvSeqInCFeatureList(void *features, CFeatureList &list, unsigned int init_ID=0, const TImageROI &ROI=TImageROI()) const
Converts a sequence of openCV features into an MRPT feature list.
A class for storing images as grayscale or RGB bitmaps.
Definition: img/CImage.h:130
void internal_computeSurfDescriptors(const mrpt::img::CImage &in_img, CFeatureList &in_features) const
Compute the SURF descriptor of the provided features into the input image.
The central class from which images can be analyzed in search of different kinds of interest points a...
void extractFeaturesLSD(const mrpt::img::CImage &inImg, CFeatureList &feats, unsigned int init_ID, unsigned int nDesiredFeatures, const TImageROI &ROI=TImageROI()) const
Extract features from the image based on the LSD method.



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at lun oct 28 00:14:14 CET 2019