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
This commit is contained in:
parent
3cfd8cc1fe
commit
5b521bb778
@ -289,7 +289,7 @@ public:
|
|||||||
|
|
||||||
int veclen() const { return nnIndex->veclen(); }
|
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(); }
|
::cvflann::IndexParams getParameters() { return nnIndex->getParameters(); }
|
||||||
|
|
||||||
@ -297,6 +297,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
::cvflann::Index<Distance>* nnIndex;
|
::cvflann::Index<Distance>* nnIndex;
|
||||||
|
Mat _dataset;
|
||||||
};
|
};
|
||||||
|
|
||||||
//! @cond IGNORED
|
//! @cond IGNORED
|
||||||
@ -312,10 +313,11 @@ private:
|
|||||||
|
|
||||||
template <typename Distance>
|
template <typename Distance>
|
||||||
GenericIndex<Distance>::GenericIndex(const Mat& dataset, const ::cvflann::IndexParams& params, Distance 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.type() == CvType<ElementType>::type());
|
||||||
CV_Assert(dataset.isContinuous());
|
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);
|
nnIndex = new ::cvflann::Index<Distance>(m_dataset, params, distance);
|
||||||
|
|
||||||
|
|||||||
@ -114,7 +114,7 @@ struct L2_Simple
|
|||||||
ResultType result = ResultType();
|
ResultType result = ResultType();
|
||||||
ResultType diff;
|
ResultType diff;
|
||||||
for(size_t i = 0; i < size; ++i ) {
|
for(size_t i = 0; i < size; ++i ) {
|
||||||
diff = *a++ - *b++;
|
diff = (ResultType)(*a++ - *b++);
|
||||||
result += diff*diff;
|
result += diff*diff;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user