Skip to content

Program Description

Claude Pageau edited this page Jul 8, 2017 · 60 revisions

Welcome to the rpi-speed-camera wiki!

speed-cam.py a RPI Object Speed Tracker

A Raspberry Pi Speed Camera using python, pi-camera, openCV, Video Stream

Program Description

This is a raspberry pi computer and picamera openCV object motion speed tracker program. It is written in python and bash script and uses openCV to detect and track object motion and speed. This can used for vehicles or any other moving objects. It tracks the speed of the largest moving object in the camera view. This program has been tested and runs using python2 or python3 and associated opencv version.

Note opencv3 requires install from source. I have a whiptail menu driven script to automate download, dependencies install, cmake and compile of opencv3, if you are interested enter a github issue for this rpi-speed-camera repo and I can send you a copy.

There is a menu driven admin tool called menubox.sh that can perform most speed camera operations

Operation

The program will detect motion in the field of view and use opencv to calculate the largest contour and return its x,y coordinate. Motion is tracked for a specified pixel length and speed reported. Motion detection is restricted between y_upper, y_lower, x_left, x_right variables (rectangle area of road or area of interest). Only motion within this rectangle is tracked. If a track is longer than track_len_trig variable then average speed will be calculated (based on cal_obj_px and cal_obj_mm variables) and a speed photo will be taken and saved in an images folder. If config.py variable log_data_to_file=True then a speed-cam.csv file will be created/updated with event data stored in CSV (Comma Separated Values) format. This can be imported into a spreadsheet.

The results are recorded on speed photos and optionally in a CSV data file that can be imported to a spreadsheet or other program for additional processing. The CSV data can also be used to creating web pages that can be viewed on a web browser from another computer on the same network.

How to Install rpi-speed-camera

Links

Clone this wiki locally