22 template <
typename distance_t,
typename element_t = u
int8_t>
24 template <
typename distance_t,
typename element_t =
float>
62 ASSERT_(!feats.
empty() && feats[0].descriptors.hasDescriptorSIFT());
120 ASSERT_(!feats.
empty() && feats[0].descriptors.hasDescriptorSIFT());
156 template <
typename distance_t,
typename element_t>
157 struct TSIFTDesc2KDTree_Adaptor
166 const element_t* p1,
const size_t idx_p2,
size_t size)
const 168 const size_t dim =
m_feats[idx_p2].descriptors.SIFT->
size();
169 const element_t* p2 = &(*
m_feats[idx_p2].descriptors.SIFT)[0];
171 for (
size_t i = 0; i < dim; i++)
173 d += (*p1 - *p2) * (*p1 - *p2);
182 return (*
m_feats[idx].descriptors.SIFT)[dim];
184 template <
class BBOX>
191 template <
typename distance_t,
typename element_t>
192 struct TSURFDesc2KDTree_Adaptor
201 const element_t* p1,
const size_t idx_p2,
size_t size)
const 203 const size_t dim =
m_feats[idx_p2].descriptors.SURF->
size();
204 const element_t* p2 = &(*
m_feats[idx_p2].descriptors.SURF)[0];
206 for (
size_t i = 0; i < dim; i++)
208 d += (*p1 - *p2) * (*p1 - *p2);
217 return (*
m_feats[idx].descriptors.SURF)[dim];
219 template <
class BBOX>
A kd-tree builder for sets of features with SURF descriptors.
A kd-tree builder for sets of features with SIFT descriptors.
const CFeatureList & m_feats
TSURFDescriptorsKDTreeIndex(const CFeatureList &feats)
Constructor from a list of SIFT features.
Squared Euclidean (L2) distance functor (suitable for low-dimensionality datasets, like 2D or 3D point clouds) Corresponding distance traits: nanoflann::metric_L2_Simple.
kdtree_t & get_kdtree()
Access to the kd-tree object.
void regenerate_kdtreee()
Re-creates the kd-tree, which must be done whenever the data source (the CFeatureList) changes...
~TSURFDescriptorsKDTreeIndex()
detail::TSIFTDesc2KDTree_Adaptor< distance_t > m_adaptor
const CFeatureList & m_feats
~TSIFTDescriptorsKDTreeIndex()
element_t kdtree_get_pt(const size_t idx, int dim) const
const CFeatureList & m_feats
kdtree_t & get_kdtree()
Access to the kd-tree object.
void regenerate_kdtreee()
Re-creates the kd-tree, which must be done whenever the data source (the CFeatureList) changes...
#define ASSERT_(f)
Defines an assertion mechanism.
size_t kdtree_get_point_count() const
typename nanoflann::KDTreeSingleIndexAdaptor< metric_t, detail::TSURFDesc2KDTree_Adaptor< distance_t > > kdtree_t
distance_t kdtree_distance(const element_t *p1, const size_t idx_p2, size_t size) const
const CFeatureList & m_feats
A list of visual features, to be used as output by detectors, as input/output by trackers, etc.
const kdtree_t & get_kdtree() const
detail::TSURFDesc2KDTree_Adaptor< distance_t > m_adaptor
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
distance_t kdtree_distance(const element_t *p1, const size_t idx_p2, size_t size) const
Parameters (see README.md)
TSIFTDescriptorsKDTreeIndex(const CFeatureList &feats)
Constructor from a list of SIFT features.
element_t kdtree_get_pt(const size_t idx, int dim) const
typename nanoflann::KDTreeSingleIndexAdaptor< metric_t, detail::TSIFTDesc2KDTree_Adaptor< distance_t > > kdtree_t
bool kdtree_get_bbox(BBOX &bb) const
const kdtree_t & get_kdtree() const
GLenum const GLfloat * params
TSURFDesc2KDTree_Adaptor(const CFeatureList &feats)
TSIFTDesc2KDTree_Adaptor(const CFeatureList &feats)
bool kdtree_get_bbox(BBOX &bb) const
size_t kdtree_get_point_count() const