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

Merge pull request #25487 from Abdurrahheem:ash/01D-additional-fixes

Additional fixes to 0/1D tests #25487

This has additional fixes requited for 0/1D tests.

### 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
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [x] The feature is well documented and sample code can be built with the project CMake
This commit is contained in:
Abduragim Shtanchaev
2024-05-15 11:50:03 +04:00
committed by GitHub
parent 5260b48695
commit 5bdc41964a
6 changed files with 150 additions and 97 deletions
+5 -3
View File
@@ -456,12 +456,14 @@ static void reduceMinMax(cv::InputArray src, cv::OutputArray dst, ReduceMode mod
CV_INSTRUMENT_REGION();
cv::Mat srcMat = src.getMat();
axis = (axis + srcMat.dims) % srcMat.dims;
CV_Assert(srcMat.channels() == 1 && axis >= 0 && axis < srcMat.dims);
int dims = std::max(1, srcMat.dims);
axis = (axis + dims) % dims;
CV_Assert(srcMat.channels() == 1 && axis >= 0 && axis <= srcMat.dims);
std::vector<int> sizes(srcMat.dims);
std::copy(srcMat.size.p, srcMat.size.p + srcMat.dims, sizes.begin());
sizes[axis] = 1;
if(!sizes.empty())
sizes[axis] = 1;
dst.create(srcMat.dims, sizes.data(), CV_32SC1); // indices
cv::Mat dstMat = dst.getMat();