Main MRPT website > C++ reference for MRPT 1.4.0
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-2016, 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#ifndef CFeature_H
10#define CFeature_H
11
12#include <mrpt/utils/CImage.h>
13#include <mrpt/math/CMatrix.h>
15
16#include <mrpt/vision/types.h>
18
19namespace mrpt
20{
21 namespace vision
22 {
23 class CFeatureList;
24 class CMatchedFeatureList;
25
27 {
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 /****************************************************
42 Class CFEATURE
43 *****************************************************/
45
46 /** A generic 2D feature from an image, extracted with \a CFeatureExtraction
47 * Each feature may have one or more descriptors (see \a descriptors), in addition to an image patch.
48 * The (Euclidean) distance between descriptors in a pair of features can be computed with descriptorDistanceTo,
49 * while the similarity of the patches is given by patchCorrelationTo.
50 *
51 * \sa CFeatureList, TSimpleFeature, TSimpleFeatureList
52 */
53 class VISION_IMPEXP CFeature : public mrpt::utils::CSerializable
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::utils::CImage patch; //!< A patch of the image surrounding the feature
64 uint16_t patchSize; //!< Size of the patch (patchSize x patchSize) (it must be an odd number)
65 TFeatureType type; //!< Type of the feature: featNotDefined, featSIFT, featKLT, featHarris, featSURF, featBeacon
66 TFeatureTrackStatus track_status; //!< Status of the feature tracking process (old name: KLT_status)
67 float response; //!< A measure of the "goodness" of the feature (old name: KLT_val)
68 float orientation; //!< Main orientation of the feature
69 float scale; //!< Feature scale into the scale space
70 uint8_t user_flags; //!< A field for any other flags needed by the user (this has not a predefined meaning)
71 uint16_t nTimesSeen; //!< Number of frames it has been seen in a sequence of images.
72 uint16_t nTimesNotSeen; //!< Number of frames it has not been seen in a sequence of images.
73 uint16_t nTimesLastSeen; //!< Number of frames since it was seen for the last time.
74
75 double depth; //!< The estimated depth in 3D of this feature wrt the camera in the current frame
76 double initialDepth; //!< The estimated depth in 3D of this feature wrt the camera that took its image
77 mrpt::math::TPoint3D p3D; //!< The estimated 3D point of this feature wrt its camera
78 std::deque<double> multiScales; //!< A set of scales where the multi-resolution descriptor has been computed
79 std::deque<std::vector<double> > multiOrientations; //!< A vector of main orientations (there is a vector of orientations for each scale)
80 std::deque<std::vector<std::vector<int32_t> > > multiHashCoeffs; //!< A set of vectors containing the coefficients for a HASH table of descriptors
81 bool isPointFeature() const; //!< Return false only for Blob detectors (SIFT, SURF)
82
83 /** All the possible descriptors this feature may have */
85 {
86 TDescriptors(); // Initialization
87
88 std::vector<uint8_t> SIFT; //!< SIFT feature descriptor
89 std::vector<float> SURF; //!< SURF feature descriptor
90 std::vector<float> SpinImg; //!< The 2D histogram as a single row
91 uint16_t SpinImg_range_rows; //!< The number of rows (corresponding to range bins in the 2D histogram) of the original matrix from which SpinImg was extracted as a vector.
92 mrpt::math::CMatrix PolarImg; //!< A polar image centered at the interest point
93 mrpt::math::CMatrix LogPolarImg; //!< A log-polar image centered at the interest point
94 bool polarImgsNoRotation; //!< If set to true (manually, default=false) the call to "descriptorDistanceTo" will not consider all the rotations between polar image descriptors (PolarImg, LogPolarImg)
95 std::deque<std::vector<std::vector<int32_t> > > multiSIFTDescriptors; //!< A set of SIFT-like descriptors for each orientation and scale of the multiResolution feature (there is a vector of descriptors for each scale)
96 std::vector<uint8_t> ORB; //!< ORB feature descriptor
97
98 bool hasDescriptorSIFT() const { return !SIFT.empty(); }; //!< Whether this feature has this kind of descriptor
99 bool hasDescriptorSURF() const { return !SURF.empty(); } //!< Whether this feature has this kind of descriptor
100 bool hasDescriptorSpinImg() const { return !SpinImg.empty(); }; //!< Whether this feature has this kind of descriptor
101 bool hasDescriptorPolarImg() const { return PolarImg.rows()!=0; } ; //!< Whether this feature has this kind of descriptor
102 bool hasDescriptorLogPolarImg() const { return LogPolarImg.rows()!=0; } ; //!< Whether this feature has this kind of descriptor
104 return (multiSIFTDescriptors.size() > 0 && multiSIFTDescriptors[0].size() > 0); //!< Whether this feature has this kind of descriptor
105 }
106 bool hasDescriptorORB() const { return !ORB.empty(); } //!< Whether this feature has this kind of descriptor
107 }
109
110 /** Return the first found descriptor, as a matrix.
111 * \return false on error, i.e. there is no valid descriptor.
112 */
114
115 /** Computes the normalized cross-correlation between the patches of this and another feature (normalized in the range [0,1], such as 0=best, 1=worst).
116 * \note If this or the other features does not have patches or they are of different sizes, an exception will be raised.
117 * \sa descriptorDistanceTo
118 */
119 float patchCorrelationTo( const CFeature &oFeature) const;
120
121 /** Computes the Euclidean Distance between this feature's and other feature's descriptors, using the given descriptor or the first present one.
122 * \note If descriptorToUse is not descAny and that descriptor is not present in one of the features, an exception will be raised.
123 * \sa patchCorrelationTo
124 */
125 float descriptorDistanceTo( const CFeature &oFeature, TDescriptorType descriptorToUse = descAny, bool normalize_distances = true ) const;
126
127 /** Computes the Euclidean Distance between "this" and the "other" descriptors */
128 float descriptorSIFTDistanceTo( const CFeature &oFeature, bool normalize_distances = true ) const;
129
130 /** Computes the Euclidean Distance between "this" and the "other" descriptors */
131 float descriptorSURFDistanceTo( const CFeature &oFeature, bool normalize_distances = true ) const;
132
133 /** Computes the Euclidean Distance between "this" and the "other" descriptors */
134 float descriptorSpinImgDistanceTo( const CFeature &oFeature, bool normalize_distances = true ) const;
135
136 /** Returns the minimum Euclidean Distance between "this" and the "other" polar image descriptor, for the best shift in orientation.
137 * \param oFeature The other feature to compare with.
138 * \param minDistAngle The placeholder for the angle at which the smallest distance is found.
139 * \return The distance for the best orientation (minimum distance).
140 */
142 const CFeature &oFeature,
143 float &minDistAngle,
144 bool normalize_distances = true ) const;
145
146 /** Returns the minimum Euclidean Distance between "this" and the "other" log-polar image descriptor, for the best shift in orientation.
147 * \param oFeature The other feature to compare with.
148 * \param minDistAngle The placeholder for the angle at which the smallest distance is found.
149 * \return The distance for the best orientation (minimum distance).
150 */
152 const CFeature &oFeature,
153 float &minDistAngle,
154 bool normalize_distances = true ) const;
155
156 /** Computes the Hamming distance "this" and the "other" descriptor ORB descriptor */
157 uint8_t descriptorORBDistanceTo( const CFeature &oFeature ) const;
158
159 /** Save the feature to a text file in this format:
160 * "%% Dump of mrpt::vision::CFeatureList. Each line format is:\n"
161 * "%% ID TYPE X Y ORIENTATION SCALE TRACK_STATUS RESPONSE HAS_SIFT [SIFT] HAS_SURF [SURF] HAS_MULTI [MULTI_i] HAS_ORB [ORB]"
162 * "%% |---------------------- feature ------------------| |---------------------- descriptors ------------------------|"
163 * "%% with:\n"
164 * "%% TYPE : The used detector: 0:KLT, 1: Harris, 2: BCD, 3: SIFT, 4: SURF, 5: Beacon, 6: FAST, 7: ORB\n"
165 * "%% HAS_* : 1 if a descriptor of that type is associated to the feature."
166 * "%% SIFT : Present if HAS_SIFT=1: N DESC_0 ... DESC_N-1"
167 * "%% SURF : Present if HAS_SURF=1: N DESC_0 ... DESC_N-1"
168 * "%% MULTI : Present if HAS_MULTI=1: SCALE ORI N DESC_0 ... DESC_N-1"
169 * "%% ORB : Present if HAS_ORB=1: DESC_0 ... DESC_31
170 * "%%-----------------------------------------------------------------------------\n");
171 */
172 void saveToTextFile( const std::string &filename, bool APPEND = false );
173
174 /** Get the type of the feature
175 */
176 TFeatureType get_type() const { return type; }
177
178 /** Dump feature information into a text stream */
180
181 void dumpToConsole() const;
182
183 /** Constructor
184 */
186
187 /** Virtual destructor */
188 virtual ~CFeature() {}
189
190
191 protected:
192
193 /** Internal function used by "descriptorLogPolarImgDistanceTo" and "descriptorPolarImgDistanceTo"
194 */
196 const mrpt::math::CMatrix &desc1,
197 const mrpt::math::CMatrix &desc2,
198 float &minDistAngle,
199 bool normalize_distances,
200 bool dont_shift_angle );
201
202 }; // end of class
204
205
206 /****************************************************
207 Class CFEATURELIST
208 *****************************************************/
209 /** A list of visual features, to be used as output by detectors, as input/output by trackers, etc.
210 */
211 class VISION_IMPEXP CFeatureList : public mrpt::math::KDTreeCapable<CFeatureList>
212 {
213 protected:
214 typedef std::vector<CFeaturePtr> TInternalFeatList;
215
216 TInternalFeatList m_feats; //!< The actual container with the list of features
217
218 public:
219 /** The type of the first feature in the list */
220 inline TFeatureType get_type() const { return empty() ? featNotDefined : (*begin())->get_type(); }
221
222 /** Save feature list to a text file */
223 void saveToTextFile( const std::string &fileName, bool APPEND = false );
224
225 /** Save feature list to a text file */
226 void loadFromTextFile( const std::string &fileName );
227
228 /** Copies the content of another CFeatureList inside this one. The inner features are also copied. */
229 void copyListFrom( const CFeatureList &otherList );
230
231 /** Get the maximum ID into the list */
233
234 /** Get a reference to a Feature from its ID */
235 CFeaturePtr getByID( const TFeatureID &ID ) const;
236 CFeaturePtr getByID( const TFeatureID &ID, int &out_idx ) const;
237
238 /** Get a vector of references to a subset of features from their IDs */
239 void getByMultiIDs( const std::vector<TFeatureID> &IDs, std::vector<CFeaturePtr> &out, std::vector<int> &outIndex ) const;
240
241 /** Get a reference to the nearest feature to the a given 2D point (version returning distance to closest feature in "max_dist")
242 * \param x [IN] The query point x-coordinate
243 * \param y [IN] The query point y-coordinate
244 * \param max_dist [IN/OUT] At input: The maximum distance to search for. At output: The actual distance to the feature.
245 * \return A reference to the found feature, or a NULL smart pointer if none found.
246 * \note See also all the available KD-tree search methods, listed in mrpt::math::KDTreeCapable
247 */
248 CFeaturePtr nearest( const float x, const float y, double &max_dist ) const;
249
250 /** Constructor */
252
253 /** Virtual destructor */
254 virtual ~CFeatureList();
255
256 /** Call this when the list of features has been modified so the KD-tree is marked as outdated. */
257 inline void mark_kdtree_as_outdated() const { kdtree_mark_as_outdated(); }
258
259 /** @name Method and datatypes to emulate a STL container
260 @{ */
261 typedef TInternalFeatList::iterator iterator;
262 typedef TInternalFeatList::const_iterator const_iterator;
263
264 typedef TInternalFeatList::reverse_iterator reverse_iterator;
265 typedef TInternalFeatList::const_reverse_iterator const_reverse_iterator;
266
267 inline iterator begin() { return m_feats.begin(); }
268 inline iterator end() { return m_feats.end(); }
269 inline const_iterator begin() const { return m_feats.begin(); }
270 inline const_iterator end() const { return m_feats.end(); }
271
272 inline reverse_iterator rbegin() { return m_feats.rbegin(); }
273 inline reverse_iterator rend() { return m_feats.rend(); }
274 inline const_reverse_iterator rbegin() const { return m_feats.rbegin(); }
275 inline const_reverse_iterator rend() const { return m_feats.rend(); }
276
277 inline iterator erase(const iterator &it) { mark_kdtree_as_outdated(); return m_feats.erase(it); }
278
279 inline bool empty() const { return m_feats.empty(); }
280 inline size_t size() const { return m_feats.size(); }
281
282 inline void clear() { m_feats.clear(); mark_kdtree_as_outdated(); }
283 inline void resize(size_t N) { m_feats.resize(N); mark_kdtree_as_outdated(); }
284
285 inline void push_back(const CFeaturePtr &f) { mark_kdtree_as_outdated(); m_feats.push_back(f); }
286
287 inline CFeaturePtr & operator [](const unsigned int index) { return m_feats[index]; }
288 inline const CFeaturePtr & operator [](const unsigned int index) const { return m_feats[index]; }
289
290 /** @} */
291
292
293 /** @name Methods that MUST be implemented by children classes of KDTreeCapable
294 @{ */
295
296 /// Must return the number of data points
297 inline size_t kdtree_get_point_count() const { return this->size(); }
298
299 /// Returns the dim'th component of the idx'th point in the class:
300 inline float kdtree_get_pt(const size_t idx, int dim) const {
301 ASSERTDEB_(dim==0 || dim==1)
302 if (dim==0) return m_feats[idx]->x;
303 else return m_feats[idx]->y;
304 }
305
306 /// Returns the distance between the vector "p1[0:size-1]" and the data point with index "idx_p2" stored in the class:
307 inline float kdtree_distance(const float *p1, const size_t idx_p2,size_t size) const
308 {
309 ASSERTDEB_(size==2)
310 MRPT_UNUSED_PARAM(size); // in release mode
311
312 const float d0 = p1[0] - m_feats[idx_p2]->x;
313 const float d1 = p1[1] - m_feats[idx_p2]->y;
314 return d0*d0+d1*d1;
315 }
316
317 // Optional bounding-box computation: return false to default to a standard bbox computation loop.
318 // Return true if the BBOX was already computed by the class and returned in "bb" so it can be avoided to redo it again.
319 // Look at bb.size() to find out the expected dimensionality (e.g. 2 or 3 for point clouds)
320 template <typename BBOX>
321 bool kdtree_get_bbox(BBOX &bb) const {
323 return false;
324 }
325
326 /** @} */
327
328
329 /** @name getFeature*() methods for template-based access to feature list
330 @{ */
331 inline float getFeatureX(size_t i) const { return m_feats[i]->x; }
332 inline float getFeatureY(size_t i) const { return m_feats[i]->y; }
333 inline TFeatureID getFeatureID(size_t i) const { return m_feats[i]->ID; }
334 inline float getFeatureResponse(size_t i) const { return m_feats[i]->response; }
335 inline bool isPointFeature(size_t i) const { return m_feats[i]->isPointFeature(); }
336 inline float getScale(size_t i) const { return m_feats[i]->scale; }
337 inline TFeatureTrackStatus getTrackStatus(size_t i) { return m_feats[i]->track_status; }
338
339 inline void setFeatureX(size_t i,float x) { m_feats[i]->x=x; }
340 inline void setFeatureXf(size_t i,float x) { m_feats[i]->x=x; }
341 inline void setFeatureY(size_t i,float y) { m_feats[i]->y=y; }
342 inline void setFeatureYf(size_t i,float y) { m_feats[i]->y=y; }
343
344 inline void setFeatureID(size_t i,TFeatureID id) { m_feats[i]->ID=id; }
345 inline void setFeatureResponse(size_t i,float r) { m_feats[i]->response=r; }
346 inline void setScale(size_t i,float s) { m_feats[i]->scale=s; }
347 inline void setTrackStatus(size_t i,TFeatureTrackStatus s) { m_feats[i]->track_status=s; }
348
349 inline void mark_as_outdated() const { kdtree_mark_as_outdated(); }
350
351 /** @} */
352
353
354 }; // end of class
355
356 /****************************************************
357 Class CMATCHEDFEATURELIST
358 *****************************************************/
359 /** A list of features
360 */
361 class VISION_IMPEXP CMatchedFeatureList : public std::deque< std::pair<CFeaturePtr,CFeaturePtr> >
362 {
363 public:
364 /** The type of the first feature in the list */
365 inline TFeatureType get_type() const { return empty() ? featNotDefined : (begin()->first)->get_type(); }
366
367 /** Save list of matched features to a text file */
368 void saveToTextFile(const std::string &fileName);
369
370 /** Returns the matching features as two separate CFeatureLists */
372
373 /** Returns a smart pointer to the feature with the provided ID or a empty one if not found */
374 CFeaturePtr getByID( const TFeatureID & ID, const TListIdx &idx );
375
376 /** Returns the maximum ID of the features in the list. If the max ID has been already set up, this method just returns it.
377 Otherwise, this method finds, stores and returns it.*/
378 void getMaxID( const TListIdx &idx, TFeatureID & firstListID, TFeatureID & secondListID );
379
380 /** Updates the value of the maximum ID of the features in the matched list, i.e. it explicitly searches for the max ID and updates the member variables. */
381 void updateMaxID( const TListIdx &idx );
382
383 /** Explicitly set the max IDs values to certain values */
384 inline void setLeftMaxID( const TFeatureID &leftID ){ m_leftMaxID = leftID; }
385 inline void setRightMaxID( const TFeatureID &rightID ){ m_rightMaxID = rightID; }
386 inline void setMaxIDs( const TFeatureID &leftID, const TFeatureID &rightID )
387 {
388 setLeftMaxID(leftID);
389 setRightMaxID(rightID);
390 };
391
392 /** Constructor */
394
395 /** Virtual destructor */
397 protected:
398 TFeatureID m_leftMaxID, m_rightMaxID;
399 }; // end of class
400
401
402 /** @} */ // End of add to module: mrptvision_features
403
404 } // end of namespace
405
406
407 namespace utils
408 {
409 // Specialization must occur in the same namespace
411 }
412} // end of namespace
413
414#endif
415
#define DEFINE_SERIALIZABLE_POST_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
#define DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
This declaration must be inserted in all CSerializable classes definition, before the class declarati...
#define MRPT_DECLARE_TTYPENAME_PTR_NAMESPACE(_TYPE, __NS)
Definition: TTypeName.h:72
This class is a "CSerializable" wrapper for "CMatrixFloat".
Definition: CMatrix.h:31
A class for storing images as grayscale or RGB bitmaps.
Definition: CImage.h:102
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
Definition: CStream.h:39
A generic 2D feature from an image, extracted with CFeatureExtraction Each feature may have one or mo...
Definition: CFeature.h:54
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,...
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,...
uint8_t descriptorORBDistanceTo(const CFeature &oFeature) const
Computes the Hamming distance "this" and the "other" descriptor ORB descriptor.
bool getFirstDescriptorAsMatrix(mrpt::math::CMatrixFloat &desc) const
Return the first found descriptor, as a matrix.
TFeatureType type
Type of the feature: featNotDefined, featSIFT, featKLT, featHarris, featSURF, featBeacon.
Definition: CFeature.h:65
CFeature()
Constructor.
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,...
std::deque< std::vector< double > > multiOrientations
A vector of main orientations (there is a vector of orientations for each scale)
Definition: CFeature.h:79
float response
A measure of the "goodness" of the feature (old name: KLT_val)
Definition: CFeature.h:67
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".
mrpt::math::TPoint3D p3D
The estimated 3D point of this feature wrt its camera.
Definition: CFeature.h:77
void dumpToConsole() const
mrpt::utils::CImage patch
A patch of the image surrounding the feature.
Definition: CFeature.h:63
std::deque< std::vector< std::vector< int32_t > > > multiHashCoeffs
A set of vectors containing the coefficients for a HASH table of descriptors.
Definition: CFeature.h:80
double initialDepth
The estimated depth in 3D of this feature wrt the camera that took its image.
Definition: CFeature.h:76
float descriptorSpinImgDistanceTo(const CFeature &oFeature, bool normalize_distances=true) const
Computes the Euclidean Distance between "this" and the "other" descriptors.
float scale
Feature scale into the scale space.
Definition: CFeature.h:69
void saveToTextFile(const std::string &filename, bool APPEND=false)
Save the feature to a text file in this format: "%% Dump of mrpt::vision::CFeatureList....
float patchCorrelationTo(const CFeature &oFeature) const
Computes the normalized cross-correlation between the patches of this and another feature (normalized...
void dumpToTextStream(mrpt::utils::CStream &out) const
Dump feature information into a text stream.
uint16_t nTimesNotSeen
Number of frames it has not been seen in a sequence of images.
Definition: CFeature.h:72
uint16_t nTimesSeen
Number of frames it has been seen in a sequence of images.
Definition: CFeature.h:71
uint8_t user_flags
A field for any other flags needed by the user (this has not a predefined meaning)
Definition: CFeature.h:70
std::deque< double > multiScales
A set of scales where the multi-resolution descriptor has been computed.
Definition: CFeature.h:78
uint16_t nTimesLastSeen
Number of frames since it was seen for the last time.
Definition: CFeature.h:73
float descriptorSIFTDistanceTo(const CFeature &oFeature, bool normalize_distances=true) const
Computes the Euclidean Distance between "this" and the "other" descriptors.
struct VISION_IMPEXP mrpt::vision::CFeature::TDescriptors descriptors
float descriptorSURFDistanceTo(const CFeature &oFeature, bool normalize_distances=true) const
Computes the Euclidean Distance between "this" and the "other" descriptors.
float orientation
Main orientation of the feature.
Definition: CFeature.h:68
virtual ~CFeature()
Virtual destructor.
Definition: CFeature.h:188
TFeatureID ID
ID of the feature.
Definition: CFeature.h:62
bool isPointFeature() const
Return false only for Blob detectors (SIFT, SURF)
TFeatureTrackStatus track_status
Status of the feature tracking process (old name: KLT_status)
Definition: CFeature.h:66
uint16_t patchSize
Size of the patch (patchSize x patchSize) (it must be an odd number)
Definition: CFeature.h:64
double depth
The estimated depth in 3D of this feature wrt the camera in the current frame.
Definition: CFeature.h:75
TFeatureType get_type() const
Get the type of the feature.
Definition: CFeature.h:176
A list of visual features, to be used as output by detectors, as input/output by trackers,...
Definition: CFeature.h:212
void setFeatureYf(size_t i, float y)
Definition: CFeature.h:342
size_t size() const
Definition: CFeature.h:280
const_reverse_iterator rbegin() const
Definition: CFeature.h:274
iterator erase(const iterator &it)
Definition: CFeature.h:277
float getFeatureResponse(size_t i) const
Definition: CFeature.h:334
TFeatureID getFeatureID(size_t i) const
Definition: CFeature.h:333
void setTrackStatus(size_t i, TFeatureTrackStatus s)
Definition: CFeature.h:347
void push_back(const CFeaturePtr &f)
Definition: CFeature.h:285
void setFeatureResponse(size_t i, float r)
Definition: CFeature.h:345
const_reverse_iterator rend() const
Definition: CFeature.h:275
void copyListFrom(const CFeatureList &otherList)
Copies the content of another CFeatureList inside this one.
TInternalFeatList::const_reverse_iterator const_reverse_iterator
Definition: CFeature.h:265
void setFeatureXf(size_t i, float x)
Definition: CFeature.h:340
TFeatureTrackStatus getTrackStatus(size_t i)
Definition: CFeature.h:337
void saveToTextFile(const std::string &fileName, bool APPEND=false)
Save feature list to a text file.
reverse_iterator rbegin()
Definition: CFeature.h:272
TInternalFeatList::const_iterator const_iterator
Definition: CFeature.h:262
size_t kdtree_get_point_count() const
Must return the number of data points.
Definition: CFeature.h:297
TInternalFeatList::reverse_iterator reverse_iterator
Definition: CFeature.h:264
bool kdtree_get_bbox(BBOX &bb) const
Definition: CFeature.h:321
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:257
TInternalFeatList::iterator iterator
Definition: CFeature.h:261
void setFeatureX(size_t i, float x)
Definition: CFeature.h:339
CFeaturePtr getByID(const TFeatureID &ID, int &out_idx) const
void mark_as_outdated() const
Definition: CFeature.h:349
void resize(size_t N)
Definition: CFeature.h:283
float getFeatureY(size_t i) const
Definition: CFeature.h:332
CFeaturePtr getByID(const TFeatureID &ID) const
Get a reference to a Feature from its ID.
const_iterator end() const
Definition: CFeature.h:270
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:300
virtual ~CFeatureList()
Virtual destructor.
void loadFromTextFile(const std::string &fileName)
Save feature list to a text file.
void setFeatureY(size_t i, float y)
Definition: CFeature.h:341
TFeatureID getMaxID() const
Get the maximum ID into the list.
void setFeatureID(size_t i, TFeatureID id)
Definition: CFeature.h:344
CFeaturePtr 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...
TInternalFeatList m_feats
The actual container with the list of features.
Definition: CFeature.h:216
void setScale(size_t i, float s)
Definition: CFeature.h:346
void getByMultiIDs(const std::vector< TFeatureID > &IDs, std::vector< CFeaturePtr > &out, std::vector< int > &outIndex) const
Get a vector of references to a subset of features from their IDs.
std::vector< CFeaturePtr > TInternalFeatList
Definition: CFeature.h:214
float getScale(size_t i) const
Definition: CFeature.h:336
TFeatureType get_type() const
The type of the first feature in the list.
Definition: CFeature.h:220
float getFeatureX(size_t i) const
Definition: CFeature.h:331
const_iterator begin() const
Definition: CFeature.h:269
bool isPointFeature(size_t i) const
Definition: CFeature.h:335
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:307
reverse_iterator rend()
Definition: CFeature.h:273
virtual ~CMatchedFeatureList()
Virtual destructor.
void saveToTextFile(const std::string &fileName)
Save list of matched features to a text file.
void setRightMaxID(const TFeatureID &rightID)
Definition: CFeature.h:385
TFeatureType get_type() const
The type of the first feature in the list.
Definition: CFeature.h:365
void setMaxIDs(const TFeatureID &leftID, const TFeatureID &rightID)
Definition: CFeature.h:386
void updateMaxID(const TListIdx &idx)
Updates the value of the maximum ID of the features in the matched list, i.e.
void getBothFeatureLists(CFeatureList &list1, CFeatureList &list2)
Returns the matching features as two separate CFeatureLists.
void getMaxID(const TListIdx &idx, TFeatureID &firstListID, TFeatureID &secondListID)
Returns the maximum ID of the features in the list.
void setLeftMaxID(const TFeatureID &leftID)
Explicitly set the max IDs values to certain values.
Definition: CFeature.h:384
CFeaturePtr 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.
EIGEN_STRONG_INLINE bool empty() const
EIGEN_STRONG_INLINE iterator begin()
Definition: eigen_plugins.h:26
TDescriptorType
The bitwise OR combination of values of TDescriptorType are used in CFeatureExtraction::computeDescri...
TFeatureType
Types of features - This means that the point has been detected with this algorithm,...
uint64_t TFeatureID
Definition of a feature ID.
@ descAny
Used in some methods to mean "any of the present descriptors".
@ featNotDefined
Non-defined feature (also used for Occupancy features)
struct VISION_IMPEXP CFeaturePtr
Definition: CFeature.h:44
#define ASSERTDEB_(f)
Defines an assertion mechanism - only when compiled in debug.
Definition: mrpt_macros.h:283
#define MRPT_UNUSED_PARAM(a)
Can be used to avoid "not used parameters" warnings from the compiler.
Definition: mrpt_macros.h:290
Classes for computer vision, detectors, features, etc.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
unsigned int uint16_t
Definition: pstdint.h:170
unsigned char uint8_t
Definition: pstdint.h:143
Lightweight 3D point.
All the possible descriptors this feature may have.
Definition: CFeature.h:85
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:91
bool hasDescriptorPolarImg() const
Whether this feature has this kind of descriptor.
Definition: CFeature.h:101
mrpt::math::CMatrix PolarImg
A polar image centered at the interest point.
Definition: CFeature.h:92
bool hasDescriptorMultiSIFT() const
Whether this feature has this kind of descriptor.
Definition: CFeature.h:103
bool hasDescriptorSURF() const
Whether this feature has this kind of descriptor.
Definition: CFeature.h:99
bool hasDescriptorORB() const
Whether this feature has this kind of descriptor.
Definition: CFeature.h:106
std::vector< float > SpinImg
The 2D histogram as a single row.
Definition: CFeature.h:90
std::vector< float > SURF
SURF feature descriptor.
Definition: CFeature.h:89
std::deque< std::vector< std::vector< int32_t > > > multiSIFTDescriptors
A set of SIFT-like descriptors for each orientation and scale of the multiResolution feature (there i...
Definition: CFeature.h:95
bool polarImgsNoRotation
If set to true (manually, default=false) the call to "descriptorDistanceTo" will not consider all the...
Definition: CFeature.h:94
mrpt::math::CMatrix LogPolarImg
A log-polar image centered at the interest point.
Definition: CFeature.h:93
std::vector< uint8_t > SIFT
SIFT feature descriptor.
Definition: CFeature.h:88
bool hasDescriptorLogPolarImg() const
Whether this feature has this kind of descriptor.
Definition: CFeature.h:102
std::vector< uint8_t > ORB
ORB feature descriptor
Definition: CFeature.h:96



Page generated by Doxygen 1.9.5 for MRPT 1.4.0 SVN: at Tue Dec 27 00:54:45 UTC 2022