camgrab
Python library to download images from network accessible webcams.
Features
Out of the box, handles any webcam which provides a publically accessible URL to a JPG snapshot of their current image.
Easily swap in different downloaders to handle cams which expose their snapshots in a more complex way.
Highly configurable.
Provides a simple base for more advanced functionality, such as motion detection, CCTV systems, image analysis, etc.
Installation
pip install camgrab
Quick start
To simply grabbing images from a webcam every 2 seconds and start saving them to the default grabbed_images directory:
from camgrab import Grabber
grabber = Grabber('http://78.100.133.169:8888/out.jpg')
grabber.begin()
Examples
Adding a custom image handler
Grab an image every 5 seconds and it to a custom callable, without saving it, and print the image’s dimensions.
from camgrab import Grabber
url = 'http://62.163.242.211:8080/out.jpg'
def print_dimensions(im, **meta):
width, height = im.size
print('{width} pixels wide, {height} pixels high!'.format(width=width, height=height))
grabber = Grabber(url, every=5, send_to_callable=print_dimensions)
grabber.save = False
grabber.begin()
Take control of the main loop
As the main loop created by the begin() method is unthreaded, provides no output, has a static delay between grab attempts, etc. it might be too simple for your needs.
To get around this, simply call the tick() method within your own loop:
from random import random
from time import sleep
from camgrab import Grabber
url = 'http://62.163.242.211:8080/out.jpg'
grabber = Grabber(url)
while True:
grabber.tick()
# Wait somewhere between 0 and 10 seconds
sleep(random() * 10)
License
camgrab is free software, distributed under the MIT license.
Metadata
Release files for camgrab 0.8.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| camgrab-0.8.1.tar.gz | 200.8 kB | Without provenance | Details for camgrab-0.8.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| camgrab-0.8.1-py3-none-any.whl | Python 3 | none | any | Details for camgrab-0.8.1-py3-none-any.whl |
Total release size: 208.5 kB
Release files / camgrab-0.8.1.tar.gz
| Download URL | camgrab-0.8.1.tar.gz |
|---|---|
| Size | 200.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dc5cd35e27ae6bfa4c3477e73ce895b30d7636bce485be566fbe05f15b197404
|
|
BLAKE2b-256 checksum How to use checksums |
1a18452c4f99378e88a5109477a7a571e7e2123690e5f645e9e20bbb9752ce86
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / camgrab-0.8.1-py3-none-any.whl
| Download URL | camgrab-0.8.1-py3-none-any.whl |
|---|---|
| Size | 7.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d18ba16bcfa0e0ff639f4acee512c639bdf2b2a09e3cc3b71476721f1624e919
|
|
BLAKE2b-256 checksum How to use checksums |
7f69eae709e7462a579804c6968bf41ef8e40313de22c068c7bd3feaf78c4f26
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for camgrab 0.8.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.