31 #ifndef OPENCV_FLANN_LINEAR_INDEX_H_
32 #define OPENCV_FLANN_LINEAR_INDEX_H_
41 struct LinearIndexParams :
public IndexParams
45 (* this)[
"algorithm"] = FLANN_INDEX_LINEAR;
49 template <
typename Distance>
50 class LinearIndex :
public NNIndex<Distance>
54 typedef typename Distance::ElementType ElementType;
55 typedef typename Distance::ResultType DistanceType;
58 LinearIndex(
const Matrix<ElementType>& inputData,
const IndexParams& params = LinearIndexParams(),
59 Distance d = Distance()) :
60 dataset_(inputData), index_params_(params), distance_(d)
64 LinearIndex(
const LinearIndex&);
65 LinearIndex& operator=(
const LinearIndex&);
69 return FLANN_INDEX_LINEAR;
104 index_params_[
"algorithm"] = getType();
107 void findNeighbors(ResultSet<DistanceType>& resultSet,
const ElementType* vec,
const SearchParams& )
CV_OVERRIDE
109 ElementType*
data = dataset_.data;
110 for (
size_t i = 0; i < dataset_.rows; ++i,
data += dataset_.cols) {
111 DistanceType dist = distance_(
data, vec, dataset_.cols);
112 resultSet.addPoint(dist, (
int)i);
118 return index_params_;
123 const Matrix<ElementType> dataset_;
125 IndexParams index_params_;
CvSize size
Definition: core_c.h:112
void * data
Definition: core_c.h:427
#define CV_OVERRIDE
Definition: cvdef.h:792