Vehicle speed detection using video processing

14 views (last 30 days)
Hello,
How can I calculate the speed of a Vehicle ?
there is an example in Mathworks.com which is about "Detecting Cars in a Video of Traffic",
*All what I need to know is how to detect the speed of the passed vehicles* ?
Thanks in Advance

Answers (2)

Image Analyst
Image Analyst on 4 Apr 2013
I guess find the distance between centroids and divide by the frame time. That will get you the projected pixel velocity. Then you need to have a calibration where you know a physical distance for each pixel. This is where it gets tricky because unless you have an aerial photo, you don't have a constant distance for each pixel. In other words, if the cars are coming toward you and you have a camera on a pole looking down at 45 degrees, the distance between 10 pixels at the top of the frame is going to be more than the distance between 10 pixels at the bottom of the frame. You might be able to use projective transforms to get a variable spatial calibration so that each pixel location is mapped back onto a "real world" location.
  1 Comment
Image Analyst
Image Analyst on 4 Apr 2013
Responding to your "Answer" below (which should have been a comment here, not an answer): Let's say you're looking down the street and you find a car and it's centroid is in the middle horizontally, but at row 100 vertically. Now in the next frame let's say you find the same car but it has now moved so its centroid is at row 200. Let's say that there was 1/10 of a second between frames. So now the velocity is [100 pixels] / [(1/10) of a second], or 1000 pixels per second. Does your car's speedometer read out in pixels per second? Mine doesn't. It reads in MPH (and KPH). So how are you going to convert pixels per second into miles per hour? Well, you need to know how many miles per pixel there are. So you measure some known thing in the frame, like lane divider stripe and calculate it, like (8 feet / 300 pixels) * (1 mile / 5280 feet). So now you can calibrate distances. The thing is, that lane divider might be different lengths depending on where in the photo it is, right? Can you envision that stripes at the top of the picture are shorter because they're farther away, and stripes at the bottom are longer because they're closer? Well how are you going to take that into account? That's why I mentioned projective transforms. I'm not going to explain that here because it would take too long. Ask Dr. Engineer, or your professor, or the Mathworks to help you understand that.

Sign in to comment.


Mr.Engineer
Mr.Engineer on 4 Apr 2013
I appreciate your response but your answer is not clear for me because I am not advanced in Matlab .
I am kindly asking you to reexplain in more detail.
by the way, I am student and I am working in project speed detection which is a part of my project .
Thanks,
  2 Comments
Image Analyst
Image Analyst on 27 Oct 2013
He never did get it going. Notice he didn't accept my answer. And we never heard anything him ever again.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!