mean
import { mean } from '@banou/opencv-wasm'Use after await initOpenCV(). See the initialization and named imports guide.
ARGUMENTSsrc, mask
FUNCTIONmean
RETURN TYPEScalar
Calculates an average (mean) of array elements.
The function cv::mean calculates the mean value M of array elements, independently for each channel, and return it:
\begin{array}{l} N = \sum _{I: \; \texttt{mask} (I) \ne 0} 1 \\ M_c = \left ( \sum _{I: \; \texttt{mask} (I) \ne 0}{ \texttt{mtx} (I)_c} \right )/N \end{array}
When all the mask elements are 0's, the function returns Scalar::all(0)
See: countNonZero, meanStdDev, norm, minMaxLoc
mean(src: Mat, mask: Mat): Scalar;srcinput array that should have from 1 to 4 channels so that the result can be stored in Scalar_ .
maskoptional operation mask ot type CV_8U, CV_8S or CV_Bool.
Returns
The Scalar 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.