Provide opencv sources to streamz
Project description
streamz-opencv
Provide an opencv capture source for streamz.
Quickstart
Install streamz
and streamz-opencv
:
python -m pip install streamz streamz-opencv
Build your pipeline:
import cv2
from streamz import Stream
import streamz_opencv
def scale(img, scale=1.0):
scale_percent = 60 # percent of original size
width = int(img.shape[1] * scale)
height = int(img.shape[0] * scale)
dim = (width, height)
resized = cv2.resize(img, dim, interpolation = cv2.INTER_AREA)
return resized
def save(img, path):
cv2.imwrite(path, img)
stream = Stream.from_opencv(0, asynchronous=True)
stream.map(scale, scale=0.5).sink(save, path='small.jpg')
stream.map(scale, scale=1.5).sink(save, path='big.jpg')
stream.start()
good to know
- testing via pytest
- dep management via venv+setup.py+pip-tools
- see example usage in test
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
streamz-opencv-0.1.1.tar.gz
(3.5 kB
view details)
File details
Details for the file streamz-opencv-0.1.1.tar.gz
.
File metadata
- Download URL: streamz-opencv-0.1.1.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.7.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f4a45ce643ea3633ad74ae4fc2cd290befb5eedb38e8a70ab727408a988a48b9 |
|
MD5 | e2e4cc67ec36ed535aa49fe296869376 |
|
BLAKE2b-256 | 71b8434f81d6db36bf2b5cea60357bd47d39d9a0553662ead654307956695843 |