MATLAB: Help in background subtraction.

background subtractionimage processingImage Processing Toolbox

I have a background modeled image. and i try to perform background subtraction for the incoming frames in the video, then apply a threshold to extract a foreground object. When i apply a threshold most of the white intensity pixels has lower values falls in the background pixels, which is supposed to be a foreground. this works good for other coloured intensity pixels. As decreasing the threshold value, more of the background falls in the foreground region.
I am new to background subtraction technique. Is there any advanced technique, any solution to overcome my problem will help me more forward. Expecting some positive reply from experts.

Best Answer

It totally depends on your images, which you forgot to attach. Can you attach them so we know what we're talking about? Typically background subtraction is used for things like radiographs (x-rays) and fluorescence while background division is more appropriate for things taken with a regular optical camera. For video you can do either but be aware that things can be either brighter or darker than the background so you might want to do a subtraction but then take the absolute value. Even then it might not work. If you have a gray background and a man with the same color gray shirt walks in but has black pants and shoes and hair, and a white hat on, then if you do abs(image-backgroundImage) then you'll see everything except the graph shirt. So things my have holes or become multiple blobs. Maybe you can fill in the holes. Again it depends on your scene. If you're taking a photo of a sidewalk and building then maybe that is the background so if a car parks there you can detect a difference. But what if the car is parked there for 3 days. Perhaps at that point you might consider the parked car part of the background if you want to see things that have changed only in the last few seconds, minutes, or hours.