From 06b42925348ff4857eb38d5010285d41256eec75 Mon Sep 17 00:00:00 2001
From: Pierre-Emmanuel Viel
Date: Sat, 16 May 2020 20:13:00 +0200
Subject: [PATCH] Fix: error in the dimension used for computeMinMax
Instead of using the current dimension for which we just got a big span,
we were computing Min and Max for the previous dimension stored in cutfeat
(and using 0 instead of the dimension indice for the very first dimension
with "span > (1-eps)max_span")
---
modules/flann/include/opencv2/flann/kdtree_single_index.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modules/flann/include/opencv2/flann/kdtree_single_index.h b/modules/flann/include/opencv2/flann/kdtree_single_index.h
index fa38f9f1a2..e64848cb04 100644
--- a/modules/flann/include/opencv2/flann/kdtree_single_index.h
+++ b/modules/flann/include/opencv2/flann/kdtree_single_index.h
@@ -461,7 +461,7 @@ private:
DistanceType span = bbox[i].high-bbox[i].low;
if (span>(DistanceType)((1-EPS)*max_span)) {
ElementType min_elem, max_elem;
- computeMinMax(ind, count, cutfeat, min_elem, max_elem);
+ computeMinMax(ind, count, (int)i, min_elem, max_elem);
DistanceType spread = (DistanceType)(max_elem-min_elem);
if (spread>max_spread) {
cutfeat = (int)i;