Inspiration

Speed cameras are quite expensive (costing between $10,000 and $90,000 per camera) and produce footage with very low resolution. We sought to fix this issue by incorporating hardware that is much less expensive but also has a better quality of footage.

What it does

The webpage we created can access a Raspberry Pi “speed camera” which can then be used to find speeders using a special speed detection algorithm we created. The video feed will detect cars on the whole screen by default. However, the user will have the option to choose the area that will be detected by dragging their mouse. This creates a white box on the video feed and only cars that appear inside this box will be detected. We included this feature for quicker processing in case cars do not appear across the entire screen and only appear in a certain area. The Pi then reports all the speeders by uploading an image of each one to the webpage. The webpage is accessible to all devices (phone, tablet, etc.).

How we built it

We made our webpage using Flask, HTML, and CSS. When styling the website, we made sure to keep a uniform, minimalist design language throughout to add to its aesthetics. We made our detection algorithm with Python, OpenCV, and the HaarCascades algorithm. The algorithm and server run on a Raspberry Pi 4.

Challenges we ran into

Sometimes, the video feed that appeared on the website was flickering a little bit due to network bandwidth limitations. However, we were able to minimize the flickering by artificially limiting the FPS so that the flickering was not too distracting and only appeared for a brief period of time.

Accomplishments that we're proud of

We’re proud of the webpage we made and how we were able to integrate the OpenCV detection window onto our web page using Flask. We also are proud of our speed detection algorithm as it is probably the most complex thing we have made using OpenCV yet.

What we learned

On the backend side of things, we learned how to use OpenCV for more complex applications (have only used it for simple projects in the past) and we also learned about the HaarCascades Algorithm as well as how to use it. As for frontend, we learned how to integrate footage produced by OpenCV into Flask webpages.

What's next for Detective DriveTracker

We plan to incorporate license plate detection to better identify vehicles who are speeding and more easily assist authorities to apprehend speeders.

Share this project:

Updates