Wednesday, June 6, 2018

Raspberry Pi Speed Camera Python

I setup a pedestrian speed camera in the office using a great project by pageauc on github: This thing was so dead simple to setup and run, and after some tweaks on the config I was clocking fast walkers in my office like a champion.

  1. I started with a fresh Raspberry Pi 3 Raspbian build
  2. Installed OpenCV3 using this link: This takes a while
  3. Download the speed camera project from github:
  4. Extract it and copy it over to your Raspberry Pi. I just parked it under /home/pi/speed-camera
  5. Crack open the config and start messing with stuff

I am using a web cam so I had to change this value in the config right away:

I had to tweak the capture area for my project and did so by playing around with these values

Turn on the gui window so you can see what you are doing

Here is a shot of me walking by the camera. The software will automatically save the image and add the speed calculated to the image which is gangsta.

My camera is pretty potato quality. Another setting I had to tweak often was the track_len_trig. This determines how many pixel changes are required to save an image. Since my target is down the hall I had to reduce this down to 5. If you are tracking a larger area you will want to play with this since the default is 60. I get some false readings but it captures what I need.

Here is a picture of the system in action on the Pi. 
If you have any troubles review the guide on github. It is pretty handy.


Post a Comment