About counting vehicle
Hi guys ;
I'm done with tracking vehicles with Haar Cascade Classifier. My project is tagging and tracking cars in traffic now. But i couldn't find any source for "count" this. Can anyone help me about this? I have 2 classes for cars, my code detects separate this 2 kind of cars , and i have to count for each class. Thanks
You shall implement it. And it is very dependent to the approach you have. You can add more information about your environment, like camera on car, or filming the same part of road, etc... If you are detecting the cars with a cascade, you shall add the detection in a vector, and for each you have a tracker. So if there is no detection in the predicted area for a while, or it is getting out of the FOV, you shall remove that from the vector. and now you shall count the objects in the vector (X-type or Y-type; with 2 counters)
thanks for ur attention, my code detecting and tracking cars in one traffic video. But i have no idea for how to count this cars and write to console, i need some information. Please
Just count the amount of trackers that get initialized, track their x,y position and so that you do not count doubles when a tracker gets back to a lost item. That should do it.
@StevenPuttemans , Hello what kind of tracker do you recommand to use for such a problem (multi object tracking and counting) ?
You can try Kalman Filter Tracking with constant velocity or Optical Flow Tracking. Both are in OpenCV.
@StevenPuttemans Can I use a method which is based on Bgseg (or at least uses its output Mask) since I have a new algorithm and want to include in my solution. As far as I know Kalman filter and Optical Flow don't. Thank you
Yes, for Kalman Filter you can add as measurements the position (as center of blob, or its boundingRect, as here) and predict the position, then correct with the measurements and that is. You'll have N trackers and you may classify them as X or Y, depending on their aspect ratio or what you use for classification