Ask Your Question
0

Standard deviation from discrete values

asked 2014-01-13 03:18:37 -0600

updated 2014-01-13 07:34:05 -0600

Adi gravatar image

I want to calculate standard deviation for every pixel in image, that I will get from web camera. So I will have many samples for every pixel.

Is possible to calculate the standard deviation of discrete values, without knowing the probabilities of the values (without keeping the last 100 frames into the memory)?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
2

answered 2014-01-13 07:33:09 -0600

Adi gravatar image

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);.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2014-01-13 03:18:37 -0600

Seen: 454 times

Last updated: Jan 13 '14