30
#ifndef OPENCV_FLANN_PARAMS_H_
31
#define OPENCV_FLANN_PARAMS_H_
44
typedef
std::map<cv::String, any> IndexParams;
46
struct
SearchParams :
public
IndexParams
48
SearchParams(
int
checks = 32,
float
eps = 0,
bool
sorted =
true
)
50
init(checks, eps, sorted,
false);
53
SearchParams(
int
checks,
float
eps,
bool
sorted,
bool
explore_all_trees )
55
init(checks, eps, sorted, explore_all_trees);
58
void
init(
int
checks = 32,
float
eps = 0,
bool
sorted =
true,
bool
explore_all_trees =
false
)
61
(*this)[
"checks"] = checks;
65
(*this)[
"sorted"] = sorted;
69
(*this)[
"explore_all_trees"] = explore_all_trees;
75T get_param(
const
IndexParams& params, cv::String name,
const
T& default_value)
77
IndexParams::const_iterator it = params.find(name);
78
if
(it != params.end()) {
79
return
it->second.cast<T>();
87T get_param(
const
IndexParams& params, cv::String name)
89
IndexParams::const_iterator it = params.find(name);
90
if
(it != params.end()) {
91
return
it->second.cast<T>();
94
FLANN_THROW(cv::Error::StsBadArg, cv::String(
"Missing parameter '")+name+cv::String(
"' in the parameters given"));
98
inline
void
print_params(
const
IndexParams& params, std::ostream& stream)
100
IndexParams::const_iterator it;
102
for(it=params.begin(); it!=params.end(); ++it) {
103
stream << it->first <<
" : "
<< it->second << std::endl;
107
inline
void
print_params(
const
IndexParams& params)
109
print_params(params, std::cout);