About counting vehicle

asked 2015-03-26 06:01:18 -0600

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

edit retag flag offensive close merge delete

Comments

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)

thdrksdfthmn gravatar imagethdrksdfthmn ( 2015-03-26 08:05:04 -0600 )edit

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

bGuveen gravatar imagebGuveen ( 2015-03-26 09:03:29 -0600 )edit
1

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 gravatar imageStevenPuttemans ( 2015-03-27 04:59:31 -0600 )edit

@StevenPuttemans , Hello what kind of tracker do you recommand to use for such a problem (multi object tracking and counting) ?

opencvTn gravatar imageopencvTn ( 2015-04-01 06:04:26 -0600 )edit

You can try Kalman Filter Tracking with constant velocity or Optical Flow Tracking. Both are in OpenCV.

StevenPuttemans gravatar imageStevenPuttemans ( 2015-04-01 07:25:47 -0600 )edit

@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

opencvTn gravatar imageopencvTn ( 2015-04-01 09:41:51 -0600 )edit

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

thdrksdfthmn gravatar imagethdrksdfthmn ( 2015-04-01 11:02:58 -0600 )edit