View Single Post
Old 05-01-2006, 08:57 PM   #43
sama
FLAC
 
sama's Avatar
 
Join Date: Feb 2006
Location: London, UK
Posts: 1,280
cool. Try this new version, it should work much faster and much more accurate. just let it learn the background for a good 30 seconds before you add anything.

Due to the background model being a running average, the frames learnt to begin with take a lot longer to "forget". So if there are objects that are in the frame to begin with and move after a few seconds, they linger in the model for a while before they're unlearnt.

I'd like to add a weighting method of some sort that gives newer frames higher value in the sample set.

I've discovered that for b&w, we only need intensity, so hue and saturation of colours can be ignored.

moreoever, the output can be colour (if the input was colour), even though the algorithm is working in b&w mode. the reason for this is that the pixel values of the foreground are copied in their full colour from the orignal image, but they are detected as intensity changes only from a b&w image. pretty cool eh?

anyhoos, have a mess around with this latest version when you get the chance. it's refactored and responsiblities of classes are much better seperated now, so it should be easier to grasp. I've still got more to do when I get the chance to.

some words of warning:
1) if the environmental lighting changes, the background model will be useless and will have to be learnt again.
2) the RGB mode sucks at the moment due to some bug. in general, HSI is a better model to use so looks like I'll focus on that for now, until RGB is required.

have a look at the constructor of ProcessorTest for some tweaking.

here's an image of the algorithm seperating my hand+water bottle from the rest of the room:



it's a bit choppy, but that's the purpose of the next part of the algorithm

coming soon:

1) smoothing prior to analysis - reduces the number of holes in the foreground
2) region analysis - grouping pixels that touch and placing a rectangle around them (with an id number)
3) region tracking - to make sure the id number stays associated with it's region
4) multimodal backgrounds - multiple background models based on different conditions. nighttime/day/overcast/sunny with autoswitching.

these will be very CPU intensive... but we'll see how it all pans out

all the above is still for stationary use. analysis whilst moving is completely new to me and I really need help there!
__________________
///Mputer - Velocity - TomTom - Vision - Bezel - CarPC
sama is offline   Reply With Quote