View Single Post
Old 05-02-2006, 07:20 PM   #45
sama
FLAC
 
sama's Avatar
 
Join Date: Feb 2006
Location: London, UK
Posts: 1,280
here's some small changes so that now it can clearly be seen how the algorithm is working:



for each pixel in the stream, a running mean is calculated. this is only for intensity and therefore is b&w as can be seen in the background image.

for each pixel in the stream, the difference between the background and the current value is caculated. That is:

SQRT[[meanPixelValue - currentPixelValue] * [meanPixelValue - currentPixelValue]] - a square root of a squared value ensures it's always positive

so now that we have the mean and variance, we say this (for each pixel):

Code:
Mean |------------|------------| < (-v * d) > < (+v * d) > where: v = variance d = deviation

if the new pixel value is within the mean and its variance, then it's a background pixel so ignore. if it's outside the mean and its variance, then it's a foreground pixel so extract it.

the variance is multiplied by the deviation, so the more deviation, the more variance is allowed.

not difficult at all!
__________________
///Mputer - Velocity - TomTom - Vision - Bezel - CarPC
sama is offline   Reply With Quote