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