Function opencv::core::mean_std_dev_def

source ·
pub fn mean_std_dev_def(
    src: &impl ToInputArray,
    mean: &mut impl ToOutputArray,
    stddev: &mut impl ToOutputArray
) -> Result<()>
Expand description

Calculates a mean and standard deviation of array elements.

The function cv::meanStdDev calculates the mean and the standard deviation M of array elements independently for each channel and returns it via the output parameters: block formula When all the mask elements are 0’s, the function returns mean=stddev=Scalar::all(0).

Note: The calculated standard deviation is only the diagonal of the complete normalized covariance matrix. If the full matrix is needed, you can reshape the multi-channel array M x N to the single-channel array M*N x mtx.channels() (only possible when the matrix is continuous) and then pass the matrix to calcCovarMatrix .

§Parameters

  • src: input array that should have from 1 to 4 channels so that the results can be stored in Scalar_ ’s.
  • mean: output parameter: calculated mean value.
  • stddev: output parameter: calculated standard deviation.
  • mask: optional operation mask.

§See also

countNonZero, mean, norm, minMaxLoc, calcCovarMatrix

§Note

This alternative version of mean_std_dev function uses the following default values for its arguments:

  • mask: noArray()