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-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 #ifndef CFeatureExtraction_H
11 #define CFeatureExtraction_H
12 
13 #include <mrpt/utils/CImage.h>
14 #include <mrpt/utils/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  mrpt::utils::CStream& 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  /** Constructor
321  */
323 
324  /** Virtual destructor.
325  */
326  virtual ~CFeatureExtraction();
327 
328  /** Extract features from the image based on the method defined in TOptions.
329  * \param img (input) The image from where to extract the images.
330  * \param feats (output) A complete list of features (containing a patch for
331  * each one of them if options.patchsize > 0).
332  * \param nDesiredFeatures (op. input) Number of features to be extracted.
333  * Default: all possible.
334  *
335  * \sa computeDescriptors
336  */
337  void detectFeatures(
338  const mrpt::utils::CImage& img, CFeatureList& feats,
339  const unsigned int init_ID = 0, const unsigned int nDesiredFeatures = 0,
340  const TImageROI& ROI = TImageROI()) const;
341 
342  /** Compute one (or more) descriptors for the given set of interest points
343  * onto the image, which may have been filled out manually or from \a
344  * detectFeatures
345  * \param in_img (input) The image from where to compute the descriptors.
346  * \param inout_features (input/output) The list of features whose
347  * descriptors are going to be computed.
348  * \param in_descriptor_list (input) The bitwise OR of one or several
349  * descriptors defined in TDescriptorType.
350  *
351  * Each value in "in_descriptor_list" represents one descriptor to be
352  * computed, for example:
353  * \code
354  * // This call will compute both, SIFT and Spin-Image descriptors for a
355  * list of feature points lstFeats.
356  * fext.computeDescriptors(img, lstFeats, descSIFT | descSpinImages );
357  * \endcode
358  *
359  * \note The SIFT descriptors for already located features can only be
360  * computed through the Hess and
361  * CSBinary implementations which may be specified in
362  * CFeatureExtraction::TOptions::SIFTOptions.
363  *
364  * \note This call will also use additional parameters from \a options
365  */
366  void computeDescriptors(
367  const mrpt::utils::CImage& in_img, CFeatureList& inout_features,
368  TDescriptorType in_descriptor_list) const;
369 
370 #if 0 // Delete? see comments in .cpp
371  /** Extract more features from the image (apart from the provided ones) based on the method defined in TOptions.
372  * \param img (input) The image from where to extract the images.
373  * \param inList (input) The actual features in the image.
374  * \param outList (output) The list of new features (containing a patch for each one of them if options.patchsize > 0).
375  * \param nDesiredFeatures (op. input) Number of features to be extracted. Default: all possible.
376  *
377  * \sa The more powerful class: mrpt::vision::CGenericFeatureTracker
378  */
379  void findMoreFeatures( const mrpt::utils::CImage &img,
380  const CFeatureList &inList,
381  CFeatureList &outList,
382  unsigned int nDesiredFeats = 0) const;
383 #endif
384 
385  /** @name Static methods with low-level detector functionality
386  @{ */
387 
388  /** A SSE2-optimized implementation of FASTER-9 (requires img to be
389  * grayscale). If SSE2 is not available, it gratefully falls back to a
390  * non-optimized version.
391  *
392  * Only the pt.{x,y} fields are filled out for each feature: the rest of
393  * fields are left <b>uninitialized</b> and their content is
394  * <b>undefined</b>.
395  * Note that (x,y) are already scaled to the 0-level image coordinates if
396  * octave>0, by means of:
397  *
398  * \code
399  * pt.x = detected.x << octave;
400  * pt.y = detected.y << octave;
401  * \endcode
402  *
403  * If \a append_to_list is true, the \a corners list is not cleared before
404  * adding the newly detected feats.
405  *
406  * If a valid pointer is provided for \a out_feats_index_by_row, upon
407  * return you will find a vector with
408  * as many entries as rows in the image (the real number of rows,
409  * disregarding the value of \a octave).
410  * The number in each entry is the 0-based index (in \a corners) of
411  * the first feature that falls in that line of the image. This index can
412  * be used to fasten looking for correspondences.
413  *
414  * \ingroup mrptvision_features
415  */
416  static void detectFeatures_SSE2_FASTER9(
417  const mrpt::utils::CImage& img, TSimpleFeatureList& corners,
418  const int threshold = 20, bool append_to_list = false,
419  uint8_t octave = 0,
420  std::vector<size_t>* out_feats_index_by_row = nullptr);
421 
422  /** Just like \a detectFeatures_SSE2_FASTER9() for another version of the
423  * detector.
424  * \ingroup mrptvision_features */
425  static void detectFeatures_SSE2_FASTER10(
426  const mrpt::utils::CImage& img, TSimpleFeatureList& corners,
427  const int threshold = 20, bool append_to_list = false,
428  uint8_t octave = 0,
429  std::vector<size_t>* out_feats_index_by_row = nullptr);
430 
431  /** Just like \a detectFeatures_SSE2_FASTER9() for another version of the
432  * detector.
433  * \ingroup mrptvision_features */
434  static void detectFeatures_SSE2_FASTER12(
435  const mrpt::utils::CImage& img, TSimpleFeatureList& corners,
436  const int threshold = 20, bool append_to_list = false,
437  uint8_t octave = 0,
438  std::vector<size_t>* out_feats_index_by_row = nullptr);
439 
440  /** @} */
441 
442  private:
443  /** Compute the SIFT descriptor of the provided features into the input
444  image
445  * \param in_img (input) The image from where to compute the descriptors.
446  * \param in_features (input/output) The list of features whose descriptors
447  are going to be computed.
448  *
449  * \note The SIFT descriptors for already located features can only be
450  computed through the Hess and
451  CSBinary implementations which may be specified in
452  CFeatureExtraction::TOptions::SIFTOptions.
453  */
455  const mrpt::utils::CImage& in_img, CFeatureList& in_features) const;
456 
457  /** Compute the SURF descriptor of the provided features into the input
458  * image
459  * \param in_img (input) The image from where to compute the descriptors.
460  * \param in_features (input/output) The list of features whose descriptors
461  * are going to be computed.
462  */
464  const mrpt::utils::CImage& in_img, CFeatureList& in_features) const;
465 
466  /** Compute the ORB descriptor of the provided features into the input image
467  * \param in_img (input) The image from where to compute the descriptors.
468  * \param in_features (input/output) The list of features whose descriptors
469  * are going to be computed.
470  */
472  const mrpt::utils::CImage& in_img, CFeatureList& in_features) const;
473 
474  /** Compute the intensity-domain spin images descriptor of the provided
475  * features into the input image
476  * \param in_img (input) The image from where to compute the descriptors.
477  * \param in_features (input/output) The list of features whose descriptors
478  * are going to be computed.
479  *
480  * \note Additional parameters from
481  * CFeatureExtraction::TOptions::SpinImagesOptions are used in this method.
482  */
484  const mrpt::utils::CImage& in_img, CFeatureList& in_features) const;
485 
486  /** Compute a polar-image descriptor of the provided features into the input
487  * image
488  * \param in_img (input) The image from where to compute the descriptors.
489  * \param in_features (input/output) The list of features whose descriptors
490  * are going to be computed.
491  *
492  * \note Additional parameters from
493  * CFeatureExtraction::TOptions::PolarImagesOptions are used in this method.
494  */
496  const mrpt::utils::CImage& in_img, CFeatureList& in_features) const;
497 
498  /** Compute a log-polar image descriptor of the provided features into the
499  * input image
500  * \param in_img (input) The image from where to compute the descriptors.
501  * \param in_features (input/output) The list of features whose descriptors
502  * are going to be computed.
503  *
504  * \note Additional parameters from
505  * CFeatureExtraction::TOptions::LogPolarImagesOptions are used in this
506  * method.
507  */
509  const mrpt::utils::CImage& in_img, CFeatureList& in_features) const;
510  /** Compute a BLD descriptor of the provided features into the input image
511  * \param in_img (input) The image from where to compute the descriptors.
512  * \param in_features (input/output) The list of features whose descriptors
513  * are going to be computed.
514  *
515  * \note Additional parameters from
516  * CFeatureExtraction::TOptions::LogPolarImagesOptions are used in this
517  * method.
518  */
520  const mrpt::utils::CImage& in_img, CFeatureList& in_features) const;
521  /** Compute a LATCH descriptor of the provided features into the input image
522  * \param in_img (input) The image from where to compute the descriptors.
523  * \param in_features (input/output) The list of features whose descriptors
524  * are going to be computed.
525  *
526  * \note Additional parameters from
527  * CFeatureExtraction::TOptions::LogPolarImagesOptions are used in this
528  * method.
529  */
531  const mrpt::utils::CImage& in_img, CFeatureList& in_features) const;
532 
533 #if 0 // Delete? see comments in .cpp
534  /** Select good features using the openCV implementation of the KLT method.
535  * \param img (input) The image from where to select extract the images.
536  * \param feats (output) A complete list of features (containing a patch for each one of them if options.patchsize > 0).
537  * \param nDesiredFeatures (op. input) Number of features to be extracted. Default: all possible.
538  */
539  void selectGoodFeaturesKLT(
540  const mrpt::utils::CImage &inImg,
541  CFeatureList &feats,
542  unsigned int init_ID = 0,
543  unsigned int nDesiredFeatures = 0) const;
544 #endif
545 
546  /** Extract features from the image based on the KLT method.
547  * \param img The image from where to extract the images.
548  * \param feats The list of extracted features.
549  * \param nDesiredFeatures Number of features to be extracted. Default:
550  * authomatic.
551  */
552  void extractFeaturesKLT(
553  const mrpt::utils::CImage& img, CFeatureList& feats,
554  unsigned int init_ID = 0, unsigned int nDesiredFeatures = 0,
555  const TImageROI& ROI = TImageROI()) const;
556 
557  // ------------------------------------------------------------------------------------
558  // BCD
559  // ------------------------------------------------------------------------------------
560  /** Extract features from the image based on the BCD method.
561  * \param img The image from where to extract the images.
562  * \param feats The list of extracted features.
563  * \param nDesiredFeatures Number of features to be extracted. Default:
564  * authomatic.
565  * \param ROI (op. input) Region of Interest. Default: All the image.
566  */
567  void extractFeaturesBCD(
568  const mrpt::utils::CImage& img, CFeatureList& feats,
569  unsigned int init_ID = 0, unsigned int nDesiredFeatures = 0,
570  const TImageROI& ROI = TImageROI()) const;
571 
572  // ------------------------------------------------------------------------------------
573  // SIFT
574  // ------------------------------------------------------------------------------------
575  /** Extract features from the image based on the SIFT method.
576  * \param img The image from where to extract the images.
577  * \param feats The list of extracted features.
578  * \param nDesiredFeatures Number of features to be extracted. Default:
579  * authomatic.
580  * \param ROI (op. input) Region of Interest. Default: All the image.
581  */
582  void extractFeaturesSIFT(
583  const mrpt::utils::CImage& img, CFeatureList& feats,
584  unsigned int init_ID = 0, unsigned int nDesiredFeatures = 0,
585  const TImageROI& ROI = TImageROI()) const;
586 
587  // ------------------------------------------------------------------------------------
588  // ORB
589  // ------------------------------------------------------------------------------------
590  /** Extract features from the image based on the ORB method.
591  * \param img The image from where to extract the images.
592  * \param feats The list of extracted features.
593  * \param nDesiredFeatures Number of features to be extracted. Default:
594  * authomatic.
595  */
596  void extractFeaturesORB(
597  const mrpt::utils::CImage& img, CFeatureList& feats,
598  const unsigned int init_ID = 0, const unsigned int nDesiredFeatures = 0,
599  const TImageROI& ROI = TImageROI()) const;
600 
601  // ------------------------------------------------------------------------------------
602  // SURF
603  // ------------------------------------------------------------------------------------
604  /** Extract features from the image based on the SURF method.
605  * \param img The image from where to extract the images.
606  * \param feats The list of extracted features.
607  * \param nDesiredFeatures Number of features to be extracted. Default:
608  * authomatic.
609  */
610  void extractFeaturesSURF(
611  const mrpt::utils::CImage& img, CFeatureList& feats,
612  unsigned int init_ID = 0, unsigned int nDesiredFeatures = 0,
613  const TImageROI& ROI = TImageROI()) const;
614 
615  // ------------------------------------------------------------------------------------
616  // FAST
617  // ------------------------------------------------------------------------------------
618  /** Extract features from the image based on the FAST method.
619  * \param img The image from where to extract the images.
620  * \param feats The list of extracted features.
621  * \param nDesiredFeatures Number of features to be extracted. Default:
622  * authomatic.
623  */
624  void extractFeaturesFAST(
625  const mrpt::utils::CImage& img, CFeatureList& feats,
626  unsigned int init_ID = 0, unsigned int nDesiredFeatures = 0,
627  const TImageROI& ROI = TImageROI(),
628  const mrpt::math::CMatrixBool* mask = nullptr) const;
629 
630  /** Edward's "FASTER & Better" detector, N=9,10,12 */
632  const int N, const mrpt::utils::CImage& img, CFeatureList& feats,
633  unsigned int init_ID = 0, unsigned int nDesiredFeatures = 0,
634  const TImageROI& ROI = TImageROI()) const;
635 
636  // # added by Raghavender Sahdev
637  //-------------------------------------------------------------------------------------
638  // AKAZE
639  //-------------------------------------------------------------------------------------
640  /** Extract features from the image based on the AKAZE method.
641  * \param img The image from where to extract the images.
642  * \param feats The list of extracted features.
643  * \param nDesiredFeatures Number of features to be extracted. Default:
644  * authomatic.
645  */
647  const mrpt::utils::CImage& inImg, CFeatureList& feats,
648  unsigned int init_ID, unsigned int nDesiredFeatures,
649  const TImageROI& ROI = TImageROI()) const;
650 
651  //-------------------------------------------------------------------------------------
652  // LSD
653  //-------------------------------------------------------------------------------------
654  /** Extract features from the image based on the LSD method.
655  * \param img The image from where to extract the images.
656  * \param feats The list of extracted features.
657  * \param nDesiredFeatures Number of features to be extracted. Default:
658  * authomatic.
659  */
660  void extractFeaturesLSD(
661  const mrpt::utils::CImage& inImg, CFeatureList& feats,
662  unsigned int init_ID, unsigned int nDesiredFeatures,
663  const TImageROI& ROI = TImageROI()) const;
664 
665  // ------------------------------------------------------------------------------------
666  // my_scale_space_extrema
667  // ------------------------------------------------------------------------------------
668  /** Computes extrema in the scale space.
669  * \param dog_pyr Pyramid of images.
670  * \param octvs Number of considered octaves.
671  * \param intvls Number of intervales in octaves.
672  */
674  CFeatureList& featList, void* dog_pyr, int octvs, int intvls,
675  double contr_thr, int curv_thr, void* storage) const;
676 
677  /** Adjust scale if the image was initially doubled.
678  * \param features The sequence of features.
679  */
680  void my_adjust_for_img_dbl(void* features) const;
681 
682  /** Gets the number of times that a point in the image is higher or lower
683  * than the surroundings in the image-scale space
684  * \param dog_pyr Pyramid of images.
685  * \param octvs Number of considered octaves.
686  * \param intvls Number of intervales in octaves.
687  * \param row The row of the feature in the original image.
688  * \param col The column of the feature in the original image.
689  * \param nMin [out]: Times that the feature is lower than the surroundings.
690  * \param nMax [out]: Times that the feature is higher than the surroundings.
691  */
692  void getTimesExtrema(
693  void* dog_pyr, int octvs, int intvls, float row, float col,
694  unsigned int& nMin, unsigned int& nMax) const;
695 
696  /** Computes the Laplacian value of the feature in the corresponing image in
697  * the pyramid.
698  * \param dog_pyr Pyramid of images.
699  * \param octvs Number of considered octaves.
700  * \param intvls Number of intervales in octaves.
701  * \param row The row of the feature in the original image.
702  * \param col The column of the feature in the original image.
703  */
704  double getLaplacianValue(
705  void* dog_pyr, int octvs, int intvls, float row, float col) const;
706 
707  /** Append a sequence of openCV features into an MRPT feature list.
708  * \param features The sequence of features.
709  * \param list [in-out] The list of MRPT features.
710  * \param init_ID [in] The initial ID for the new features.
711  */
713  void* features, CFeatureList& list, unsigned int init_ID = 0) const;
714 
715  /** Converts a sequence of openCV features into an MRPT feature list.
716  * \param features The sequence of features.
717  * \param list [in-out] The list of MRPT features.
718  * \param init_ID [in][optional] The initial ID for the features (default =
719  * 0).
720  * \param ROI [in][optional] The initial ID for the features (default = empty
721  * ROI -> not used).
722  */
724  void* features, CFeatureList& list, unsigned int init_ID = 0,
725  const TImageROI& ROI = TImageROI()) const;
726 
727 }; // end of class
728 } // end of namespace
729 } // end of namespace
730 #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 internal_computeSiftDescriptors(const mrpt::utils::CImage &in_img, CFeatureList &in_features) const
Compute the SIFT descriptor of the provided features into the input image.
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.
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...
void extractFeaturesAKAZE(const mrpt::utils::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.
CFeatureExtraction()
before calling "detectFeatures"
void extractFeaturesLSD(const mrpt::utils::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.
A class for storing images as grayscale or RGB bitmaps.
Definition: CImage.h:118
unsigned int radius
for the "soft histogram" (default=20 units [0,255])
TFeatureType featsType
Type of the extracted features.
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.
double rho_scale
will have dimensions WxH, with: W=num_angles, H= rho_scale * log(radius)
void internal_computeLogPolarImageDescriptors(const mrpt::utils::CImage &in_img, CFeatureList &in_features) const
Compute a log-polar image descriptor of the provided features into the input image.
void internal_computeSurfDescriptors(const mrpt::utils::CImage &in_img, CFeatureList &in_features) const
Compute the SURF descriptor of the provided features into the input image.
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...
void extractFeaturesFASTER_N(const int N, const mrpt::utils::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.
The set of parameters for all the detectors & descriptor algorithms.
void dumpToTextStream(mrpt::utils::CStream &out) const override
This method should clearly display all the contents of the structure in textual form, sending it to a CStream.
struct mrpt::vision::CFeatureExtraction::TOptions::TBLDOptions BLDOptions
static void detectFeatures_SSE2_FASTER12(const mrpt::utils::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.
TOptions(const TFeatureType featsType=featKLT)
Initalizer.
void internal_computeORBDescriptors(const mrpt::utils::CImage &in_img, CFeatureList &in_features) const
Compute the ORB descriptor of the provided features into the input image.
struct mrpt::vision::CFeatureExtraction::TOptions::TORBOptions ORBOptions
void extractFeaturesSURF(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 SURF method.
This class allows loading and storing values and vectors of different types from a configuration text...
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.
void extractFeaturesSIFT(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 SIFT method.
void internal_computeSpinImageDescriptors(const mrpt::utils::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::TLSDOptions LSDOptions
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
Definition: CStream.h:41
void internal_computeBLDLineDescriptors(const mrpt::utils::CImage &in_img, CFeatureList &in_features) const
Compute a BLD descriptor of the provided features into the input image.
virtual ~CFeatureExtraction()
Virtual destructor.
float std_intensity
"soft histogram" (default=0.4 pixels)
struct mrpt::vision::CFeatureExtraction::TOptions::TBCDOptions BCDOptions
void extractFeaturesKLT(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 KLT method.
void internal_computeLATCHDescriptors(const mrpt::utils::CImage &in_img, CFeatureList &in_features) const
Compute a LATCH descriptor of the provided features into the input image.
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
static void detectFeatures_SSE2_FASTER10(const mrpt::utils::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.
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 insertCvSeqInCFeatureList(void *features, CFeatureList &list, unsigned int init_ID=0) const
Append a sequence of openCV features into an MRPT feature list.
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::THarrisOptions harrisOptions
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:305
TDescriptorType
The bitwise OR combination of values of TDescriptorType are used in CFeatureExtraction::computeDescri...
void extractFeaturesORB(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 ORB method.
static void detectFeatures_SSE2_FASTER9(const mrpt::utils::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).
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 * 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.
struct mrpt::vision::CFeatureExtraction::TOptions::TAKAZEOptions AKAZEOptions
struct mrpt::vision::CFeatureExtraction::TOptions::TSIFTOptions SIFTOptions
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
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, which may have been filled out manually or from detectFeatures.
GLsizei GLsizei GLchar * source
Definition: glext.h:4082
unsigned int bins_angle
Number of bins in the "angular" axis.
void internal_computePolarImageDescriptors(const mrpt::utils::CImage &in_img, CFeatureList &in_features) const
Compute a polar-image descriptor of the provided features into the input image.
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.
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...
unsigned int hist_size_distance
"intensity" axis of the 2D histogram (default=10).
Kanade-Lucas-Tomasi feature [SHI&#39;94].
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.
This is a virtual base class for sets of options than can be loaded from and/or saved to configuratio...
void extractFeaturesFAST(const mrpt::utils::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.
The central class from which images can be analyzed in search of different kinds of interest points a...



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ae4571287 Thu Nov 23 00:06:53 2017 +0100 at dom oct 27 23:51:55 CET 2019