MRPT  2.0.4
CFeature.h
Go to the documentation of this file.
1 /* +---------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | https://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2020, Individual contributors, see AUTHORS file |
6  | See: https://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in https://www.mrpt.org/License |
8  +---------------------------------------------------------------------------+
9  */
10 #pragma once
11 
12 #include <mrpt/img/CImage.h>
13 #include <mrpt/math/CMatrixF.h>
15 #include <mrpt/vision/TKeyPoint.h>
16 #include <mrpt/vision/types.h>
17 #include <optional>
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, TKeyPoint, TKeyPointList
52  */
54 {
55  friend class CFeatureList;
56  friend class CMatchedFeatureList;
57 
59 
60  public:
61  CFeature() = default;
62  ~CFeature() override = default;
63 
65 
66  /** A patch of the image surrounding the feature */
67  std::optional<mrpt::img::CImage> patch;
68 
69  /** Size of the patch (patchSize x patchSize) (it must be an odd number) */
70  uint16_t patchSize{21};
71 
72  /** Keypoint method used to detect this feature */
74 
75  /** Status of the feature tracking process */
77 
78  /** A measure of the "goodness" of the feature */
79  float response{0.0};
80 
81  float orientation{0.0}; //!< Main orientation of the feature
82  // Scale: replaced by keypoint.octave ==> float scale{0};
83 
84  /** A field for any other flags needed by the user (this has not a
85  * predefined meaning) */
86  uint8_t user_flags{0};
87 
88  // # added by Raghavender Sahdev
89  float x2[2], y2[2]; //!< Coordinates for a LSD Detector to represent a line
90 
91  double depth{
92  0}; //!< The estimated depth in 3D of this feature wrt the camera
93  //! in the current frame
94  //!
95  double initialDepth{
96  0}; //!< The estimated depth in 3D of this feature wrt the
97  //! camera that took its image
99  p3D; //!< The estimated 3D point of this feature wrt its camera
100 
101  /** Return false only for Blob detectors (SIFT, SURF) */
102  bool isPointFeature() const;
103 
104  /** All the possible descriptors this feature may have */
105  struct TDescriptors
106  {
107  TDescriptors() = default;
108 
109  /** SIFT feature descriptor */
110  std::optional<std::vector<uint8_t>> SIFT;
111 
112  /** SURF feature descriptor */
113  std::optional<std::vector<float>> SURF;
114 
115  /** The 2D histogram as a single row */
116  std::optional<std::vector<float>> SpinImg;
117 
118  /** The number of rows (corresponding to range bins in the 2D histogram)
119  * of the original matrix from which SpinImg was extracted as a vector.
120  */
121  uint16_t SpinImg_range_rows{0};
122 
123  /** A polar image centered at the interest point */
124  std::optional<mrpt::math::CMatrixF> PolarImg;
125 
126  /** A log-polar image centered at the interest point */
127  std::optional<mrpt::math::CMatrixF> LogPolarImg;
128 
129  /** If set to true (default=false) the call to "descriptorDistanceTo"
130  * will not consider all the rotations between polar image descriptors
131  * (PolarImg, LogPolarImg) */
132  bool polarImgsNoRotation{false};
133 
134  /** ORB feature descriptor */
135  std::optional<std::vector<uint8_t>> ORB;
136 
137  // added by Raghavender Sadev
138  /** BLD feature descriptor */
139  std::optional<std::vector<uint8_t>> BLD;
140  /** LATCH feature descriptor */
141  std::optional<std::vector<uint8_t>> LATCH;
142 
143  bool hasDescriptorSIFT() const { return SIFT.has_value(); }
144  bool hasDescriptorSURF() const { return SURF.has_value(); }
145  bool hasDescriptorSpinImg() const { return SpinImg.has_value(); }
146  bool hasDescriptorPolarImg() const { return PolarImg.has_value(); }
148  {
149  return LogPolarImg.has_value();
150  }
151 
152  bool hasDescriptorORB() const { return ORB.has_value(); }
153  bool hasDescriptorBLD() const { return BLD.has_value(); }
154  bool hasDescriptorLATCH() const { return LATCH.has_value(); }
155  };
156 
158 
159  /** Return the first found descriptor, as a matrix.
160  * \return false on error, i.e. there is no valid descriptor.
161  */
163 
164  /** Computes the normalized cross-correlation between the patches of this
165  * and another feature (normalized in the range [0,1], such as 0=best,
166  * 1=worst).
167  * \note If this or the other features does not have patches or they are
168  * of different sizes, an exception will be raised.
169  * \sa descriptorDistanceTo
170  */
171  float patchCorrelationTo(const CFeature& oFeature) const;
172 
173  /** Computes the Euclidean Distance between this feature's and other
174  * feature's descriptors, using the given descriptor or the first present
175  * one.
176  * \note If descriptorToUse is not descAny and that descriptor is not
177  * present in one of the features, an exception will be raised.
178  * \sa patchCorrelationTo
179  */
180  float descriptorDistanceTo(
181  const CFeature& oFeature, TDescriptorType descriptorToUse = descAny,
182  bool normalize_distances = true) const;
183 
184  /** Computes the Euclidean Distance between "this" and the "other"
185  * descriptors */
187  const CFeature& oFeature, bool normalize_distances = true) const;
188 
189  /** Computes the Euclidean Distance between "this" and the "other"
190  * descriptors */
192  const CFeature& oFeature, bool normalize_distances = true) const;
193 
194  /** Computes the Euclidean Distance between "this" and the "other"
195  * descriptors */
197  const CFeature& oFeature, bool normalize_distances = true) const;
198 
199  /** Returns the minimum Euclidean Distance between "this" and the "other"
200  * polar image descriptor, for the best shift in orientation.
201  * \param oFeature The other feature to compare with.
202  * \param minDistAngle The placeholder for the angle at which the smallest
203  * distance is found.
204  * \return The distance for the best orientation (minimum distance).
205  */
207  const CFeature& oFeature, float& minDistAngle,
208  bool normalize_distances = true) const;
209 
210  /** Returns the minimum Euclidean Distance between "this" and the "other"
211  * log-polar image descriptor, for the best shift in orientation.
212  * \param oFeature The other feature to compare with.
213  * \param minDistAngle The placeholder for the angle at which the smallest
214  * distance is found.
215  * \return The distance for the best orientation (minimum distance).
216  */
218  const CFeature& oFeature, float& minDistAngle,
219  bool normalize_distances = true) const;
220 
221  /** Computes the Hamming distance "this" and the "other" descriptor ORB
222  * descriptor */
223  uint8_t descriptorORBDistanceTo(const CFeature& oFeature) const;
224 
225  // # added by Raghavender Sahdev
226  /** Computes the Euclidean Distance between "this" and the "other"
227  * descriptors */
229  const CFeature& oFeature, bool normalize_distances = true) const;
230  /** Computes the Euclidean Distance between "this" and the "other"
231  * descriptors */
233  const CFeature& oFeature, bool normalize_distances = true) const;
234 
235  /** Save the feature to a text file in this format:
236  * "%% Dump of mrpt::vision::CFeatureList. Each line format is:\n"
237  * "%% ID TYPE X Y ORIENTATION SCALE TRACK_STATUS RESPONSE HAS_SIFT
238  *[SIFT] HAS_SURF [SURF] HAS_MULTI [MULTI_i] HAS_ORB [ORB]"
239  * "%% |---------------------- feature ------------------|
240  *|---------------------- descriptors ------------------------|"
241  * "%% with:\n"
242  * "%% TYPE : The used detector: 0:KLT, 1: Harris, 2: BCD, 3: SIFT, 4:
243  *SURF, 5: Beacon, 6: FAST, 7: ORB\n"
244  * "%% HAS_* : 1 if a descriptor of that type is associated to the
245  *feature."
246  * "%% SIFT : Present if HAS_SIFT=1: N DESC_0 ... DESC_N-1"
247  * "%% SURF : Present if HAS_SURF=1: N DESC_0 ... DESC_N-1"
248  * "%% MULTI : Present if HAS_MULTI=1: SCALE ORI N DESC_0 ... DESC_N-1"
249  * "%% ORB : Present if HAS_ORB=1: DESC_0 ... DESC_31
250  * "%%-----------------------------------------------------------------------------\n");
251  */
252  void saveToTextFile(const std::string& filename, bool APPEND = false);
253 
254  /** Get the type of the feature
255  */
256  TKeyPointMethod get_type() const { return type; }
257  /** Dump feature information into a text stream */
258  void dumpToTextStream(std::ostream& out) const;
259 
260  void dumpToConsole() const;
261 
262  protected:
263  /** Internal function used by "descriptorLogPolarImgDistanceTo" and
264  * "descriptorPolarImgDistanceTo"
265  */
267  const mrpt::math::CMatrixF& desc1, const mrpt::math::CMatrixF& desc2,
268  float& minDistAngle, bool normalize_distances, bool dont_shift_angle);
269 
270 }; // end of class
271 
272 /** A list of visual features, to be used as output by detectors, as
273  * input/output by trackers, etc.
274  */
275 class CFeatureList : public mrpt::math::KDTreeCapable<CFeatureList>
276 {
277  protected:
278  using TInternalFeatList = std::vector<CFeature>;
279 
280  /** The actual container with the list of features */
282 
283  public:
284  /** The type of the first feature in the list */
285  inline TKeyPointMethod get_type() const
286  {
287  return empty() ? featNotDefined : (*begin()).get_type();
288  }
289 
290  /** Save feature list to a text file */
291  void saveToTextFile(const std::string& fileName, bool APPEND = false);
292 
293  /** Save feature list to a text file */
294  void loadFromTextFile(const std::string& fileName);
295 
296  /** Copies the content of another CFeatureList inside this one. The inner
297  * features are also copied. */
298  void copyListFrom(const CFeatureList& otherList);
299 
300  /** Get the maximum ID into the list */
301  TFeatureID getMaxID() const;
302 
303  /** Get a reference to a Feature from its ID */
304  const CFeature* getByID(const TFeatureID& ID) const;
305  const CFeature* getByID(const TFeatureID& ID, int& out_idx) const;
306 
307  /** Get a reference to the nearest feature to the a given 2D point (version
308  * returning distance to closest feature in "max_dist")
309  * \param x [IN] The query point x-coordinate
310  * \param y [IN] The query point y-coordinate
311  * \param max_dist [IN/OUT] At input: The maximum distance to search for.
312  * At output: The actual distance to the feature.
313  * \return A pointer to the found feature, or nullptr if not found.
314  * \note See also all the available KD-tree search methods, listed in
315  * mrpt::math::KDTreeCapable
316  */
317  const CFeature* nearest(
318  const float x, const float y, double& max_dist) const;
319 
320  /** Constructor */
321  CFeatureList() = default;
322 
323  /** Virtual destructor */
324  virtual ~CFeatureList();
325 
326  /** Call this when the list of features has been modified so the KD-tree is
327  * marked as outdated. */
329  /** @name Method and datatypes to emulate a STL container
330  @{ */
331  using iterator = TInternalFeatList::iterator;
332  using const_iterator = TInternalFeatList::const_iterator;
333 
334  using reverse_iterator = TInternalFeatList::reverse_iterator;
335  using const_reverse_iterator = TInternalFeatList::const_reverse_iterator;
336 
337  inline iterator begin() { return m_feats.begin(); }
338  inline iterator end() { return m_feats.end(); }
339  inline const_iterator begin() const { return m_feats.begin(); }
340  inline const_iterator end() const { return m_feats.end(); }
341  inline reverse_iterator rbegin() { return m_feats.rbegin(); }
342  inline reverse_iterator rend() { return m_feats.rend(); }
343  inline const_reverse_iterator rbegin() const { return m_feats.rbegin(); }
344  inline const_reverse_iterator rend() const { return m_feats.rend(); }
345  inline iterator erase(const iterator& it)
346  {
348  return m_feats.erase(it);
349  }
350 
351  inline bool empty() const { return m_feats.empty(); }
352  inline size_t size() const { return m_feats.size(); }
353  inline void clear()
354  {
355  m_feats.clear();
357  }
358  inline void resize(size_t N)
359  {
360  m_feats.resize(N);
362  }
363 
364  inline void emplace_back(CFeature&& f)
365  {
367  m_feats.emplace_back(std::move(f));
368  }
369  inline void push_back(const CFeature& f)
370  {
372  m_feats.push_back(f);
373  }
374 
375  inline CFeature& operator[](const unsigned int index)
376  {
377  return m_feats[index];
378  }
379  inline const CFeature& operator[](const unsigned int index) const
380  {
381  return m_feats[index];
382  }
383 
384  /** @} */
385 
386  /** @name Methods that MUST be implemented by children classes of
387  KDTreeCapable
388  @{ */
389 
390  /// Must return the number of data points
391  inline size_t kdtree_get_point_count() const { return this->size(); }
392  /// Returns the dim'th component of the idx'th point in the class:
393  inline float kdtree_get_pt(const size_t idx, int dim) const
394  {
395  ASSERTDEB_(dim == 0 || dim == 1);
396  if (dim == 0)
397  return m_feats[idx].keypoint.pt.x;
398  else
399  return m_feats[idx].keypoint.pt.y;
400  }
401 
402  /// Returns the distance between the vector "p1[0:size-1]" and the data
403  /// point with index "idx_p2" stored in the class:
404  inline float kdtree_distance(
405  const float* p1, const size_t idx_p2,
406  [[maybe_unused]] size_t size) const
407  {
408  ASSERTDEB_(size == 2);
409 
410  const float d0 = p1[0] - m_feats[idx_p2].keypoint.pt.x;
411  const float d1 = p1[1] - m_feats[idx_p2].keypoint.pt.y;
412  return d0 * d0 + d1 * d1;
413  }
414 
415  // Optional bounding-box computation: return false to default to a standard
416  // bbox computation loop.
417  // Return true if the BBOX was already computed by the class and returned
418  // in "bb" so it can be avoided to redo it again.
419  // Look at bb.size() to find out the expected dimensionality (e.g. 2 or 3
420  // for point clouds)
421  template <typename BBOX>
422  bool kdtree_get_bbox([[maybe_unused]] BBOX& bb) const
423  {
424  return false;
425  }
426 
427  /** @} */
428 
429  /** @name getFeature*() methods for template-based access to feature list
430  @{ */
431  inline float getFeatureX(size_t i) const
432  {
433  return m_feats[i].keypoint.pt.x;
434  }
435  inline float getFeatureY(size_t i) const
436  {
437  return m_feats[i].keypoint.pt.y;
438  }
439  inline TFeatureID getFeatureID(size_t i) const
440  {
441  return m_feats[i].keypoint.ID;
442  }
443  inline float getFeatureResponse(size_t i) const
444  {
445  return m_feats[i].keypoint.response;
446  }
447  inline bool isPointFeature(size_t i) const
448  {
449  return m_feats[i].isPointFeature();
450  }
451  inline float getScale(size_t i) const { return m_feats[i].keypoint.octave; }
453  {
454  return m_feats[i].keypoint.track_status;
455  }
456 
457  inline void setFeatureX(size_t i, float x) { m_feats[i].keypoint.pt.x = x; }
458  inline void setFeatureXf(size_t i, float x)
459  {
460  m_feats[i].keypoint.pt.x = x;
461  }
462  inline void setFeatureY(size_t i, float y) { m_feats[i].keypoint.pt.y = y; }
463  inline void setFeatureYf(size_t i, float y)
464  {
465  m_feats[i].keypoint.pt.y = y;
466  }
467  inline void setFeatureID(size_t i, TFeatureID id)
468  {
469  m_feats[i].keypoint.ID = id;
470  }
471  inline void setFeatureResponse(size_t i, float r)
472  {
473  m_feats[i].keypoint.response = r;
474  }
475  inline void setScale(size_t i, uint8_t s)
476  {
477  m_feats[i].keypoint.octave = s;
478  }
479  inline void setTrackStatus(size_t i, TFeatureTrackStatus s)
480  {
481  m_feats[i].keypoint.track_status = s;
482  }
483 
484  inline void mark_as_outdated() const { kdtree_mark_as_outdated(); }
485  /** @} */
486 
487 }; // end of class
488 
489 /****************************************************
490  Class CMATCHEDFEATURELIST
491 *****************************************************/
492 /** A list of features
493  */
494 class CMatchedFeatureList : public std::deque<std::pair<CFeature, CFeature>>
495 {
496  public:
497  /** The type of the first feature in the list */
498  inline TKeyPointMethod get_type() const
499  {
500  return empty() ? featNotDefined : begin()->first.get_type();
501  }
502 
503  /** Save list of matched features to a text file */
504  void saveToTextFile(const std::string& fileName);
505 
506  /** Returns the matching features as two separate CFeatureLists */
507  void getBothFeatureLists(CFeatureList& list1, CFeatureList& list2);
508 
509  /** Returns a smart pointer to the feature with the provided ID or a empty
510  * one if not found */
511  const CFeature* getByID(const TFeatureID& ID, const TListIdx& idx);
512 
513  /** Returns the maximum ID of the features in the list. If the max ID has
514  been already set up, this method just returns it.
515  Otherwise, this method finds, stores and returns it.*/
516  void getMaxID(
517  const TListIdx& idx, TFeatureID& firstListID, TFeatureID& secondListID);
518 
519  /** Updates the value of the maximum ID of the features in the matched list,
520  * i.e. it explicitly searches for the max ID and updates the member
521  * variables. */
522  void updateMaxID(const TListIdx& idx);
523 
524  /** Explicitly set the max IDs values to certain values */
525  inline void setLeftMaxID(const TFeatureID& leftID) { m_leftMaxID = leftID; }
526  inline void setRightMaxID(const TFeatureID& rightID)
527  {
528  m_rightMaxID = rightID;
529  }
530  inline void setMaxIDs(const TFeatureID& leftID, const TFeatureID& rightID)
531  {
532  setLeftMaxID(leftID);
533  setRightMaxID(rightID);
534  }
535 
536  CMatchedFeatureList() = default;
537  virtual ~CMatchedFeatureList() = default;
538 
539  protected:
541 }; // end of class
542 
543 /** @} */ // End of add to module: mrptvision_features
544 
545 } // namespace vision
546 
547 namespace typemeta
548 {
549 // Specialization must occur in the same namespace
551 } // namespace typemeta
552 } // namespace mrpt
mrpt::vision::CFeatureList::size
size_t size() const
Definition: CFeature.h:352
mrpt::vision::CFeature::TDescriptors::hasDescriptorPolarImg
bool hasDescriptorPolarImg() const
Definition: CFeature.h:148
mrpt::vision::CFeatureList::operator[]
const CFeature & operator[](const unsigned int index) const
Definition: CFeature.h:379
mrpt::vision::TKeyPoint_templ< mrpt::img::TPixelCoordf >
mrpt::vision::CFeatureList::setFeatureYf
void setFeatureYf(size_t i, float y)
Definition: CFeature.h:463
mrpt::vision::CFeatureList::getFeatureID
TFeatureID getFeatureID(size_t i) const
Definition: CFeature.h:439
mrpt::vision::CMatchedFeatureList::m_rightMaxID
TFeatureID m_rightMaxID
Definition: CFeature.h:542
mrpt::vision::CFeature::TDescriptors::hasDescriptorSURF
bool hasDescriptorSURF() const
Definition: CFeature.h:146
mrpt::vision::CFeature::user_flags
uint8_t user_flags
A field for any other flags needed by the user (this has not a predefined meaning)
Definition: CFeature.h:88
mrpt::vision::CFeature::TDescriptors::LATCH
std::optional< std::vector< uint8_t > > LATCH
LATCH feature descriptor.
Definition: CFeature.h:143
mrpt::vision::CFeatureList::setFeatureID
void setFeatureID(size_t i, TFeatureID id)
Definition: CFeature.h:467
mrpt::vision::bothLists
@ bothLists
Definition: CFeature.h:30
mrpt::vision::CMatchedFeatureList::setMaxIDs
void setMaxIDs(const TFeatureID &leftID, const TFeatureID &rightID)
Definition: CFeature.h:532
mrpt::vision::CFeatureList::get_type
TKeyPointMethod get_type() const
The type of the first feature in the list.
Definition: CFeature.h:285
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:776
mrpt::math::TPoint3D_< double >
DEFINE_SERIALIZABLE
#define DEFINE_SERIALIZABLE(class_name, NS)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
Definition: CSerializable.h:152
mrpt::vision::CFeature::TDescriptors::SpinImg
std::optional< std::vector< float > > SpinImg
The 2D histogram as a single row.
Definition: CFeature.h:118
mrpt::vision::CFeatureList::getScale
float getScale(size_t i) const
Definition: CFeature.h:451
mrpt::vision::CFeature::p3D
mrpt::math::TPoint3D p3D
camera that took its image
Definition: CFeature.h:101
mrpt::vision::CFeature::descriptors
TDescriptors descriptors
Definition: CFeature.h:159
mrpt::vision::CFeature::TDescriptors::hasDescriptorSIFT
bool hasDescriptorSIFT() const
Definition: CFeature.h:145
mrpt::vision::CFeatureList::setFeatureY
void setFeatureY(size_t i, float y)
Definition: CFeature.h:462
mrpt::vision::CFeatureList::const_iterator
TInternalFeatList::const_iterator const_iterator
Definition: CFeature.h:332
mrpt::vision::CFeature::TDescriptors::BLD
std::optional< std::vector< uint8_t > > BLD
BLD feature descriptor.
Definition: CFeature.h:141
mrpt::vision::CFeatureList::reverse_iterator
TInternalFeatList::reverse_iterator reverse_iterator
Definition: CFeature.h:334
mrpt::vision::TListIdx
TListIdx
Definition: CFeature.h:26
mrpt::vision::CFeature::response
float response
A measure of the "goodness" of the feature.
Definition: CFeature.h:81
mrpt::vision::CFeatureList::begin
const_iterator begin() const
Definition: CFeature.h:339
mrpt::vision::CFeatureList::getFeatureResponse
float getFeatureResponse(size_t i) const
Definition: CFeature.h:443
mrpt::vision
Copyright (C) 2010 Hauke Strasdat Imperial College London Copyright (c) 2005-2020,...
Definition: bundle_adjustment.h:35
mrpt::vision::CFeature::getFirstDescriptorAsMatrix
bool getFirstDescriptorAsMatrix(mrpt::math::CMatrixFloat &desc) const
Return the first found descriptor, as a matrix.
Definition: CFeature.cpp:1241
mrpt::vision::CFeatureList::getByID
const CFeature * getByID(const TFeatureID &ID) const
Get a reference to a Feature from its ID.
Definition: CFeature.cpp:1086
mrpt::vision::CFeature::get_type
TKeyPointMethod get_type() const
Get the type of the feature.
Definition: CFeature.h:258
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:372
mrpt::vision::CMatchedFeatureList::CMatchedFeatureList
CMatchedFeatureList()=default
mrpt::vision::CFeatureList::setFeatureX
void setFeatureX(size_t i, float x)
Definition: CFeature.h:457
mrpt::containers::empty
bool empty() const
Definition: ts_hash_map.h:191
mrpt::vision::CFeatureList::setFeatureXf
void setFeatureXf(size_t i, float x)
Definition: CFeature.h:458
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:662
mrpt::vision::CFeatureList::iterator
TInternalFeatList::iterator iterator
Definition: CFeature.h:331
mrpt::vision::CFeature::TDescriptors::ORB
std::optional< std::vector< uint8_t > > ORB
ORB feature descriptor.
Definition: CFeature.h:137
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:1206
out
mrpt::vision::TStereoCalibResults out
Definition: chessboard_stereo_camera_calib_unittest.cpp:25
TKeyPoint.h
mrpt::math::KDTreeCapable
A generic adaptor class for providing Nearest Neighbor (NN) lookup via the nanoflann library.
Definition: KDTreeCapable.h:83
mrpt
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Definition: BaseAppDataSource.h:15
mrpt::vision::CFeature::TDescriptors::hasDescriptorSpinImg
bool hasDescriptorSpinImg() const
Definition: CFeature.h:147
mrpt::vision::CFeatureList::emplace_back
void emplace_back(CFeature &&f)
Definition: CFeature.h:364
mrpt::vision::CFeatureList::kdtree_distance
float kdtree_distance(const float *p1, const size_t idx_p2, [[maybe_unused]] 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:404
mrpt::vision::CFeature::TDescriptors::hasDescriptorLogPolarImg
bool hasDescriptorLogPolarImg() const
Definition: CFeature.h:149
mrpt::vision::CFeatureList::begin
iterator begin()
Definition: CFeature.h:337
mrpt::vision::CFeature::TDescriptors::SpinImg_range_rows
uint16_t SpinImg_range_rows
The number of rows (corresponding to range bins in the 2D histogram) of the original matrix from whic...
Definition: CFeature.h:123
mrpt::vision::CFeature::patchSize
uint16_t patchSize
Size of the patch (patchSize x patchSize) (it must be an odd number)
Definition: CFeature.h:72
mrpt::vision::CMatchedFeatureList::get_type
TKeyPointMethod get_type() const
The type of the first feature in the list.
Definition: CFeature.h:500
mrpt::vision::CFeature::y2
float y2[2]
Coordinates for a LSD Detector to represent a line.
Definition: CFeature.h:91
mrpt::vision::CMatchedFeatureList::~CMatchedFeatureList
virtual ~CMatchedFeatureList()=default
mrpt::vision::CFeature::initialDepth
double initialDepth
in the current frame
Definition: CFeature.h:97
mrpt::vision::CFeature::orientation
float orientation
Main orientation of the feature.
Definition: CFeature.h:83
mrpt::vision::TFeatureID
uint64_t TFeatureID
Definition of a feature ID.
Definition: vision/include/mrpt/vision/types.h:24
mrpt::vision::CFeatureList
A list of visual features, to be used as output by detectors, as input/output by trackers,...
Definition: CFeature.h:275
mrpt::vision::TFeatureTrackStatus
TFeatureTrackStatus
Definition: vision/include/mrpt/vision/types.h:97
mrpt::containers::begin
const_iterator begin() const
Definition: ts_hash_map.h:240
mrpt::vision::CFeatureList::operator[]
CFeature & operator[](const unsigned int index)
Definition: CFeature.h:375
mrpt::math::CMatrixF
This class is a "CSerializable" wrapper for "CMatrixFloat".
Definition: CMatrixF.h:22
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:690
mrpt::vision::CFeatureList::rend
const_reverse_iterator rend() const
Definition: CFeature.h:344
mrpt::vision::CFeatureList::end
const_iterator end() const
Definition: CFeature.h:340
mrpt::utils::CImage
mrpt::img::CImage CImage
Definition: utils/CImage.h:5
mrpt::vision::CFeatureList::CFeatureList
CFeatureList()=default
Constructor.
mrpt::vision::CFeature::TDescriptors::hasDescriptorLATCH
bool hasDescriptorLATCH() const
Definition: CFeature.h:156
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:751
mrpt::vision::CFeatureList::~CFeatureList
virtual ~CFeatureList()
Virtual destructor.
mrpt::vision::CMatchedFeatureList
A list of features.
Definition: CFeature.h:494
mrpt::vision::status_IDLE
@ status_IDLE
Inactive (right after detection, and before being tried to track)
Definition: vision/include/mrpt/vision/types.h:101
mrpt::vision::CFeatureList::saveToTextFile
void saveToTextFile(const std::string &fileName, bool APPEND=false)
Save feature list to a text file.
Definition: CFeature.cpp:881
mrpt::vision::CFeatureList::loadFromTextFile
void loadFromTextFile(const std::string &fileName)
Save feature list to a text file.
Definition: CFeature.cpp:959
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:721
mrpt::vision::CFeatureList::empty
bool empty() const
Definition: CFeature.h:351
mrpt::vision::CFeatureList::setScale
void setScale(size_t i, uint8_t s)
Definition: CFeature.h:475
mrpt::vision::CFeature::isPointFeature
bool isPointFeature() const
Return false only for Blob detectors (SIFT, SURF)
Definition: CFeature.cpp:364
mrpt::vision::CFeature::TDescriptors::polarImgsNoRotation
bool polarImgsNoRotation
If set to true (default=false) the call to "descriptorDistanceTo" will not consider all the rotations...
Definition: CFeature.h:134
mrpt::vision::CMatchedFeatureList::getBothFeatureLists
void getBothFeatureLists(CFeatureList &list1, CFeatureList &list2)
Returns the matching features as two separate CFeatureLists.
Definition: CFeature.cpp:1222
mrpt::vision::CFeatureList::push_back
void push_back(const CFeature &f)
Definition: CFeature.h:369
MRPT_DECLARE_TTYPENAME_PTR_NAMESPACE
#define MRPT_DECLARE_TTYPENAME_PTR_NAMESPACE(_TYPE, __NS)
Definition: TTypeName.h:142
mrpt::vision::CFeature::TDescriptors::SIFT
std::optional< std::vector< uint8_t > > SIFT
SIFT feature descriptor.
Definition: CFeature.h:112
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:328
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:394
mrpt::vision::CFeatureList::rbegin
reverse_iterator rbegin()
Definition: CFeature.h:341
mrpt::serialization::CSerializable
The virtual base class which provides a unified interface for all persistent objects in MRPT.
Definition: CSerializable.h:30
mrpt::vision::CFeatureList::kdtree_get_point_count
size_t kdtree_get_point_count() const
Must return the number of data points.
Definition: CFeature.h:391
mrpt::vision::CFeatureList::copyListFrom
void copyListFrom(const CFeatureList &otherList)
Copies the content of another CFeatureList inside this one.
Definition: CFeature.cpp:1074
mrpt::vision::CFeatureList::getTrackStatus
TFeatureTrackStatus getTrackStatus(size_t i)
Definition: CFeature.h:452
mrpt::vision::CFeatureList::getMaxID
TFeatureID getMaxID() const
Get the maximum ID into the list.
Definition: CFeature.cpp:1135
mrpt::vision::CFeatureList::erase
iterator erase(const iterator &it)
Definition: CFeature.h:345
mrpt::vision::CFeature::track_status
TFeatureTrackStatus track_status
Status of the feature tracking process.
Definition: CFeature.h:78
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:464
mrpt::vision::CFeature::TDescriptors::hasDescriptorORB
bool hasDescriptorORB() const
Definition: CFeature.h:154
mrpt::vision::CFeatureList::TInternalFeatList
std::vector< CFeature > TInternalFeatList
Definition: CFeature.h:278
mrpt::vision::CFeature::dumpToConsole
void dumpToConsole() const
Definition: CFeature.cpp:312
mrpt::vision::CFeature::x2
float x2[2]
Definition: CFeature.h:91
mrpt::vision::CMatchedFeatureList::saveToTextFile
void saveToTextFile(const std::string &fileName)
Save list of matched features to a text file.
Definition: CFeature.cpp:1149
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:519
mrpt::vision::CFeatureList::setTrackStatus
void setTrackStatus(size_t i, TFeatureTrackStatus s)
Definition: CFeature.h:479
mrpt::vision::CFeature::TDescriptors::PolarImg
std::optional< mrpt::math::CMatrixF > PolarImg
A polar image centered at the interest point.
Definition: CFeature.h:126
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:491
mrpt::vision::CFeature::TDescriptors::TDescriptors
TDescriptors()=default
mrpt::vision::CFeatureList::const_reverse_iterator
TInternalFeatList::const_reverse_iterator const_reverse_iterator
Definition: CFeature.h:335
mrpt::vision::CFeatureList::end
iterator end()
Definition: CFeature.h:338
mrpt::vision::TKeyPointMethod
TKeyPointMethod
Types of key point detectors.
Definition: vision/include/mrpt/vision/types.h:44
mrpt::vision::CFeature::type
TKeyPointMethod type
Keypoint method used to detect this feature.
Definition: CFeature.h:75
mrpt::vision::CFeatureList::nearest
const CFeature * 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:1110
mrpt::vision::TDescriptorType
TDescriptorType
The bitwise OR combination of values of TDescriptorType are used in CFeatureExtraction::computeDescri...
Definition: vision/include/mrpt/vision/types.h:76
mrpt::vision::CMatchedFeatureList::setLeftMaxID
void setLeftMaxID(const TFeatureID &leftID)
Explicitly set the max IDs values to certain values.
Definition: CFeature.h:527
mrpt::vision::CMatchedFeatureList::m_leftMaxID
TFeatureID m_leftMaxID
Definition: CFeature.h:542
mrpt::vision::CFeatureList::kdtree_get_bbox
bool kdtree_get_bbox([[maybe_unused]] BBOX &bb) const
Definition: CFeature.h:422
mrpt::vision::CMatchedFeatureList::getByID
const CFeature * 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:1171
mrpt::vision::CFeatureList::rend
reverse_iterator rend()
Definition: CFeature.h:342
mrpt::vision::CFeatureList::setFeatureResponse
void setFeatureResponse(size_t i, float r)
Definition: CFeature.h:471
mrpt::vision::firstList
@ firstList
Definition: CFeature.h:28
mrpt::vision::CFeatureList::getFeatureX
float getFeatureX(size_t i) const
Definition: CFeature.h:431
mrpt::vision::CFeature::TDescriptors::SURF
std::optional< std::vector< float > > SURF
SURF feature descriptor.
Definition: CFeature.h:115
mrpt::vision::CFeature::dumpToTextStream
void dumpToTextStream(std::ostream &out) const
Dump feature information into a text stream.
Definition: CFeature.cpp:253
mrpt::vision::CFeatureList::getFeatureY
float getFeatureY(size_t i) const
Definition: CFeature.h:435
ASSERTDEB_
#define ASSERTDEB_(f)
Defines an assertion mechanism - only when compiled in debug.
Definition: exceptions.h:190
mrpt::vision::featNotDefined
@ featNotDefined
Non-defined feature (also used for Occupancy features)
Definition: vision/include/mrpt/vision/types.h:47
CImage.h
mrpt::vision::CFeatureList::isPointFeature
bool isPointFeature(size_t i) const
Definition: CFeature.h:447
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:1186
CMatrixF.h
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:714
mrpt::vision::CFeatureList::rbegin
const_reverse_iterator rbegin() const
Definition: CFeature.h:343
mrpt::vision::CFeature::TDescriptors::hasDescriptorBLD
bool hasDescriptorBLD() const
Definition: CFeature.h:155
types.h
mrpt::vision::CFeature::TDescriptors::LogPolarImg
std::optional< mrpt::math::CMatrixF > LogPolarImg
A log-polar image centered at the interest point.
Definition: CFeature.h:129
mrpt::vision::secondList
@ secondList
Definition: CFeature.h:29
mrpt::vision::CFeature::TDescriptors
All the possible descriptors this feature may have.
Definition: CFeature.h:107
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:801
mrpt::vision::CFeature::depth
double depth
The estimated depth in 3D of this feature wrt the camera.
Definition: CFeature.h:93
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:393
mrpt::math::CMatrixDynamic
This template class provides the basic functionality for a general 2D any-size, resizable container o...
Definition: CMatrixDynamic.h:39
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::CFeature::keypoint
TKeyPointf keypoint
Definition: CFeature.h:66
mrpt::vision::CFeature::patch
std::optional< mrpt::img::CImage > patch
A patch of the image surrounding the feature.
Definition: CFeature.h:69
mrpt::vision::descAny
@ descAny
Used in some methods to mean "any of the present descriptors".
Definition: vision/include/mrpt/vision/types.h:79
mrpt::vision::CFeatureList::clear
void clear()
Definition: CFeature.h:353
mrpt::vision::CMatchedFeatureList::setRightMaxID
void setRightMaxID(const TFeatureID &rightID)
Definition: CFeature.h:528
mrpt::vision::CFeatureList::m_feats
TInternalFeatList m_feats
The actual container with the list of features.
Definition: CFeature.h:281
mrpt::vision::CFeatureList::mark_as_outdated
void mark_as_outdated() const
Definition: CFeature.h:484
mrpt::vision::CFeature::internal_distanceBetweenPolarImages
static float internal_distanceBetweenPolarImages(const mrpt::math::CMatrixF &desc1, const mrpt::math::CMatrixF &desc2, float &minDistAngle, bool normalize_distances, bool dont_shift_angle)
Internal function used by "descriptorLogPolarImgDistanceTo" and "descriptorPolarImgDistanceTo".
Definition: CFeature.cpp:547
mrpt::vision::CFeatureList::resize
void resize(size_t N)
Definition: CFeature.h:358



Page generated by Doxygen 1.8.17 for MRPT 2.0.4 at Sat Jun 27 14:00:59 UTC 2020