[][src]Function opencv::core::min_max_idx

pub fn min_max_idx(
    src: &dyn ToInputArray,
    min_val: &mut f64,
    max_val: &mut f64,
    min_idx: &mut i32,
    max_idx: &mut i32,
    mask: &dyn ToInputArray
) -> Result<()>

Finds the global minimum and maximum in an array

The function cv::minMaxIdx 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. The function does not work with multi-channel arrays. If you need to find minimum or maximum elements across all the channels, use Mat::reshape first to reinterpret the array as single-channel. Or you may extract the particular channel using either extractImageCOI , or mixChannels , or split . In case of a sparse matrix, the minimum is found among non-zero elements only.

Note: When minIdx is not NULL, it must have at least 2 elements (as well as maxIdx), even if src is a single-row or single-column matrix. In OpenCV (following MATLAB) each array has at least 2 dimensions, i.e. single-column matrix is Mx1 matrix (and therefore minIdx/maxIdx will be (i1,0)/(i2,0)) and single-row matrix is 1xN matrix (and therefore minIdx/maxIdx will be (0,j1)/(0,j2)).

Parameters

  • src: input single-channel array.
  • minVal: pointer to the returned minimum value; NULL is used if not required.
  • maxVal: pointer to the returned maximum value; NULL is used if not required.
  • minIdx: pointer to the returned minimum location (in nD case); NULL is used if not required; Otherwise, it must point to an array of src.dims elements, the coordinates of the minimum element in each dimension are stored there sequentially.
  • maxIdx: pointer to the returned maximum location (in nD case). NULL is used if not required.
  • mask: specified array region

C++ default parameters

  • max_val: 0
  • min_idx: 0
  • max_idx: 0
  • mask: noArray()