Following steps should be used to detect the average speed
- Create a car detector using a specific technique. OpenCV supports the use of HOG models and the part based modeling by Felzenszwalb and the Felzenszwalb model for cars is available in the OpenCV data folder. Look for latentSVM detector.
- For each frame detect if there are cars.
- When car is detected apply a tracking algorithm on the detected location.
- Track the car over the following frames until it's position reaches the frame border or a location specified.
- Use the timing over this functionality to calculate the speed over the distance.