car counting. speed calculation

7 vues (au cours des 30 derniers jours)
ben
ben le 9 Oct 2012
hi everyone. im trying to do a project on MATLAB, something about car counting, and a rough estimate of the cars speed. for now im able to detect the cars by tagging them with a red dot. like in this http://www.mathworks.com/help/images/examples/detecting-cars-in-a-video-of-traffic.html
how do i proceed? i have a video feed of the expressway, and i am thinking of drawing two lines, an entry line and an exit line where the cards will be detected, counted, and speed measured in between the lines.
thanks in advance for your help!
  1 commentaire
A7mad
A7mad le 3 Juil 2013
Modifié(e) : Walter Roberson le 1 Oct 2016
please, can you help me if you know any code to detect speed of vehicle on MATLAB

Connectez-vous pour commenter.

Réponses (1)

David Verrelli
David Verrelli le 21 Oct 2016
Hi, Ben, Walter & A7mad.
For me, I'd be concerned, if setting up two 'lines' at different distances along the road, about the possibility of mismatch between the entering car and the exiting car. This would not be a problem if you either uniquely identify each individual car (perhaps colour would be a simple, but not foolproof, check) or you continued to track each car between lines. Alternatively, it also wouldn't be a problem if there is very little traffic and/or there is only one lane.
Given that you would probably end up tracking, and you have perhaps used some sort of blob analysis as part of your recognition algorithm, then if the centroid of the blob is computed reliably, you can just measure pixel displacement of the centroid between frames (one or multiple frames, perhaps with averaging). Then, knowing the framerate of the video, and knowing some conversion factor between pixels and physical distance on the expressway, you can get a speed.
Depending on the camera's perspective, the scaling of cars in the distance is likely to be quite different from that for cars in the foreground. You could still implement a variable conversion factor if needed. (Variation may be negligible for the special case of an overhead view from high up.) This is where your idea of picking two 'lines' would be a little simpler in that you would be able to choose physical landmarks in the image and from those define the physical distance.
If centroid estimation was not very accurate, then you would want to average over more frames, or use some other approach such as optical flow in the region of the car.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by