How to detect and count cars in different lanes using HAAR cascade

asked 2018-10-09 16:23:46 -0500

Simran gravatar image

hello,

I am developing an application where I want to detect the cars in different lanes of the road and keep the count in separate counters. I have developed the program that can detect the cars from an input video file using a trained xml classifier. It detects all them as a whole and I want to count the number of cars that are passing through each lane.

Can someone please guide me how to implement this? Do I need to train my classifier for that or can I just draw imaginary lines to represent different lanes?

Thank you!

edit retag flag offensive close merge delete

Comments

I think you just dont - not the right tool for the job. Read about convolutionary neuronal network

holger gravatar imageholger ( 2018-10-09 23:56:34 -0500 )edit
1

IF your camera is stationary, you probably can get away with "imaginary lines". (an example image would be helpful)

if it's not so, you have to solve a "lane detection" problem, now.

and no, you can't train a cascade on this job, it can detect only "car or not".

berak gravatar imageberak ( 2018-10-10 00:06:36 -0500 )edit

@berak Yes, my camera is stationary. What do you exactly mean by a lane detection problem?

Simran gravatar imageSimran ( 2018-10-10 08:46:51 -0500 )edit

finding the road lanes, by e.g. trying to detect the white (or so) border lines.

(common robotics problem. you should easily find something on the net)

berak gravatar imageberak ( 2018-10-10 09:27:43 -0500 )edit

Do you think opencv is the appropriate tool for this? I would appreciate if you can refer some links here that you know would be good sources for me. Thanks

Simran gravatar imageSimran ( 2018-10-10 10:08:20 -0500 )edit

@Simran, the way you ask, clearly hints at a profound lack of research. (your task, not ours)

and even IF you replace the cascade detection with e.g. a cnn based one, you still have to solve the "which lane" problem.

it seems, you're not well prepared for your task. more research required, seriously.

berak gravatar imageberak ( 2018-10-10 10:16:51 -0500 )edit
1

Of course, I already did enough research on this and decided to ask a question here when I could not figure out the correct way. You know its not an easy task for the beginners to solve a problem just like that and not everything on internet gives you the correct information.

Simran gravatar imageSimran ( 2018-10-10 10:28:55 -0500 )edit

@Simran, k,k, - apologies, that was a bit harsh.

but again, from your question alone (read it again), we can't see, why method A would fail, and where method B would be better.

berak gravatar imageberak ( 2018-10-10 10:37:22 -0500 )edit
1

@berak Thinking from practical perspective, the camera would be stationary of course but it is to be used for an adaptive traffiic light system, so the geometry of intersection would be different for every camera installation. It won't be an efficient way just to draw the lines manually, otherwise the user would need to customize the code for every intersection.

Simran gravatar imageSimran ( 2018-10-10 10:45:57 -0500 )edit

that's quite some insight, imho ! but look again at your question -- is there anything mentioning that in it ?

berak gravatar imageberak ( 2018-10-10 10:49:41 -0500 )edit