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