9 #ifndef _mrpt_vision_TSimpleFeature_H
10 #define _mrpt_vision_TSimpleFeature_H
33 template <
typename PIXEL_COORD_TYPE>
47 template <
typename COORD_TYPE>
53 template <
typename OTHER_TSIMPLEFEATURE>
57 track_status(o.track_status),
60 user_flags(o.user_flags)
85 static inline coord_t
f2coord(
float f) {
return f; }
93 template <
typename FEATURE>
108 if (this->
empty())
return 0;
145 inline const_reverse_iterator
rend()
const {
return m_feats.rend(); }
147 inline iterator
erase(
const iterator &it) {
return m_feats.erase(it); }
178 inline float getScale(
size_t i)
const {
return static_cast<float>(1<<
m_feats[i].octave); }
213 template <
typename FEATURE_LIST>
219 return (m_data[k1].response > m_data[k2].response);
228 template <
typename FEAT>
247 if (dim==0)
return m_data[idx].pt.x;
248 else return m_data[idx].pt.y;
257 const float d0 = p1[0] - m_data[idx_p2].pt.x;
258 const float d1 = p1[1] - m_data[idx_p2].pt.y;
265 template <
typename BBOX>
TFeatureVector::iterator iterator
const mrpt::math::CMatrixBool & getOccupiedSectionsMatrix() const
mrpt::math::CMatrixBool m_occupied_sections
float getFeatureResponse(size_t i) const
bool kdtree_get_bbox(BBOX &bb) const
Helper class: KD-tree search class for vector: Call mark_as_outdated() to force rebuilding ...
void setFeatureResponse(size_t i, float r)
void setFeatureYf(size_t i, float y)
Declares a matrix of booleans (non serializable).
const FEATURE_LIST & m_data
TFeatureVector::const_reverse_iterator const_reverse_iterator
TSimpleFeatureList_templ< TSimpleFeaturef > TSimpleFeaturefList
A list of image features using the structure TSimpleFeaturef for each feature - capable of KD-tree co...
CFeatureListKDTree(const std::vector< FEAT > &data)
void push_back_fast(const FEATURE &f)
float kdtree_get_pt(const size_t idx, int dim) const
Returns the dim'th component of the idx'th point in the class:
static coord_t f2coord(float f)
TSimpleFeatureTraits< FEATURE >::coord_t getFeatureY(size_t i) const
std::vector< FEATURE > TFeatureVector
const FEATURE & back() const
bool isPointFeature(size_t i) const
TFeatureVector::const_iterator const_iterator
void setFeatureID(size_t i, TFeatureID id)
const Scalar * const_iterator
TFeatureVector m_feats
The actual container with the list of features.
void setScale(size_t i, float s)
const_reverse_iterator rend() const
void mark_as_outdated() const
std::vector< size_t > m_first_index_per_row
A LUT of the first feature index per row, to efficiently look for neighbors, etc. ...
TFeatureTrackStatus track_status
Status of the feature tracking process.
const_iterator end() const
size_t kdtree_get_point_count() const
Must return the number of data points.
A helper struct to sort keypoints by their response: It can be used with these types: ...
mrpt::math::CMatrixBool & getOccupiedSectionsMatrix()
Get a ref to the occupation matrix: this is a user-defined matrix, which is not updated automatically...
A generic adaptor class for providing Nearest Neighbor (NN) lookup via the nanoflann library...
void setFeatureX(size_t i, typename TSimpleFeatureTraits< FEATURE >::coord_t x)
PIXEL_COORD_TYPE pixel_coords_t
The type of pt.
TSimpleFeature_templ()
Default constructor, leaves all fields uninitialized.
bool operator()(size_t k1, size_t k2) const
#define MRPT_UNUSED_PARAM(a)
Can be used to avoid "not used parameters" warnings from the compiler.
TSimpleFeatureTraits< FEATURE >::coord_t getFeatureX(size_t i) const
const TFeatureVector & getVector() const
Returns a const ref to the actual std::vector<> container.
PIXEL_COORD_TYPE::pixel_coord_t pixel_coord_t
The type of pt.x and pt.y.
uint8_t octave
The image octave the image was found in: 0=original image, 1=1/2 image, 2=1/4 image, etc.
uint64_t TFeatureID
Definition of a feature ID.
FEATURE & operator[](const unsigned int index)
void kdtree_mark_as_outdated() const
To be called by child classes when KD tree data changes.
uint8_t user_flags
A field for any other flags needed by the user (this has not a predefined meaning) ...
float getScale(size_t i) const
TSimpleFeatureList_templ< TSimpleFeature > TSimpleFeatureList
A list of image features using the structure TSimpleFeature for each feature - capable of KD-tree com...
void push_back(const FEATURE &f)
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
#define ASSERTDEB_(f)
Defines an assertion mechanism - only when compiled in debug.
TFeatureID ID
ID of the feature.
std::vector< size_t > & getFirstIndexPerRowLUT()
TSimpleFeature_templ< mrpt::utils::TPixelCoordf > TSimpleFeaturef
A version of TSimpleFeature with subpixel precision.
size_t size(const MATRIXLIKE &m, int dim)
TSimpleFeature_templ< mrpt::utils::TPixelCoord > TSimpleFeature
A simple structure for representing one image feature (without descriptor nor patch).
TFeatureID getMaxID() const
Returns the maximum ID of all features in the list, or 0 if it's empty.
reverse_iterator rbegin()
pixel_coords_t pt
Coordinates in the image.
float response
A measure of the "goodness" of the feature (typically, the KLT_response value)
TFeatureVector::reverse_iterator reverse_iterator
const FEATURE & front() const
const std::vector< FEAT > & m_data
void setTrackStatus(size_t i, TFeatureTrackStatus s)
A simple structure for representing one image feature (without descriptor nor patch) - This is the te...
int round(const T value)
Returns the closer integer (int) to x.
void setFeatureXf(size_t i, float x)
const_iterator begin() const
static coord_t f2coord(float f)
A list of image features using the structure TSimpleFeature for each feature - capable of KD-tree com...
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 ...
TFeatureTrackStatus getTrackStatus(size_t i)
TSimpleFeature_templ(const OTHER_TSIMPLEFEATURE &o)
void push_back_fast(const int x, const int y)
TFeatureID getFeatureID(size_t i) const
iterator erase(const iterator &it)
TSimpleFeature_templ(const COORD_TYPE x, const COORD_TYPE y)
Constructor that only sets the pt.
void keep_max(T &var, const K test_val)
If the second argument is above the first one, set the first argument to this higher value...
const std::vector< size_t > & getFirstIndexPerRowLUT() const
Returns a vector with a LUT of the first feature index per row, to efficiently look for neighbors...
const_reverse_iterator rbegin() const
KeypointResponseSorter(const FEATURE_LIST &data)
void setFeatureY(size_t i, typename TSimpleFeatureTraits< FEATURE >::coord_t y)