From 9ed1d6730f8f742efcee0282f5d4c3e58e36f1e3 Mon Sep 17 00:00:00 2001 From: Alexander Smorkalov Date: Fri, 31 May 2024 10:09:34 +0300 Subject: [PATCH] Fixed offset computation for ND case in MinMaxIdx HAL. --- modules/core/src/minmax.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/core/src/minmax.cpp b/modules/core/src/minmax.cpp index 859fa9e54c..8c6d8ad9a9 100644 --- a/modules/core/src/minmax.cpp +++ b/modules/core/src/minmax.cpp @@ -1522,10 +1522,11 @@ void cv::minMaxIdx(InputArray _src, double* minVal, if (res == CV_HAL_ERROR_OK) { + // minIdx[0] and minIdx[0] are always 0 for "flatten" version if (minIdx) - ofs2idx(src, minIdx[0], minIdx); + ofs2idx(src, minIdx[1], minIdx); if (maxIdx) - ofs2idx(src, maxIdx[0], maxIdx); + ofs2idx(src, maxIdx[1], maxIdx); return; } else if (res != CV_HAL_ERROR_NOT_IMPLEMENTED)