Ask Your Question

Counting HaarCascade Detections for Vehicle Detection

asked 2013-08-16 18:07:50 -0600

intenseza gravatar image

Hi All

So I'm making use of the EmguCV Wrapper, and I have implemented a HaarCascade method to detect vehicles as the enter "X" premises. My question is, how do I count these vehicles without having duplicate detections affect the count result?

Eg. Frame 1 detects "2 Vehicles", therefore the count is 2. Frame 2 detects "3 Vehicles (1 new, 2 from the previous frame)", now then count is 5, even though it should be 3.

How should I go about doing this? Any suggestions?

Thanks in advance!

edit retag flag offensive close merge delete


Why not track the vehicle bounding box from frame to frame to avoid duplicates?

GilLevi gravatar imageGilLevi ( 2013-08-16 18:33:15 -0600 )edit

That sounds good, but how do I exactly do that?

intenseza gravatar imageintenseza ( 2013-08-17 03:36:13 -0600 )edit

I wrote more information in the answer.

GilLevi gravatar imageGilLevi ( 2013-08-17 11:32:46 -0600 )edit

Is it possible to count the number of detected vehicles and display a text message?

Anje gravatar imageAnje ( 2016-04-19 04:27:21 -0600 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2013-08-17 07:49:41 -0600

updated 2013-08-17 10:42:15 -0600

If you are working with video, you can track the vehicle bounding boxes from frame to frame.

In each frame, track the location and velocity of the the vehicle.

Vehicle location = a(prediction from previous frame) + (1-a)current_frame_location

prediction = current_location + t*velocity

velocity = (current_location - previous_location)/t.

You should add code for creating new tracks - when you have a new detection that doesn't fit any of the current tracks. You should also add code for deleting "dead tracks" - when the car is no longer in the current frame.

Please tell me if you have any questions, and I'd try to make my answer clearer.

edit flag offensive delete link more


Thank you for your response. I will look into this now and get back to you if I have any further questions.


intenseza gravatar imageintenseza ( 2013-08-17 11:50:25 -0600 )edit

Question Tools


Asked: 2013-08-16 18:07:50 -0600

Seen: 1,823 times

Last updated: Aug 17 '13