Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
corelib
include
rtabmap
core
FlannIndex.h
Go to the documentation of this file.
1
/*
2
Copyright (c) 2010-2016, Mathieu Labbe - IntRoLab - Universite de Sherbrooke
3
All rights reserved.
4
5
Redistribution and use in source and binary forms, with or without
6
modification, are permitted provided that the following conditions are met:
7
* Redistributions of source code must retain the above copyright
8
notice, this list of conditions and the following disclaimer.
9
* Redistributions in binary form must reproduce the above copyright
10
notice, this list of conditions and the following disclaimer in the
11
documentation and/or other materials provided with the distribution.
12
* Neither the name of the Universite de Sherbrooke nor the
13
names of its contributors may be used to endorse or promote products
14
derived from this software without specific prior written permission.
15
16
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
20
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
*/
27
28
#ifndef CORELIB_SRC_FLANNINDEX_H_
29
#define CORELIB_SRC_FLANNINDEX_H_
30
31
#include "
rtabmap/core/RtabmapExp.h
"
// DLL export/import defines
32
#include <list>
33
#include <opencv2/opencv.hpp>
34
35
namespace
rtabmap
{
36
37
class
RTABMAP_EXP
FlannIndex
38
{
39
public
:
40
FlannIndex
();
41
virtual
~
FlannIndex
();
42
43
void
release();
44
unsigned
int
indexedFeatures()
const
;
45
46
// return KB
47
unsigned
int
memoryUsed()
const
;
48
49
// Note that useDistanceL1 doesn't have any effect if LSH is used
50
void
buildLinearIndex(
51
const
cv::Mat & features,
52
bool
useDistanceL1 =
false
,
53
float
rebalancingFactor = 2.0
f
);
54
void
buildKDTreeIndex(
55
const
cv::Mat & features,
56
int
trees = 4,
57
bool
useDistanceL1 =
false
,
58
float
rebalancingFactor = 2.0
f
);
59
void
buildKDTreeSingleIndex(
60
const
cv::Mat & features,
61
int
leafMaxSize = 10,
62
bool
reorder =
true
,
63
bool
useDistanceL1 =
false
,
64
float
rebalancingFactor = 2.0
f
);
65
void
buildLSHIndex(
66
const
cv::Mat & features,
67
unsigned
int
table_number = 12,
68
unsigned
int
key_size = 20,
69
unsigned
int
multi_probe_level = 2,
70
float
rebalancingFactor = 2.0
f
);
71
72
bool
isBuilt();
73
74
int
featuresType
()
const
{
return
featuresType_;}
75
int
featuresDim
()
const
{
return
featuresDim_;}
76
77
unsigned
int
addPoints(
const
cv::Mat & features);
78
79
void
removePoint(
unsigned
int
index);
80
81
// return squared distances (indices should be casted in size_t)
82
void
knnSearch(
83
const
cv::Mat & query,
84
cv::Mat & indices,
85
cv::Mat & dists,
86
int
knn,
87
int
checks = 32,
88
float
eps = 0.0,
89
bool
sorted =
true
)
const
;
90
91
// return squared distances
92
void
radiusSearch(
93
const
cv::Mat & query,
94
std::vector<std::vector<size_t> > & indices,
95
std::vector<std::vector<float> > & dists,
96
float
radius,
97
int
maxNeighbors = 0,
98
int
checks = 32,
99
float
eps = 0.0,
100
bool
sorted =
true
)
const
;
101
102
private
:
103
void
*
index_
;
104
unsigned
int
nextIndex_
;
105
int
featuresType_
;
106
int
featuresDim_
;
107
bool
isLSH_
;
108
bool
useDistanceL1_
;
// true=EUCLEDIAN_L2 false=MANHATTAN_L1
109
float
rebalancingFactor_
;
110
111
// keep feature in memory until the tree is rebuilt
112
// (in case the word is deleted when removed from the VWDictionary)
113
std::map<int, cv::Mat>
addedDescriptors_
;
114
std::list<int>
removedIndexes_
;
115
};
116
117
}
/* namespace rtabmap */
118
119
#endif
/* CORELIB_SRC_FLANNINDEX_H_ */
f
f
RtabmapExp.h
rtabmap::FlannIndex::index_
void * index_
Definition:
FlannIndex.h:103
rtabmap::FlannIndex::addedDescriptors_
std::map< int, cv::Mat > addedDescriptors_
Definition:
FlannIndex.h:113
rtabmap
Definition:
CameraTango.cpp:37
rtabmap::FlannIndex::isLSH_
bool isLSH_
Definition:
FlannIndex.h:107
rtabmap::FlannIndex::featuresDim
int featuresDim() const
Definition:
FlannIndex.h:75
rtabmap::FlannIndex::featuresDim_
int featuresDim_
Definition:
FlannIndex.h:106
RTABMAP_EXP
#define RTABMAP_EXP
Definition:
RtabmapExp.h:38
rtabmap::FlannIndex::featuresType_
int featuresType_
Definition:
FlannIndex.h:105
rtabmap::FlannIndex
Definition:
FlannIndex.h:37
rtabmap::FlannIndex::nextIndex_
unsigned int nextIndex_
Definition:
FlannIndex.h:104
rtabmap::FlannIndex::featuresType
int featuresType() const
Definition:
FlannIndex.h:74
rtabmap::FlannIndex::rebalancingFactor_
float rebalancingFactor_
Definition:
FlannIndex.h:109
rtabmap::FlannIndex::removedIndexes_
std::list< int > removedIndexes_
Definition:
FlannIndex.h:114
rtabmap::FlannIndex::useDistanceL1_
bool useDistanceL1_
Definition:
FlannIndex.h:108
rtabmap
Author(s): Mathieu Labbe
autogenerated on Wed Jun 5 2019 22:41:31