10 #ifndef mrpt_vision_descriptor_kdtrees_H 11 #define mrpt_vision_descriptor_kdtrees_H 23 template <
typename distance_t,
typename element_t = u
int8_t>
25 template <
typename distance_t,
typename element_t =
float>
45 template <
typename distance_t,
46 class metric_t = nanoflann::L2_Simple_Adaptor<
52 typedef typename nanoflann::KDTreeSingleIndexAdaptor<
63 ASSERT_(!feats.
empty() && feats[0]->descriptors.hasDescriptorSIFT())
73 nanoflann::KDTreeSingleIndexAdaptorParams
params;
103 template <
typename distance_t,
104 class metric_t = nanoflann::L2_Simple_Adaptor<
110 typedef typename nanoflann::KDTreeSingleIndexAdaptor<
121 ASSERT_(!feats.
empty() && feats[0]->descriptors.hasDescriptorSIFT())
131 nanoflann::KDTreeSingleIndexAdaptorParams
params;
157 template <
typename distance_t,
typename element_t>
158 struct TSIFTDesc2KDTree_Adaptor
167 const element_t* p1,
const size_t idx_p2,
size_t size)
const 169 const size_t dim =
m_feats[idx_p2]->descriptors.SIFT.
size();
170 const element_t* p2 = &
m_feats[idx_p2]->descriptors.SIFT[0];
172 for (
size_t i = 0; i < dim; i++)
174 d += (*p1 - *p2) * (*p1 - *p2);
183 return m_feats[idx]->descriptors.SIFT[dim];
185 template <
class BBOX>
192 template <
typename distance_t,
typename element_t>
193 struct TSURFDesc2KDTree_Adaptor
202 const element_t* p1,
const size_t idx_p2,
size_t size)
const 204 const size_t dim =
m_feats[idx_p2]->descriptors.SURF.
size();
205 const element_t* p2 = &
m_feats[idx_p2]->descriptors.SURF[0];
207 for (
size_t i = 0; i < dim; i++)
209 d += (*p1 - *p2) * (*p1 - *p2);
218 return m_feats[idx]->descriptors.SURF[dim];
220 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.
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...
size_t kdtree_get_point_count() const
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
nanoflann::KDTreeSingleIndexAdaptor< metric_t, detail::TSURFDesc2KDTree_Adaptor< distance_t > > kdtree_t
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
nanoflann::KDTreeSingleIndexAdaptor< metric_t, detail::TSIFTDesc2KDTree_Adaptor< distance_t > > kdtree_t
TSIFTDescriptorsKDTreeIndex(const CFeatureList &feats)
Constructor from a list of SIFT features.
element_t kdtree_get_pt(const size_t idx, int dim) const
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