Skip to main content

Provide opencv sources to streamz

Project description


Provide an opencv capture source for streamz.


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), scale=0.5).sink(save, path='small.jpg'), scale=1.5).sink(save, path='big.jpg')

good to know

  • testing via pytest
  • dep management via
  • see example usage in test

Project details

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 hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page