Background and goal
I live in a residential neighborhood where the speed limit is 25 miles/hour (ca. 40 km/h). I find this to be high for a residential neighborhood, but 25 mph is the norm here in the USA. Most of Europe, in comparison, has a history of posting 30 km/h in similar situations. (According to Wikipedia: "On September 1, 1992, the city of Graz, Austria, became the first European city to implement a city-wide 30 km/h limit on all roads.")
In any case, I feel that many cars are going even faster than the posted 25 mph, especially during rush hours. To substantiate my gut-feeling, I decided to measure vehicle speeds on the street in front of our house. I couldn't really justify spending a lot of money on a radar system but wanted to have a cheap way of getting some statistics, with tools and cameras I already have at hand. This is a work in progress, and while the vehicle speed estimation is already working, I have not had a chance to set up a dedicated camera and computer system to actually gather statistics.
Speed estimation is done in a C++ based program, using the OpenCV library for background detection and various transformations. I'm using the Cinder library for visualization, because I wanted to learn it, it's beautiful, and it has some really neat features such as "cinder::params::InterfaceGl", an easy-to-use wrapper for the AntTweakBar GUI library.
Center coordinates for moving contours detected in the previous step are fed to the "VehicleTracker" object. As the name implies, the VehicleTracker keeps track of all the vehicles that might appear at any given time. To do so, it uses a Kalman tracker for each detected vehicle track, and performs some rudimentary estimation of whether the object present is a car or not.
I currently don't have time to continue on this project. I've opened the bitbucket repository of my XCode project, and you can find the relevant code in the "Source" page.
- Tutorials by Student Dave. Highly recommended!
- A project on Github that I can't find any longer. I'll post a link if I do...