1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-31 08:13:04 +04:00

Merge pull request #25563 from asmorkalov:as/HAL_min_max_idx

Transform offset to indeces for MatND in minMaxIdx HAL #25563

Address comments in https://github.com/opencv/opencv/pull/25553

### Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
- [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [ ] The feature is well documented and sample code can be built with the project CMake
This commit is contained in:
Alexander Smorkalov
2024-05-08 18:57:02 +03:00
committed by GitHub
parent 5bd64e09a3
commit 1f1ba7e402
2 changed files with 44 additions and 8 deletions
+26 -1
View File
@@ -2446,6 +2446,32 @@ TEST(Core_minMaxIdx, regression_9207_2)
EXPECT_EQ(14, maxIdx[1]);
}
TEST(Core_MinMaxIdx, MatND)
{
const int shape[3] = {5,5,3};
cv::Mat src = cv::Mat(3, shape, CV_8UC1);
src.setTo(1);
src.data[1] = 0;
src.data[5*5*3-2] = 2;
int minIdx[3];
int maxIdx[3];
double minVal, maxVal;
cv::minMaxIdx(src, &minVal, &maxVal, minIdx, maxIdx);
EXPECT_EQ(0, minVal);
EXPECT_EQ(2, maxVal);
EXPECT_EQ(0, minIdx[0]);
EXPECT_EQ(0, minIdx[1]);
EXPECT_EQ(1, minIdx[2]);
EXPECT_EQ(4, maxIdx[0]);
EXPECT_EQ(4, maxIdx[1]);
EXPECT_EQ(1, maxIdx[2]);
}
TEST(Core_Set, regression_11044)
{
Mat testFloat(Size(3, 3), CV_32FC1);
@@ -2807,7 +2833,6 @@ TEST(Core_MinMaxIdx, rows_overflow)
}
}
TEST(Core_Magnitude, regression_19506)
{
for (int N = 1; N <= 64; ++N)