Commit 5b521bb7 authored by Apoorv Goel's avatar Apoorv Goel Committed by Alexander Alekhin

Merge pull request #14898 from UnderscoreAsterisk:flann-warnings-and-4376

Keep a local copy of `features` from `flann::GenericIndex ` constructor (#14898)

* Fix warnings on Windows

* Fix #4376
parent 3cfd8cc1
......@@ -289,7 +289,7 @@ public:
int veclen() const { return nnIndex->veclen(); }
int size() const { return nnIndex->size(); }
int size() const { return (int)nnIndex->size(); }
::cvflann::IndexParams getParameters() { return nnIndex->getParameters(); }
......@@ -297,6 +297,7 @@ public:
private:
::cvflann::Index<Distance>* nnIndex;
Mat _dataset;
};
//! @cond IGNORED
......@@ -312,10 +313,11 @@ private:
template <typename Distance>
GenericIndex<Distance>::GenericIndex(const Mat& dataset, const ::cvflann::IndexParams& params, Distance distance)
: _dataset(dataset)
{
CV_Assert(dataset.type() == CvType<ElementType>::type());
CV_Assert(dataset.isContinuous());
::cvflann::Matrix<ElementType> m_dataset((ElementType*)dataset.ptr<ElementType>(0), dataset.rows, dataset.cols);
::cvflann::Matrix<ElementType> m_dataset((ElementType*)_dataset.ptr<ElementType>(0), _dataset.rows, _dataset.cols);
nnIndex = new ::cvflann::Index<Distance>(m_dataset, params, distance);
......
......@@ -114,7 +114,7 @@ struct L2_Simple
ResultType result = ResultType();
ResultType diff;
for(size_t i = 0; i < size; ++i ) {
diff = *a++ - *b++;
diff = (ResultType)(*a++ - *b++);
result += diff*diff;
}
return result;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment