Vehicle Counting Based on BackgroundSubtractorMOG

5.6k views Asked by At

I'm working on a project called ATCS(Automatic Traffic Controller System), it will modify traffic light duration based on the vehicle amount in front of the traffic light.

I used openCV and backgroundsubtractorMOG to detect vehicle, it runs successfully when vehicles are moving, but when the red signal turned on, all vehicle are uncountable. Of course that will make my software doesn't work.

So far I know that backgroundsubtractorMOG is best solution because this system work in many variation of wheather, light intensity, etc. It will compare current frame and previous frame so the moving object are detected as foreground (CMIIW). so how about the vehicle that was move and have stopped -- because the red signal of the traffic light is on and it force the driver to stop their vehicle? Will it still be detected as foreground object?

So I want to ask the most suitable algorithm to do it. How to count amount of vehicle when it moving, also when the vehicle stop moving because the red signal -- it still detected as vehicle.

thank you :)

3

There are 3 answers

0
Micka On

If background subtraction works for you (as you said), I would try to add another background model. Then you can perform background subtraction two times, once for the previous image (works for all moving objects) and once for your long term background model which will detect all stopped vehicles (and moving ones too) but might have some disadvantages for differing lighting conditions.

You could have a look at ViBe or Gaussian-Mixture-Models for creating those background models.

The other way would be to introduce some tracking mechanism as Antonio already mentioned. Once a vehicle is detected by background subtraction (only moving objects will appear in the image), you start a tracking and you will know that they're there even if they aren't detected again (because they don't move). So you need a tracking method that's not "tracking by detection" but some other method. I would recommend Kalman Filter or Particle Filtering, or maybe mean-shift tracking.

EDIT: one method often used for vehicle detection which is similar to background subtraction techniques are Local Binary Patterns (LBP)

0
GilLevi On

I would suggest using latent SVM detector with the "car" and "bus" model to detect vehicles and then apply simple tracking on the bounding boxes you get.

Latent SVM detector: http://docs.opencv.org/modules/objdetect/doc/latent_svm.html

2
Antonio On

How do you update your background? Because of changes in the lighting condition (clouds, day, night, dusk, weather) you cannot keep it statistic, however the presence of a stopped car could be still detectable if you still know the appearance of the background, that is the appearance of the road if the car is not there. If you have an area in the image where car do not pass, you can use that to understand if the lighting conditions are changing.

Which is your view angle for the vehicles? There is chance that combining a Viola Jones detector with a KLT tracker you obtain better and more general results.