meanStdDev[1]

Calculates a mean and standard deviation of array elements.

C++: void meanStdDev(InputArray src, OutputArray mean, OutputArray stddev, InputArray mask=noArray())
Python: cv2.meanStdDev(src[, mean[, stddev[, mask]]]) → mean, stddev
C: void cvAvgSdv(const CvArr* arr, CvScalar* mean, CvScalar* std_dev, const CvArr* mask=NULL )
Python: cv.AvgSdv(arr, mask=None) -> (mean, stdDev)

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: calculateded standard deviation.
  • mask – optional operation mask.

The function meanStdDev calculates the mean and the standard deviation M of array elements independently for each channel and returns it via the output parameters:

\begin{array}{l} N =  \sum _{I, \texttt{mask} (I)  \ne 0} 1 \\ \texttt{mean} _c =  \frac{\sum_{ I: \; \texttt{mask}(I) \ne 0} \texttt{src} (I)_c}{N} \\ \texttt{stddev} _c =  \sqrt{\frac{\sum_{ I: \; \texttt{mask}(I) \ne 0} \left ( \texttt{src} (I)_c -  \texttt{mean} _c \right )^2}{N}} \end{array}

When all the mask elements are 0’s, the functions return 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 xmtx.channels() (only possible when the matrix is continuous) and then pass the matrix to calcCovarMatrix() .

See also

countNonZero(), mean(), norm(), minMaxLoc(), calcCovarMatrix()

-----------------------------------------------------------------------

confidence interval (CI)[4]

If you know the standard deviation for a population, then you can calculate a confidence interval (CI) for the mean, or average, of that population. When a statistical characteristic that’s being measured (such as income, IQ, price, height, quantity, or weight) is numerical, most people want to estimate the mean (average) value for the population. You estimate the population mean,

image0.png

by using a sample mean,

image1.png

plus or minus a margin of error. The result is called a confidence interval for the population mean,

image2.png

When the population standard deviation is known, the formula for a confidence interval (CI) for a population mean is

image3.png

deviation, n is the sample size, and z* represents the appropriate z*-value from the standard normal distribution for your desired confidence level.

z*-values for Various Confidence Levels

Confidence Level
z*-value

image












參考資料

1. OpenCV meanStdDev

2. opencv 3.0 求均值 标准差 mean MeanStdDev

3. Problem with meanStdDev

4. How to Calculate a Confidence Interval for a Population Mean When You Know Its Standard Deviation

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 me1237guy 的頭像
    me1237guy

    天天向上

    me1237guy 發表在 痞客邦 留言(0) 人氣()