Speed cameras are there to measure the speed of the vehicles running on the road, and are used to find out the people violating the Traffic rules. But can you imagine that you can build a Speed Camera at your home and can measure the speed of vehicles outside your home. Here this guy Greg Tinker has built a Speed camera with Raspberry Pi and Camera module.
You just need to fix the Camera pointing towards the road with Raspberry Pi running the software, and as soon as some vehicle passes, it will give you the Image of vehicle with its Speed printed on it with date and time. To eliminate the problems created by other moving objects outside, a logic is added to draw a Boundary for area to be Monitored, using mouse. Then other moving objects outside the boundary will be discarded.
The main part is done at the software end. This project uses OpenCV 3 for computer vision and Image processing libraries with Python 3 to develop the software. He used Motion Detector Program from pyimagesearch.com and modified it for Speed Detection. Operation is simple, it measures the time taken by the vehicle, to Cross the ‘Boundary’ distance, and calculates the Speed. The whole Python Script can be downloaded from his GitHub account here.
Little Trigonometry and Math is used to calculate the distance covered by Camera’s Filed of View (FOV). It is derived by the Distance of Camera lens to the road and FOV angle, so you need to Hard Code them into the script before using it.
Currently it can measure Speed upto 40mph with only one car in the Monitored Area. With high speed or multiple cars, it won’t give accurate results. So build it and set it on your window to measure the Speed of vehicles for fun or for a serious cause like a ‘Proof’ of High Speed Driving.