Main MRPT website > C++ reference for MRPT 1.9.9
CFeature.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 CFeature_H
11 #define CFeature_H
12 
13 #include <mrpt/utils/CImage.h>
14 #include <mrpt/math/CMatrix.h>
16 
17 #include <mrpt/vision/types.h>
18 
19 namespace mrpt
20 {
21 namespace vision
22 {
23 class CFeatureList;
24 class CMatchedFeatureList;
25 
27 {
28  firstList = 0,
31 };
32 
33 /** \defgroup mrptvision_features Feature detection, descriptors and matching
34  * \ingroup mrpt_vision_grp
35  */
36 
37 /** \addtogroup mrptvision_features
38  @{ */
39 
40 /****************************************************
41  Class CFEATURE
42 *****************************************************/
43 
44 /** A generic 2D feature from an image, extracted with \a CFeatureExtraction
45  * Each feature may have one or more descriptors (see \a descriptors), in
46  * addition to an image patch.
47  * The (Euclidean) distance between descriptors in a pair of features can be
48  * computed with descriptorDistanceTo,
49  * while the similarity of the patches is given by patchCorrelationTo.
50  *
51  * \sa CFeatureList, TSimpleFeature, TSimpleFeatureList
52  */
54 {
55  friend class CFeatureList;
56  friend class CMatchedFeatureList;
57 
59 
60  public:
61  float x, y; //!< Coordinates in the image
62  TFeatureID ID; //!< ID of the feature
64  patch; //!< A patch of the image surrounding the feature
65  uint16_t patchSize; //!< Size of the patch (patchSize x patchSize) (it must
66  //! be an odd number)
67  TFeatureType type; //!< Type of the feature: featNotDefined, featSIFT,
68  //! featKLT, featHarris, featSURF, featBeacon
69  TFeatureTrackStatus track_status; //!< Status of the feature tracking
70  //! process (old name: KLT_status)
71  float response; //!< A measure of the "goodness" of the feature (old name:
72  //! KLT_val)
73  float orientation; //!< Main orientation of the feature
74  float scale; //!< Feature scale into the scale space
75  uint8_t user_flags; //!< A field for any other flags needed by the user
76  //!(this has not a predefined meaning)
77  uint16_t nTimesSeen; //!< Number of frames it has been seen in a sequence
78  //! of images.
79  uint16_t nTimesNotSeen; //!< Number of frames it has not been seen in a
80  //! sequence of images.
81  uint16_t nTimesLastSeen; //!< Number of frames since it was seen for the
82  //! last time.
83 
84  // # added by Raghavender Sahdev
85  float x2[2], y2[2]; //!< Coordinates for a LSD Detector to represent a line
86 
87  double depth; //!< The estimated depth in 3D of this feature wrt the camera
88  //! in the current frame
89  double initialDepth; //!< The estimated depth in 3D of this feature wrt the
90  //! camera that took its image
92  p3D; //!< The estimated 3D point of this feature wrt its camera
93  std::deque<double> multiScales; //!< A set of scales where the
94  //! multi-resolution descriptor has been
95  //! computed
96  std::deque<std::vector<double>> multiOrientations; //!< A vector of main
97  //! orientations (there
98  //! is a vector of
99  //! orientations for each
100  //! scale)
101  std::deque<std::vector<std::vector<int32_t>>>
102  multiHashCoeffs; //!< A set of vectors containing the coefficients for
103  //! a HASH table of descriptors
104  bool isPointFeature()
105  const; //!< Return false only for Blob detectors (SIFT, SURF)
106 
107  /** All the possible descriptors this feature may have */
109  {
110  TDescriptors(); // Initialization
111 
112  std::vector<uint8_t> SIFT; //!< SIFT feature descriptor
113  std::vector<float> SURF; //!< SURF feature descriptor
114  std::vector<float> SpinImg; //!< The 2D histogram as a single row
115  uint16_t SpinImg_range_rows; //!< The number of rows (corresponding to
116  //! range bins in the 2D histogram) of the
117  //! original matrix from which SpinImg was
118  //! extracted as a vector.
120  PolarImg; //!< A polar image centered at the interest point
122  LogPolarImg; //!< A log-polar image centered at the interest point
123  bool polarImgsNoRotation; //!< If set to true (manually, default=false)
124  //! the call to "descriptorDistanceTo" will
125  //! not consider all the rotations between
126  //! polar image descriptors (PolarImg,
127  //! LogPolarImg)
128  std::deque<std::vector<std::vector<int32_t>>>
129  multiSIFTDescriptors; //!< A set of SIFT-like descriptors for each
130  //! orientation and scale of the
131  //! multiResolution feature (there is a vector
132  //! of descriptors for each scale)
133  std::vector<uint8_t> ORB; //!< ORB feature descriptor
134  // # added by Raghavender Sadev
135  std::vector<uint8_t> BLD; //!< BLD feature descriptor
136  std::vector<uint8_t> LATCH; //!< LATCH feature descriptor
137 
138  bool hasDescriptorSIFT() const
139  {
140  return !SIFT.empty();
141  }; //!< Whether this feature has this kind of descriptor
142  bool hasDescriptorSURF() const
143  {
144  return !SURF.empty();
145  } //!< Whether this feature has this kind of descriptor
146  bool hasDescriptorSpinImg() const
147  {
148  return !SpinImg.empty();
149  }; //!< Whether this feature has this kind of descriptor
151  {
152  return PolarImg.rows() != 0;
153  }; //!< Whether this feature has this kind of descriptor
155  {
156  return LogPolarImg.rows() != 0;
157  }; //!< Whether this feature has this kind of descriptor
159  {
160  return (
161  multiSIFTDescriptors.size() > 0 &&
162  multiSIFTDescriptors[0].size() >
163  0); //!< Whether this feature has this kind of descriptor
164  }
165  bool hasDescriptorORB() const
166  {
167  return !ORB.empty();
168  } //!< Whether this feature has this kind of descriptor
169  //# added by Raghavender Sahdev
170  bool hasDescriptorBLD() const
171  {
172  return !BLD.empty();
173  } //!< Whether this feature has this kind of descriptor
174  bool hasDescriptorLATCH() const
175  {
176  return !LATCH.empty();
177  } //!< Whether this feature has this kind of descriptor
178  } descriptors;
179 
180  /** Return the first found descriptor, as a matrix.
181  * \return false on error, i.e. there is no valid descriptor.
182  */
184 
185  /** Computes the normalized cross-correlation between the patches of this
186  * and another feature (normalized in the range [0,1], such as 0=best,
187  * 1=worst).
188  * \note If this or the other features does not have patches or they are
189  * of different sizes, an exception will be raised.
190  * \sa descriptorDistanceTo
191  */
192  float patchCorrelationTo(const CFeature& oFeature) const;
193 
194  /** Computes the Euclidean Distance between this feature's and other
195  * feature's descriptors, using the given descriptor or the first present
196  * one.
197  * \note If descriptorToUse is not descAny and that descriptor is not
198  * present in one of the features, an exception will be raised.
199  * \sa patchCorrelationTo
200  */
201  float descriptorDistanceTo(
202  const CFeature& oFeature, TDescriptorType descriptorToUse = descAny,
203  bool normalize_distances = true) const;
204 
205  /** Computes the Euclidean Distance between "this" and the "other"
206  * descriptors */
208  const CFeature& oFeature, bool normalize_distances = true) const;
209 
210  /** Computes the Euclidean Distance between "this" and the "other"
211  * descriptors */
213  const CFeature& oFeature, bool normalize_distances = true) const;
214 
215  /** Computes the Euclidean Distance between "this" and the "other"
216  * descriptors */
218  const CFeature& oFeature, bool normalize_distances = true) const;
219 
220  /** Returns the minimum Euclidean Distance between "this" and the "other"
221  * polar image descriptor, for the best shift in orientation.
222  * \param oFeature The other feature to compare with.
223  * \param minDistAngle The placeholder for the angle at which the smallest
224  * distance is found.
225  * \return The distance for the best orientation (minimum distance).
226  */
228  const CFeature& oFeature, float& minDistAngle,
229  bool normalize_distances = true) const;
230 
231  /** Returns the minimum Euclidean Distance between "this" and the "other"
232  * log-polar image descriptor, for the best shift in orientation.
233  * \param oFeature The other feature to compare with.
234  * \param minDistAngle The placeholder for the angle at which the smallest
235  * distance is found.
236  * \return The distance for the best orientation (minimum distance).
237  */
239  const CFeature& oFeature, float& minDistAngle,
240  bool normalize_distances = true) const;
241 
242  /** Computes the Hamming distance "this" and the "other" descriptor ORB
243  * descriptor */
244  uint8_t descriptorORBDistanceTo(const CFeature& oFeature) const;
245 
246  // # added by Raghavender Sahdev
247  /** Computes the Euclidean Distance between "this" and the "other"
248  * descriptors */
250  const CFeature& oFeature, bool normalize_distances = true) const;
251  /** Computes the Euclidean Distance between "this" and the "other"
252  * descriptors */
254  const CFeature& oFeature, bool normalize_distances = true) const;
255 
256  /** Save the feature to a text file in this format:
257  * "%% Dump of mrpt::vision::CFeatureList. Each line format is:\n"
258  * "%% ID TYPE X Y ORIENTATION SCALE TRACK_STATUS RESPONSE HAS_SIFT
259  *[SIFT] HAS_SURF [SURF] HAS_MULTI [MULTI_i] HAS_ORB [ORB]"
260  * "%% |---------------------- feature ------------------|
261  *|---------------------- descriptors ------------------------|"
262  * "%% with:\n"
263  * "%% TYPE : The used detector: 0:KLT, 1: Harris, 2: BCD, 3: SIFT, 4:
264  *SURF, 5: Beacon, 6: FAST, 7: ORB\n"
265  * "%% HAS_* : 1 if a descriptor of that type is associated to the
266  *feature."
267  * "%% SIFT : Present if HAS_SIFT=1: N DESC_0 ... DESC_N-1"
268  * "%% SURF : Present if HAS_SURF=1: N DESC_0 ... DESC_N-1"
269  * "%% MULTI : Present if HAS_MULTI=1: SCALE ORI N DESC_0 ... DESC_N-1"
270  * "%% ORB : Present if HAS_ORB=1: DESC_0 ... DESC_31
271  * "%%-----------------------------------------------------------------------------\n");
272  */
273  void saveToTextFile(const std::string& filename, bool APPEND = false);
274 
275  /** Get the type of the feature
276  */
277  TFeatureType get_type() const { return type; }
278  /** Dump feature information into a text stream */
279  void dumpToTextStream(mrpt::utils::CStream& out) const;
280 
281  void dumpToConsole() const;
282 
283  /** Constructor
284  */
285  CFeature();
286 
287  /** Virtual destructor */
288  virtual ~CFeature() {}
289  protected:
290  /** Internal function used by "descriptorLogPolarImgDistanceTo" and
291  * "descriptorPolarImgDistanceTo"
292  */
294  const mrpt::math::CMatrix& desc1, const mrpt::math::CMatrix& desc2,
295  float& minDistAngle, bool normalize_distances, bool dont_shift_angle);
296 
297 }; // end of class
298 
299 /****************************************************
300  Class CFEATURELIST
301 *****************************************************/
302 /** A list of visual features, to be used as output by detectors, as
303  * input/output by trackers, etc.
304  */
305 class CFeatureList : public mrpt::math::KDTreeCapable<CFeatureList>
306 {
307  protected:
308  typedef std::vector<CFeature::Ptr> TInternalFeatList;
309 
311  m_feats; //!< The actual container with the list of features
312 
313  public:
314  /** The type of the first feature in the list */
315  inline TFeatureType get_type() const
316  {
317  return empty() ? featNotDefined : (*begin())->get_type();
318  }
319 
320  /** Save feature list to a text file */
321  void saveToTextFile(const std::string& fileName, bool APPEND = false);
322 
323  /** Save feature list to a text file */
324  void loadFromTextFile(const std::string& fileName);
325 
326  /** Copies the content of another CFeatureList inside this one. The inner
327  * features are also copied. */
328  void copyListFrom(const CFeatureList& otherList);
329 
330  /** Get the maximum ID into the list */
331  TFeatureID getMaxID() const;
332 
333  /** Get a reference to a Feature from its ID */
334  CFeature::Ptr getByID(const TFeatureID& ID) const;
335  CFeature::Ptr getByID(const TFeatureID& ID, int& out_idx) const;
336 
337  /** Get a vector of references to a subset of features from their IDs */
338  void getByMultiIDs(
339  const std::vector<TFeatureID>& IDs, std::vector<CFeature::Ptr>& out,
340  std::vector<int>& outIndex) const;
341 
342  /** Get a reference to the nearest feature to the a given 2D point (version
343  * returning distance to closest feature in "max_dist")
344  * \param x [IN] The query point x-coordinate
345  * \param y [IN] The query point y-coordinate
346  * \param max_dist [IN/OUT] At input: The maximum distance to search for.
347  * At output: The actual distance to the feature.
348  * \return A reference to the found feature, or a nullptr smart pointer if
349  * none found.
350  * \note See also all the available KD-tree search methods, listed in
351  * mrpt::math::KDTreeCapable
352  */
353  CFeature::Ptr nearest(const float x, const float y, double& max_dist) const;
354 
355  /** Constructor */
356  CFeatureList();
357 
358  /** Virtual destructor */
359  virtual ~CFeatureList();
360 
361  /** Call this when the list of features has been modified so the KD-tree is
362  * marked as outdated. */
364  /** @name Method and datatypes to emulate a STL container
365  @{ */
368 
369  typedef TInternalFeatList::reverse_iterator reverse_iterator;
370  typedef TInternalFeatList::const_reverse_iterator const_reverse_iterator;
371 
372  inline iterator begin() { return m_feats.begin(); }
373  inline iterator end() { return m_feats.end(); }
374  inline const_iterator begin() const { return m_feats.begin(); }
375  inline const_iterator end() const { return m_feats.end(); }
376  inline reverse_iterator rbegin() { return m_feats.rbegin(); }
377  inline reverse_iterator rend() { return m_feats.rend(); }
378  inline const_reverse_iterator rbegin() const { return m_feats.rbegin(); }
379  inline const_reverse_iterator rend() const { return m_feats.rend(); }
380  inline iterator erase(const iterator& it)
381  {
383  return m_feats.erase(it);
384  }
385 
386  inline bool empty() const { return m_feats.empty(); }
387  inline size_t size() const { return m_feats.size(); }
388  inline void clear()
389  {
390  m_feats.clear();
392  }
393  inline void resize(size_t N)
394  {
395  m_feats.resize(N);
397  }
398 
399  inline void push_back(const CFeature::Ptr& f)
400  {
402  m_feats.push_back(f);
403  }
404 
405  inline CFeature::Ptr& operator[](const unsigned int index)
406  {
407  return m_feats[index];
408  }
409  inline const CFeature::Ptr& operator[](const unsigned int index) const
410  {
411  return m_feats[index];
412  }
413 
414  /** @} */
415 
416  /** @name Methods that MUST be implemented by children classes of
417  KDTreeCapable
418  @{ */
419 
420  /// Must return the number of data points
421  inline size_t kdtree_get_point_count() const { return this->size(); }
422  /// Returns the dim'th component of the idx'th point in the class:
423  inline float kdtree_get_pt(const size_t idx, int dim) const
424  {
425  ASSERTDEB_(dim == 0 || dim == 1)
426  if (dim == 0)
427  return m_feats[idx]->x;
428  else
429  return m_feats[idx]->y;
430  }
431 
432  /// Returns the distance between the vector "p1[0:size-1]" and the data
433  /// point with index "idx_p2" stored in the class:
434  inline float kdtree_distance(
435  const float* p1, const size_t idx_p2, size_t size) const
436  {
437  ASSERTDEB_(size == 2)
438  MRPT_UNUSED_PARAM(size); // in release mode
439 
440  const float d0 = p1[0] - m_feats[idx_p2]->x;
441  const float d1 = p1[1] - m_feats[idx_p2]->y;
442  return d0 * d0 + d1 * d1;
443  }
444 
445  // Optional bounding-box computation: return false to default to a standard
446  // bbox computation loop.
447  // Return true if the BBOX was already computed by the class and returned
448  // in "bb" so it can be avoided to redo it again.
449  // Look at bb.size() to find out the expected dimensionality (e.g. 2 or 3
450  // for point clouds)
451  template <typename BBOX>
452  bool kdtree_get_bbox(BBOX& bb) const
453  {
454  MRPT_UNUSED_PARAM(bb);
455  return false;
456  }
457 
458  /** @} */
459 
460  /** @name getFeature*() methods for template-based access to feature list
461  @{ */
462  inline float getFeatureX(size_t i) const { return m_feats[i]->x; }
463  inline float getFeatureY(size_t i) const { return m_feats[i]->y; }
464  inline TFeatureID getFeatureID(size_t i) const { return m_feats[i]->ID; }
465  inline float getFeatureResponse(size_t i) const
466  {
467  return m_feats[i]->response;
468  }
469  inline bool isPointFeature(size_t i) const
470  {
471  return m_feats[i]->isPointFeature();
472  }
473  inline float getScale(size_t i) const { return m_feats[i]->scale; }
475  {
476  return m_feats[i]->track_status;
477  }
478 
479  inline void setFeatureX(size_t i, float x) { m_feats[i]->x = x; }
480  inline void setFeatureXf(size_t i, float x) { m_feats[i]->x = x; }
481  inline void setFeatureY(size_t i, float y) { m_feats[i]->y = y; }
482  inline void setFeatureYf(size_t i, float y) { m_feats[i]->y = y; }
483  inline void setFeatureID(size_t i, TFeatureID id) { m_feats[i]->ID = id; }
484  inline void setFeatureResponse(size_t i, float r)
485  {
486  m_feats[i]->response = r;
487  }
488  inline void setScale(size_t i, float s) { m_feats[i]->scale = s; }
489  inline void setTrackStatus(size_t i, TFeatureTrackStatus s)
490  {
491  m_feats[i]->track_status = s;
492  }
493 
494  inline void mark_as_outdated() const { kdtree_mark_as_outdated(); }
495  /** @} */
496 
497 }; // end of class
498 
499 /****************************************************
500  Class CMATCHEDFEATURELIST
501 *****************************************************/
502 /** A list of features
503 */
505  : public std::deque<std::pair<CFeature::Ptr, CFeature::Ptr>>
506 {
507  public:
508  /** The type of the first feature in the list */
509  inline TFeatureType get_type() const
510  {
511  return empty() ? featNotDefined : (begin()->first)->get_type();
512  }
513 
514  /** Save list of matched features to a text file */
515  void saveToTextFile(const std::string& fileName);
516 
517  /** Returns the matching features as two separate CFeatureLists */
518  void getBothFeatureLists(CFeatureList& list1, CFeatureList& list2);
519 
520  /** Returns a smart pointer to the feature with the provided ID or a empty
521  * one if not found */
522  CFeature::Ptr getByID(const TFeatureID& ID, const TListIdx& idx);
523 
524  /** Returns the maximum ID of the features in the list. If the max ID has
525  been already set up, this method just returns it.
526  Otherwise, this method finds, stores and returns it.*/
527  void getMaxID(
528  const TListIdx& idx, TFeatureID& firstListID, TFeatureID& secondListID);
529 
530  /** Updates the value of the maximum ID of the features in the matched list,
531  * i.e. it explicitly searches for the max ID and updates the member
532  * variables. */
533  void updateMaxID(const TListIdx& idx);
534 
535  /** Explicitly set the max IDs values to certain values */
536  inline void setLeftMaxID(const TFeatureID& leftID) { m_leftMaxID = leftID; }
537  inline void setRightMaxID(const TFeatureID& rightID)
538  {
539  m_rightMaxID = rightID;
540  }
541  inline void setMaxIDs(const TFeatureID& leftID, const TFeatureID& rightID)
542  {
543  setLeftMaxID(leftID);
544  setRightMaxID(rightID);
545  };
546 
547  /** Constructor */
549 
550  /** Virtual destructor */
551  virtual ~CMatchedFeatureList();
552 
553  protected:
555 }; // end of class
556 
557 /** @} */ // End of add to module: mrptvision_features
558 
559 } // end of namespace
560 
561 namespace utils
562 {
563 // Specialization must occur in the same namespace
565 }
566 } // end of namespace
567 
568 #endif
void updateMaxID(const TListIdx &idx)
Updates the value of the maximum ID of the features in the matched list, i.e.
Definition: CFeature.cpp:1388
float descriptorDistanceTo(const CFeature &oFeature, TDescriptorType descriptorToUse=descAny, bool normalize_distances=true) const
Computes the Euclidean Distance between this feature&#39;s and other feature&#39;s descriptors, using the given descriptor or the first present one.
Definition: CFeature.cpp:515
std::shared_ptr< CFeature > Ptr
Definition: CFeature.h:58
TInternalFeatList::const_reverse_iterator const_reverse_iterator
Definition: CFeature.h:370
Non-defined feature (also used for Occupancy features)
TFeatureID ID
ID of the feature.
Definition: CFeature.h:62
EIGEN_STRONG_INLINE bool empty() const
const_reverse_iterator rend() const
Definition: CFeature.h:379
uint8_t descriptorORBDistanceTo(const CFeature &oFeature) const
Computes the Hamming distance "this" and the "other" descriptor ORB descriptor.
Definition: CFeature.cpp:841
unsigned __int16 uint16_t
Definition: rptypes.h:44
float descriptorSpinImgDistanceTo(const CFeature &oFeature, bool normalize_distances=true) const
Computes the Euclidean Distance between "this" and the "other" descriptors.
Definition: CFeature.cpp:637
bool hasDescriptorBLD() const
Whether this feature has this kind of descriptor.
Definition: CFeature.h:170
uint16_t nTimesSeen
(this has not a predefined meaning)
Definition: CFeature.h:77
float scale
Feature scale into the scale space.
Definition: CFeature.h:74
Used in some methods to mean "any of the present descriptors".
std::vector< uint8_t > BLD
BLD feature descriptor.
Definition: CFeature.h:135
void loadFromTextFile(const std::string &fileName)
Save feature list to a text file.
Definition: CFeature.cpp:1113
The virtual base class which provides a unified interface for all persistent objects in MRPT...
Definition: CSerializable.h:44
A class for storing images as grayscale or RGB bitmaps.
Definition: CImage.h:118
bool hasDescriptorLogPolarImg() const
Whether this feature has this kind of descriptor.
Definition: CFeature.h:154
void setRightMaxID(const TFeatureID &rightID)
Definition: CFeature.h:537
TFeatureTrackStatus track_status
featKLT, featHarris, featSURF, featBeacon
Definition: CFeature.h:69
reverse_iterator rend()
Definition: CFeature.h:377
std::vector< CFeature::Ptr > TInternalFeatList
Definition: CFeature.h:308
void setFeatureX(size_t i, float x)
Definition: CFeature.h:479
size_t size() const
Definition: CFeature.h:387
void dumpToConsole() const
Definition: CFeature.cpp:381
float x2[2]
last time.
Definition: CFeature.h:85
float descriptorSIFTDistanceTo(const CFeature &oFeature, bool normalize_distances=true) const
Computes the Euclidean Distance between "this" and the "other" descriptors.
Definition: CFeature.cpp:585
TFeatureID getFeatureID(size_t i) const
Definition: CFeature.h:464
Scalar * iterator
Definition: eigen_plugins.h:26
float getFeatureY(size_t i) const
Definition: CFeature.h:463
float descriptorSURFDistanceTo(const CFeature &oFeature, bool normalize_distances=true) const
Computes the Euclidean Distance between "this" and the "other" descriptors.
Definition: CFeature.cpp:610
float getScale(size_t i) const
Definition: CFeature.h:473
uint16_t nTimesLastSeen
sequence of images.
Definition: CFeature.h:81
void setFeatureResponse(size_t i, float r)
Definition: CFeature.h:484
void getByMultiIDs(const std::vector< TFeatureID > &IDs, std::vector< CFeature::Ptr > &out, std::vector< int > &outIndex) const
Get a vector of references to a subset of features from their IDs.
Definition: CFeature.cpp:1278
EIGEN_STRONG_INLINE iterator begin()
Definition: eigen_plugins.h:29
void setMaxIDs(const TFeatureID &leftID, const TFeatureID &rightID)
Definition: CFeature.h:541
bool isPointFeature(size_t i) const
Definition: CFeature.h:469
std::vector< float > SURF
SURF feature descriptor.
Definition: CFeature.h:113
std::deque< double > multiScales
A set of scales where the.
Definition: CFeature.h:93
TInternalFeatList::const_iterator const_iterator
Definition: CFeature.h:367
const_iterator begin() const
Definition: CFeature.h:374
const Scalar * const_iterator
Definition: eigen_plugins.h:27
TFeatureType get_type() const
Get the type of the feature.
Definition: CFeature.h:277
mrpt::math::CMatrix LogPolarImg
A log-polar image centered at the interest point.
Definition: CFeature.h:122
float y
Coordinates in the image.
Definition: CFeature.h:61
void setTrackStatus(size_t i, TFeatureTrackStatus s)
Definition: CFeature.h:489
GLdouble s
Definition: glext.h:3676
bool hasDescriptorMultiSIFT() const
Whether this feature has this kind of descriptor.
Definition: CFeature.h:158
float kdtree_distance(const float *p1, const size_t idx_p2, size_t size) const
Returns the distance between the vector "p1[0:size-1]" and the data point with index "idx_p2" stored ...
Definition: CFeature.h:434
const_reverse_iterator rbegin() const
Definition: CFeature.h:378
TInternalFeatList m_feats
The actual container with the list of features.
Definition: CFeature.h:311
unsigned char uint8_t
Definition: rptypes.h:41
A generic adaptor class for providing Nearest Neighbor (NN) lookup via the nanoflann library...
Definition: KDTreeCapable.h:81
void setFeatureY(size_t i, float y)
Definition: CFeature.h:481
reverse_iterator rbegin()
Definition: CFeature.h:376
const_iterator end() const
Definition: CFeature.h:375
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
Definition: CStream.h:41
bool polarImgsNoRotation
If set to true (manually, default=false)
Definition: CFeature.h:123
TFeatureType type
be an odd number)
Definition: CFeature.h:67
double depth
The estimated depth in 3D of this feature wrt the camera.
Definition: CFeature.h:87
void getBothFeatureLists(CFeatureList &list1, CFeatureList &list2)
Returns the matching features as two separate CFeatureLists.
Definition: CFeature.cpp:1425
void saveToTextFile(const std::string &filename, bool APPEND=false)
Save the feature to a text file in this format: "%% Dump of mrpt::vision::CFeatureList. Each line format is:\n" "%% ID TYPE X Y ORIENTATION SCALE TRACK_STATUS RESPONSE HAS_SIFT [SIFT] HAS_SURF [SURF] HAS_MULTI [MULTI_i] HAS_ORB [ORB]" "%% |---------------------- feature ------------------| |---------------------- descriptors ------------------------|" "%% with:\n" "%% TYPE : The used detector: 0:KLT, 1: Harris, 2: BCD, 3: SIFT, 4: SURF, 5: Beacon, 6: FAST, 7: ORB\n" "%% HAS_* : 1 if a descriptor of that type is associated to the feature.
Definition: CFeature.cpp:922
void resize(size_t N)
Definition: CFeature.h:393
uint16_t nTimesNotSeen
of images.
Definition: CFeature.h:79
virtual ~CFeature()
Virtual destructor.
Definition: CFeature.h:288
#define MRPT_UNUSED_PARAM(a)
Can be used to avoid "not used parameters" warnings from the compiler.
void getMaxID(const TListIdx &idx, TFeatureID &firstListID, TFeatureID &secondListID)
Returns the maximum ID of the features in the list.
Definition: CFeature.cpp:1409
static float internal_distanceBetweenPolarImages(const mrpt::math::CMatrix &desc1, const mrpt::math::CMatrix &desc2, float &minDistAngle, bool normalize_distances, bool dont_shift_angle)
Internal function used by "descriptorLogPolarImgDistanceTo" and "descriptorPolarImgDistanceTo".
Definition: CFeature.cpp:665
GLuint index
Definition: glext.h:4054
const CFeature::Ptr & operator[](const unsigned int index) const
Definition: CFeature.h:409
CFeature::Ptr & operator[](const unsigned int index)
Definition: CFeature.h:405
std::deque< std::vector< std::vector< int32_t > > > multiHashCoeffs
orientations (there is a vector of orientations for each scale)
Definition: CFeature.h:102
std::vector< uint8_t > SIFT
SIFT feature descriptor.
Definition: CFeature.h:112
std::deque< std::vector< double > > multiOrientations
multi-resolution descriptor has been computed
Definition: CFeature.h:96
CFeature()
Constructor.
Definition: CFeature.cpp:447
All the possible descriptors this feature may have.
Definition: CFeature.h:108
Classes for computer vision, detectors, features, etc.
uint16_t SpinImg_range_rows
The number of rows (corresponding to.
Definition: CFeature.h:115
A generic 2D feature from an image, extracted with CFeatureExtraction Each feature may have one or mo...
Definition: CFeature.h:53
float descriptorLATCHDistanceTo(const CFeature &oFeature, bool normalize_distances=true) const
Computes the Euclidean Distance between "this" and the "other" descriptors.
Definition: CFeature.cpp:896
iterator erase(const iterator &it)
Definition: CFeature.h:380
uint64_t TFeatureID
Definition of a feature ID.
bool hasDescriptorORB() const
Whether this feature has this kind of descriptor.
Definition: CFeature.h:165
void saveToTextFile(const std::string &fileName)
Save list of matched features to a text file.
Definition: CFeature.cpp:1351
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
uint8_t user_flags
A field for any other flags needed by the user.
Definition: CFeature.h:75
float kdtree_get_pt(const size_t idx, int dim) const
Returns the dim&#39;th component of the idx&#39;th point in the class:
Definition: CFeature.h:423
TDescriptorType
The bitwise OR combination of values of TDescriptorType are used in CFeatureExtraction::computeDescri...
void mark_as_outdated() const
Definition: CFeature.h:494
mrpt::math::TPoint3D p3D
camera that took its image
Definition: CFeature.h:92
TInternalFeatList::reverse_iterator reverse_iterator
Definition: CFeature.h:369
void dumpToTextStream(mrpt::utils::CStream &out) const
Dump feature information into a text stream.
Definition: CFeature.cpp:247
CFeature::Ptr getByID(const TFeatureID &ID, const TListIdx &idx)
Returns a smart pointer to the feature with the provided ID or a empty one if not found...
Definition: CFeature.cpp:1373
#define MRPT_DECLARE_TTYPENAME_PTR_NAMESPACE(_TYPE, __NS)
Definition: TTypeName.h:93
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.
float getFeatureResponse(size_t i) const
Definition: CFeature.h:465
bool hasDescriptorLATCH() const
Whether this feature has this kind of descriptor.
Definition: CFeature.h:174
CFeature::Ptr nearest(const float x, const float y, double &max_dist) const
Get a reference to the nearest feature to the a given 2D point (version returning distance to closest...
Definition: CFeature.cpp:1299
struct mrpt::vision::CFeature::TDescriptors descriptors
void saveToTextFile(const std::string &fileName, bool APPEND=false)
Save feature list to a text file.
Definition: CFeature.cpp:1035
float response
process (old name: KLT_status)
Definition: CFeature.h:71
virtual ~CFeatureList()
Virtual destructor.
Definition: CFeature.cpp:1029
bool getFirstDescriptorAsMatrix(mrpt::math::CMatrixFloat &desc) const
Return the first found descriptor, as a matrix.
Definition: CFeature.cpp:1445
CFeatureList()
Constructor.
Definition: CFeature.cpp:1025
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
#define ASSERTDEB_(f)
Defines an assertion mechanism - only when compiled in debug.
GLdouble GLdouble GLdouble r
Definition: glext.h:3705
void setFeatureID(size_t i, TFeatureID id)
Definition: CFeature.h:483
std::vector< float > SpinImg
The 2D histogram as a single row.
Definition: CFeature.h:114
float descriptorPolarImgDistanceTo(const CFeature &oFeature, float &minDistAngle, bool normalize_distances=true) const
Returns the minimum Euclidean Distance between "this" and the "other" polar image descriptor...
Definition: CFeature.cpp:784
void kdtree_mark_as_outdated() const
To be called by child classes when KD tree data changes.
bool kdtree_get_bbox(BBOX &bb) const
Definition: CFeature.h:452
GLuint id
Definition: glext.h:3909
std::vector< uint8_t > LATCH
LATCH feature descriptor.
Definition: CFeature.h:136
void setLeftMaxID(const TFeatureID &leftID)
Explicitly set the max IDs values to certain values.
Definition: CFeature.h:536
float patchCorrelationTo(const CFeature &oFeature) const
Computes the normalized cross-correlation between the patches of this and another feature (normalized...
Definition: CFeature.cpp:495
virtual ~CMatchedFeatureList()
Virtual destructor.
Definition: CFeature.cpp:1347
TFeatureID getMaxID() const
Get the maximum ID into the list.
Definition: CFeature.cpp:1324
TInternalFeatList::iterator iterator
Definition: CFeature.h:366
GLenum GLint GLint y
Definition: glext.h:3538
void setFeatureYf(size_t i, float y)
Definition: CFeature.h:482
void setFeatureXf(size_t i, float x)
Definition: CFeature.h:480
void setScale(size_t i, float s)
Definition: CFeature.h:488
float y2[2]
Coordinates for a LSD Detector to represent a line.
Definition: CFeature.h:85
mrpt::utils::CImage patch
A patch of the image surrounding the feature.
Definition: CFeature.h:64
bool hasDescriptorPolarImg() const
Whether this feature has this kind of descriptor.
Definition: CFeature.h:150
GLsizeiptr size
Definition: glext.h:3923
float orientation
KLT_val)
Definition: CFeature.h:73
GLenum GLint x
Definition: glext.h:3538
TFeatureType get_type() const
The type of the first feature in the list.
Definition: CFeature.h:315
Lightweight 3D point.
float descriptorLogPolarImgDistanceTo(const CFeature &oFeature, float &minDistAngle, bool normalize_distances=true) const
Returns the minimum Euclidean Distance between "this" and the "other" log-polar image descriptor...
Definition: CFeature.cpp:811
This class is a "CSerializable" wrapper for "CMatrixFloat".
Definition: CMatrix.h:25
float descriptorBLDDistanceTo(const CFeature &oFeature, bool normalize_distances=true) const
Computes the Euclidean Distance between "this" and the "other" descriptors.
Definition: CFeature.cpp:871
uint16_t patchSize
Size of the patch (patchSize x patchSize) (it must.
Definition: CFeature.h:65
void mark_kdtree_as_outdated() const
Call this when the list of features has been modified so the KD-tree is marked as outdated...
Definition: CFeature.h:363
std::deque< std::vector< std::vector< int32_t > > > multiSIFTDescriptors
the call to "descriptorDistanceTo" will not consider all the rotations between polar image descriptor...
Definition: CFeature.h:129
CFeature::Ptr getByID(const TFeatureID &ID) const
Get a reference to a Feature from its ID.
Definition: CFeature.cpp:1251
double initialDepth
in the current frame
Definition: CFeature.h:89
float getFeatureX(size_t i) const
Definition: CFeature.h:462
mrpt::math::CMatrix PolarImg
range bins in the 2D histogram) of the original matrix from which SpinImg was extracted as a vector...
Definition: CFeature.h:120
void copyListFrom(const CFeatureList &otherList)
Copies the content of another CFeatureList inside this one.
Definition: CFeature.cpp:1235
void push_back(const CFeature::Ptr &f)
Definition: CFeature.h:399
TFeatureTrackStatus getTrackStatus(size_t i)
Definition: CFeature.h:474
bool isPointFeature() const
a HASH table of descriptors
Definition: CFeature.cpp:487
TFeatureType get_type() const
The type of the first feature in the list.
Definition: CFeature.h:509
bool hasDescriptorSURF() const
Whether this feature has this kind of descriptor.
Definition: CFeature.h:142
size_t kdtree_get_point_count() const
Must return the number of data points.
Definition: CFeature.h:421
A list of features.
Definition: CFeature.h:504
std::vector< uint8_t > ORB
orientation and scale of the multiResolution feature (there is a vector of descriptors for each scale...
Definition: CFeature.h:133



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