How to detect and count cars in different lanes using HAAR cascade
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!
I think you just dont - not the right tool for the job. Read about convolutionary neuronal network
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 Yes, my camera is stationary. What do you exactly mean by a lane detection problem?
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)
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, 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.
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, 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 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.
that's quite some insight, imho ! but look again at your question -- is there anything mentioning that in it ?