Skip to main content

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

Release files for streamz-opencv 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for streamz-opencv 0.1.1
File Size Uploaded
streamz-opencv-0.1.1.tar.gz 3.5 kB Details

Release files / streamz-opencv-0.1.1.tar.gz

Download URL streamz-opencv-0.1.1.tar.gz
Size 3.5 kB
Tags Source
SHA-256 checksum
How to use checksums
f4a45ce643ea3633ad74ae4fc2cd290befb5eedb38e8a70ab727408a988a48b9
BLAKE2b-256 checksum
How to use checksums
71b8434f81d6db36bf2b5cea60357bd47d39d9a0553662ead654307956695843
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

0.1.1 This release

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page