Git Product home page Git Product logo

rms-camera's Introduction

RMS Camera

Python scripts for collecting and creating GIFs or MP4s of NSW RMS traffic camera images. Cameras can be viewed on livetraffic.com

collect.py

This script polls rms.nsw.gov.au for new traffic camera images every 30 seconds. If a new image is found, it is downloaded and (optionally) filtered. The filtered images are saved in their own directories. New images are received from cameras evey minute ± 15 seconds.

usage: collect.py [-h] [-c CAMERA] [-p PATH] [--filter]

optional arguments:
  -h, --help  show this help message and exit
  -c CAMERA   Traffic camera name
  -p PATH     Path to save images (default="./download")
  --filter    Enable image filtering (default=false)

Examples

python collect.py -c anzacbr

python collect.py --filter -c anzacbr -p "Anzac Bridge"

Filtering

Each individual frame can optionally be filtered with a PIL/Pillow ImageFilter using the --filter switch. If enabled, the images are passed through a separate Detail and Sharpen filter. The output of each filter is placed in <PATH>/filtered/detail and <PATH>/filtered/sharpen respectively.

Unfiltered Detail Sharpen
Unfiltered Detail Sharpen

Comparison GIF

Comparison

File naming

Downloaded images are named based on the camera they were captured by, and a UNIX timestamp of when they were downloaded. Example:

anzacbr-1496647687.878115.jpg

Cameras

Valid camera names can be found in cameras.md. Camera positions and directions can be viewed on the livetraffic.com map.

Dependencies

gif.py

This script creates an animated GIF from a folder containing a JPG image sequence. This script is not limited to working with images created by collect.py, it will work with any JPG image sequence. GIFs are limited to 500 frames in length. A warning will appear if more than 500 images are found. For image sequences larger than 500 frames, use mp4.py.

usage: gif.py [-h] [-i INPUT] [-o OUTPUT] [-f FPS]

optional arguments:
  -h, --help  show this help message and exit
  -i INPUT    Path to folder containing images
  -o OUTPUT   Path to save GIF (default="./anim.gif")
  -f FPS      GIF FPS (default=8)

Examples

python gif.py -i "Anzac Bridge"

python gif.py -i "Anzac Bridge" -o "anzacbr.gif" -f 20

GIF Sample - Unfiltered

GIF Sample - Unfiltered

Dependencies

mp4.py

This script creates an animated GIF from a folder containing a JPG image sequence. This script is not limited to working with images created by collect.py, it will work with any JPG image sequence.

usage: mp4.py [-h] [-i INPUT] [-p PREFIX] [-o OUTPUT] [-f FPS]

optional arguments:
  -h, --help  show this help message and exit
  -i INPUT    Path to folder containing images
  -p PREFIX   Image prefix
  -o OUTPUT   Path to save MP4 (default="./anim.mp4")
  -f FPS      MP4 FPS (default=8)

Examples

python mp4.py -i "Anzac Bridge" -p "anzacbr"

python mp4.py -i "Anzac Bridge" -p "anzacbr" -o "anzacbr.mp4" -f 20

MP4 Sample - Unfiltered (YouTube)

YouTube heavily compressed this video. A full quality sample is availible in images/sample.mp4.

Dependencies

rms-camera's People

Contributors

sam210723 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.