This forum is disabled, please visit https://forum.opencv.org

1 | initial version |

Yes.

Std-dev is the root of the variance. The variance can be defined as:

*the-mean-of-square-values** minus the-square-of-the-value-mean*.

Thus, you can keep 3 running values:

- The number of processed pixels:
`n`

; - The sums of all the pixels -
`m_x`

; - The sum of the squares of all the pixels
`m_xx`

.

The variance is then: `float var = (m_xx - m_x)/n;`

The std-dev is thus: `float stddev = sqrt(var);`

.

Copyright OpenCV foundation, 2012-2018. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.