All Projects → pageauc → Speed Camera

pageauc / Speed Camera

A Unix, Windows, Raspberry Pi Object Speed Camera using python, opencv, video streaming, motion tracking. Includes a Standalone Web Server Interface, Image Search using opencv template match and a whiptail Admin Menu Interface Includes picam and webcam Plugins for motion track security camera configuration including rclone sync script. watch-app allows remotely controller camera configuration from a remote storage service name. Uses sqlite3 and gnuplot for reporting. Recently added openalpr license plate reader support.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Speed Camera

Spectral Trajectory And Behavior Prediction
This is the code base for Trajectory and Driver Behavior Prediction in Autonomous Vehicles using Spectral Graph Theory
Stars: ✭ 236 (-56.22%)
Mutual labels:  vehicle, traffic
Vidgear
A High-performance cross-platform Video Processing Python framework powerpacked with unique trailblazing features 🔥
Stars: ✭ 2,048 (+279.96%)
Mutual labels:  opencv, video-streaming
Screen Recorder Ffmpeg Cpp
*Multimedia project* A screen recording application to capture your desktop and store in a video format. Click here to watch the demo
Stars: ✭ 98 (-81.82%)
Mutual labels:  video-streaming, unix
Multi Camera Live Object Tracking
Multi-camera live traffic and object counting with YOLO v4, Deep SORT, and Flask.
Stars: ✭ 375 (-30.43%)
Mutual labels:  opencv, traffic
embedio-extras
Additional Modules showing how to extend EmbedIO.
Stars: ✭ 43 (-92.02%)
Mutual labels:  webserver, sqlite3
webfr
moved to: https://github.com/godzillaframework/godzilla.git
Stars: ✭ 13 (-97.59%)
Mutual labels:  unix, webserver
Jpegrtspcamera
Sample RTSP server streaming MJPEG video from PC camera
Stars: ✭ 25 (-95.36%)
Mutual labels:  opencv, video-streaming
WendzelNNTPd
A usable and IPv6-ready Usenet-server (NNTP daemon). It is portable (Linux/*BSD/*nix), supports AUTHINFO authentication, contains ACL as well as role based ACL and provides "invisible" newsgroups. It can run on MySQL and SQLite backends.
Stars: ✭ 43 (-92.02%)
Mutual labels:  unix, sqlite3
Pode
Pode is a Cross-Platform PowerShell web framework for creating REST APIs, Web Sites, and TCP/SMTP servers
Stars: ✭ 329 (-38.96%)
Mutual labels:  unix, webserver
Pi Timolo
Raspberry PI-TIMOLO ( PI-TImelapse, MOtion, LOwLight ) uses RPI picamera and OpenCV for Remote Headless Security Monitoring using Motion Tracking, Rclone Auto Sync files with remote storage services. Auto Twilight Transitions and Low Light Camera Settings. Panoramic images using PanTiltHat and More. This project is featured on GitHub Awesome software.
Stars: ✭ 441 (-18.18%)
Mutual labels:  opencv, webserver
Godirwalk
Fast directory traversal for Golang
Stars: ✭ 504 (-6.49%)
Mutual labels:  unix
Whipper
Python CD-DA ripper preferring accuracy over speed
Stars: ✭ 517 (-4.08%)
Mutual labels:  unix
Tuql
Automatically create a GraphQL server from a SQLite database or a SQL file
Stars: ✭ 526 (-2.41%)
Mutual labels:  sqlite3
Shaka Player
JavaScript player library / DASH & HLS client / MSE-EME player
Stars: ✭ 5,386 (+899.26%)
Mutual labels:  video-streaming
Unix History Repo
Continuous Unix commit history from 1970 until today
Stars: ✭ 4,851 (+800%)
Mutual labels:  unix
Nscde
Modern and functional CDE desktop based on FVWM
Stars: ✭ 526 (-2.41%)
Mutual labels:  unix
Qupath
QuPath - Bioimage analysis & digital pathology
Stars: ✭ 503 (-6.68%)
Mutual labels:  opencv
Openvino Yolov3
YoloV3/tiny-YoloV3+RaspberryPi3/Ubuntu LaptopPC+NCS/NCS2+USB Camera+Python+OpenVINO
Stars: ✭ 500 (-7.24%)
Mutual labels:  opencv
Lsp
lsp is like ls command but more human-friendly
Stars: ✭ 498 (-7.61%)
Mutual labels:  unix
Imgur Screenshot
Take screenshot selection, upload to imgur. + more cool things
Stars: ✭ 540 (+0.19%)
Mutual labels:  unix

SPEED CAMERA - Object Motion Tracker Mentioned in Awesome <INSERT LIST NAME>

RPI, Unix and Windows Speed Camera Using python, openCV, RPI camera module, USB Cam or IP Cam

For Details See Program Features and Wiki Instructions and YouTube Videos

RPI Quick Install or Upgrade

IMPORTANT - A raspbian sudo apt-get update and sudo apt-get upgrade will NOT be performed as part of
speed-install.sh so it is recommended you run these prior to install to ensure your system is up-to-date.

Step 1 With mouse left button highlight curl command in code box below. Right click mouse in highlighted area and Copy.
Step 2 On RPI putty SSH or terminal session right click, select paste then Enter to download and run script.

curl -L https://raw.github.com/pageauc/speed-camera/master/speed-install.sh | bash

This will download and run the speed-install.sh script. If running under python3 you will need opencv3 installed. See my Github menu driven compile opencv3 from source project

Docker Quick Start

  1. If you haven't already, install Docker
  2. Clone the repository
  3. Run docker-compose up from the directory you cloned the repo into.
  4. The Docker container will likely exit because it is using a default config.
  5. Edit the configuration file @ config/config.py
  6. Run docker-compose up

OPENALPR Demo

For installation, Settings and Run details see ALPR Wiki Documentaion

Program Description

This is a raspberry pi, Windows, Unix Distro computer openCV object speed camera demo program. It is written in python and uses openCV to detect and track the x,y coordinates of the largest moving object in the camera view above a minimum pixel area. User variables are stored in the config.py file. Motion detection is restricted between y_upper, y_lower, x_left, x_right variables (road or area of interest). 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 media/images dated subfolders per variable imageSubDirMaxFiles = 1000 (see config.py).

If log_data_to_CSV = 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, database, Etc program for further processing. Release 8.9 adds a sqlite3 database to store speed data. Default is data/speed_cam.db with data in the speed table . there is a simple report sql_speed_gt.sh that can query for records with greater than a specified speed. I plan on doing more but this should be a good start. Take a look at the code for details.

Also included are

  • menubox.sh script is a whiptail menu system to allow easier management of program settings and operation.
  • webserver.py Allows viewing images and/or data from a web browser (see config.py for webserver settings) To implement webserver3.py copy webserver3.py to webserver.py
  • rclone for optional remote file sync to a remote storage service like google drive, DropBox and many others.
  • watch-app.sh for administration of settings from a remote storage service. Plus application monitoring.
  • sql_speed_gt.py Prompts for a speed value and runs a simple sqlite3 query to show all record that exceed the specified speed. Output can be found in media/reports folder and is available from browser.
  • sql_hour_count.py Run report for count by hour. also produces a graph using gnuplot. Query output html report and .png graph can be found in media/reports folder and is available from browser.
  • alpr-speed.py Process speed camera images with OPENALPR License plate reader
  • speed-search.py allows searching for similar target object images using opencv template matching.
  • makehtml.py creates html files that combine csv and image data for easier viewing from a web browser. (Does not work with secpicam480.py or secwebcam480.py plugins enabled.

Reference Links

Requirements

Raspberry Pi computer and a RPI camera module installed or USB Camera plugged in. Make sure hardware is tested and works. Most RPI models will work OK. A quad core RPI will greatly improve performance due to threading. A recent version of Raspbian operating system is Recommended.
or
MS Windows or Unix distro computer with a USB Web Camera plugged in and a recent version of python installed For Details See Wiki details.

It is recommended you upgrade to OpenCV version 3.x.x For Easy compile of opencv 3.4.2 from source See https://github.com/pageauc/opencv3-setup

Windows or Non RPI Unix Installs

For Windows or Unix computer platforms (non RPI or Debian) ensure you have the most up-to-date python version. For Downloads visit https://www.python.org/downloads

The latest python versions includes numpy and recent opencv version that is required to run this code. You will also need a USB web cam installed and working. To install this program access the GitHub project page at https://github.com/pageauc/speed-camera Select the green Clone or download button. The files will be cloned or zipped to a speed-camera folder. You can run the code from python IDLE application (recommended), GUI desktop or command prompt terminal window. Note bash .sh shell scripts will not work with windows unless special support for bash is installed for windows Eg http://win-bash.sourceforge.net/ http://www.cygwin.com/ Note I have Not tested these.

IMPORTANT speed-cam.py ver 8.x or greater Requires Updated config.py and plugins.

cd ~/speed-camera
cp config.py config.py.bak
cp config.py.new config.py

To replace plugins rename (or delete) plugins folder per below

cd ~/speed-camera
mv plugins pluginsold   # renames plugins folder
rm -r plugins           # deletes plugins folder

Then run menubox.sh UPGRADE menu pick.

Manual Install or Upgrade

From logged in RPI SSH session or console terminal perform the following. Allows you to review install code before running

cd ~
wget https://raw.github.com/pageauc/speed-camera/master/speed-install.sh
more speed-install.sh       # You can review code if you wish
chmod +x speed-install.sh
./speed-install.sh  # runs install script.

Run to view verbose logging

cd ~/speed-camera    
./speed-cam.py

See How to Run speed-cam.py wiki section

IMPORTANT Speed Camera will start in calibrate = True Mode.
Review settings in config.py file and edit variables with nano as required. You will need to perform a calibration to set the correct value for config.py cal_obj_px and cal_obj_mm variables based on the distance from camera to objects being measured for speed. See Calibration Procedure for more details.

The config.py motion tracking variable called track_counter = can be adjusted for your system and opencv version. default is 5 but a quad core RPI3 and latest opencv version eg 3.4.2 can be 10-15 or possibly greater.

Run menubox.sh

cd ~/speed-camera
./menubox.sh

Admin speed-cam Easier using menubox.sh (Once calibrated and/or testing complete)
menubox main menu

View speed-cam data and trends from web browser per sample screen shots

Speed Camera Web Recent View
Speed Camera Web html speed list Report
Speed Camera Web Recent View

Credits

Some of this code is based on a YouTube tutorial by Kyle Hounslow using C here https://www.youtube.com/watch?v=X6rPdRZzgjg

Thanks to Adrian Rosebrock jrosebr1 at http://www.pyimagesearch.com for the PiVideoStream Class code available on github at https://github.com/jrosebr1/imutils/blob/master/imutils/video/pivideostream.py

Have Fun
Claude Pageau
YouTube Channel https://www.youtube.com/user/pageaucp
GitHub Repo https://github.com/pageauc

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].