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 :)
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
orGaussian-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)