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



Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST