Skip to main content

Read opencv cameras concurrently

Project description

concurrent-videocapture

Cv2 VideoCapture that runs concurrently in a thread for faster processing

Installation

You can install concurrent_videocapture from pip using

pip install concurrent_videocapture

or using

pip install git+https://github.com/charlielito/concurrent-videocapture

Usage

import cv2
import time

from concurrent_videocapture import ConcurrentVideoCapture

# Use it a the standard cv2.VideoCapture Class
cap = ConcurrentVideoCapture(0)

while True:
    init = time.time()
    grabbed, frame = cap.read()

    # Simulate heavy image processing function
    time.sleep(0.3)

    if not grabbed:
        break

    cv2.imshow("video", frame)
    key = cv2.waitKey(1)

    if key == 27:  # ESC
        break

    fps = 1/(time.time() - init)
    print('Fps: {}'.format(fps))

cap.release()

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

concurrent_videocapture-0.0.1.tar.gz (3.2 kB view details)

Uploaded Source

File details

Details for the file concurrent_videocapture-0.0.1.tar.gz.

File metadata

  • Download URL: concurrent_videocapture-0.0.1.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3.post20200330 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2

File hashes

Hashes for concurrent_videocapture-0.0.1.tar.gz
Algorithm Hash digest
SHA256 a40a0f80ec39fae218c4beeae197e28afb421947e19985a72486c4b185612846
MD5 c2a168ecbbb8c52828c5f3e5fec765bd
BLAKE2b-256 51cd312294bdfbeb79800b48d1569fad50756572f26da7fbe55ef282602602f7

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page