Skip to content

minMaxLoc

Core and matricesfunctionOpenCV 5.0.0
import { minMaxLoc } from '@banou/opencv-wasm'

Use after await initOpenCV(). See the initialization and named imports guide.

ARGUMENTSa, minVal
FUNCTIONminMaxLoc
RETURN TYPEMinMaxLoc
Call structure. A void return can still write to destination arguments. The parameter descriptions define inputs, outputs and ownership.

Finds the global minimum and maximum in an array.

The function cv::minMaxLoc finds the minimum and maximum element values and their positions. The extremums are searched across the whole array or, if mask is not an empty array, in the specified array region.

In C++, if the input is multi-channel, you should omit the minLoc, maxLoc, and mask arguments (i.e. leave them as NULL, NULL, and noArray() respectively). These arguments are not supported for multi-channel input arrays. If working with multi-channel input and you need the minLoc, maxLoc, or mask arguments, then use Mat::reshape first to reinterpret the array as single-channel. Alternatively, you can extract the particular channel using either extractImageCOI, mixChannels, or split.

In Python, multi-channel input is not supported at all due to a limitation in the binding generation process (there is no way to set minLoc and maxLoc to NULL). A workaround is to operate on each channel individually or to use NumPy to achieve the same functionality.

Note: CV_16F/CV_16BF/CV_Bool/CV_64U/CV_64S/CV_32U are not supported for src.

See: max, min, reduceArgMin, reduceArgMax, compare, inRange, extractImageCOI, mixChannels, split, Mat::reshape

minMaxLoc(a: Mat): MinMaxLoc;
2 available overloads
minMaxLoc(a: Mat, minVal: Mat): MinMaxLoc;
minMaxLoc(a: Mat): MinMaxLoc;
a

input single-channel array.

minVal

pointer to the returned minimum value; NULL is used if not required.

Returns

The MinMaxLoc result.

These signatures describe this package. Upstream documentation can mention optional backends that are absent from this build. Check runtime compatibility before choosing a backend or file format.