@@ -80,6 +80,24 @@ class Index
80
80
typedef typename Distance::ResultType DistanceType;
81
81
typedef NNIndex<Distance> IndexType;
82
82
83
+ Index (const IndexParams& params, Distance distance = Distance() )
84
+ : index_params_(params)
85
+ {
86
+ flann_algorithm_t index_type = get_param<flann_algorithm_t >(params," algorithm" );
87
+ loaded_ = false ;
88
+
89
+ Matrix<ElementType> features;
90
+ if (index_type == FLANN_INDEX_SAVED) {
91
+ nnIndex_ = load_saved_index (features, get_param<std::string>(params," filename" ), distance);
92
+ loaded_ = true ;
93
+ }
94
+ else {
95
+ flann_algorithm_t index_type = get_param<flann_algorithm_t >(params, " algorithm" );
96
+ nnIndex_ = create_index_by_type<Distance>(index_type, features, params, distance);
97
+ }
98
+ }
99
+
100
+
83
101
Index (const Matrix<ElementType>& features, const IndexParams& params, Distance distance = Distance() )
84
102
: index_params_(params)
85
103
{
@@ -137,9 +155,9 @@ class Index
137
155
* Remove point from the index
138
156
* @param index Index of point to be removed
139
157
*/
140
- void removePoint (size_t index )
158
+ void removePoint (size_t point_id )
141
159
{
142
- nnIndex_->removePoint (index );
160
+ nnIndex_->removePoint (point_id );
143
161
}
144
162
145
163
0 commit comments