Skip to content

Commit f143f45

Browse files
authored
Merge pull request opencv#25785 from refmitchell:issue_25784
Documentation update for minMaxLoc opencv#25785 Fixes opencv#25784 Update documentation for minMaxLoc to be more specific about when multi-channel images are and are not supported. Testing: Built documentation locally to check that updates were incorporated correctly. ### 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
1 parent c8080aa commit f143f45

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

modules/core/include/opencv2/core.hpp

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -855,13 +855,21 @@ CV_EXPORTS void normalize( const SparseMat& src, SparseMat& dst, double alpha, i
855855
/** @brief Finds the global minimum and maximum in an array.
856856
857857
The function cv::minMaxLoc finds the minimum and maximum element values and their positions. The
858-
extremums are searched across the whole array or, if mask is not an empty array, in the specified
858+
extrema are searched across the whole array or, if mask is not an empty array, in the specified
859859
array region.
860860
861-
The function do not work with multi-channel arrays. If you need to find minimum or maximum
862-
elements across all the channels, use Mat::reshape first to reinterpret the array as
863-
single-channel. Or you may extract the particular channel using either extractImageCOI, or
864-
mixChannels, or split.
861+
In C++, if the input is multi-channel, you should omit the minLoc, maxLoc, and mask arguments
862+
(i.e. leave them as NULL, NULL, and noArray() respectively). These arguments are not
863+
supported for multi-channel input arrays. If working with multi-channel input and you
864+
need the minLoc, maxLoc, or mask arguments, then use Mat::reshape first to reinterpret
865+
the array as single-channel. Alternatively, you can extract the particular channel using either
866+
extractImageCOI, mixChannels, or split.
867+
868+
In Python, multi-channel input is not supported at all due to a limitation in the
869+
binding generation process (there is no way to set minLoc and maxLoc to NULL). A
870+
workaround is to operate on each channel individually or to use NumPy to achieve the same
871+
functionality.
872+
865873
@param src input single-channel array.
866874
@param minVal pointer to the returned minimum value; NULL is used if not required.
867875
@param maxVal pointer to the returned maximum value; NULL is used if not required.

0 commit comments

Comments
 (0)