Ask Your Question

Revision history [back]

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:

  1. The number of processed pixels: n;
  2. The sums of all the pixels - m_x;
  3. 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);.