31 #ifndef RTABMAP_FLANN_GROUND_TRUTH_H_ 32 #define RTABMAP_FLANN_GROUND_TRUTH_H_ 41 template <
typename Distance>
43 size_t skip = 0, Distance
distance = Distance())
46 typedef typename Distance::ResultType DistanceType;
49 int*
match =
new int[n];
50 DistanceType* dists =
new DistanceType[n];
56 for (
size_t i=1; i<dataset.
rows; ++i) {
57 DistanceType tmp =
distance(dataset[i], query, dataset.
cols);
63 else if (tmp < dists[dcnt-1]) {
70 while (j>=1 && dists[j]<dists[j-1]) {
77 for (
size_t i=0; i<nn; ++i) {
78 matches[i] = match[i+skip];
86 template <
typename Distance>
88 int skip=0, Distance d = Distance())
90 for (
size_t i=0; i<testset.
rows; ++i) {
91 find_nearest<Distance>(dataset, testset[i], matches[i], matches.
cols, skip,
d);
98 #endif //FLANN_GROUND_TRUTH_H_
def match(kptsFrom, kptsTo, scoresFrom, scoresTo, descriptorsFrom, descriptorsTo, imageWidth, imageHeight)
GLM_FUNC_DECL genType::value_type distance(genType const &p0, genType const &p1)
void swap(linb::any &lhs, linb::any &rhs) noexcept
void compute_ground_truth(const Matrix< typename Distance::ElementType > &dataset, const Matrix< typename Distance::ElementType > &testset, Matrix< size_t > &matches, int skip=0, Distance d=Distance())
void find_nearest(const Matrix< typename Distance::ElementType > &dataset, typename Distance::ElementType *query, size_t *matches, size_t nn, size_t skip=0, Distance distance=Distance())