Skip to main content

A Lightweight Multi-Threaded OpenCV Video Processing Python Wrapper Library

Project description

vidgear Logo

PyPi version Last Commit Downloads

VidGear is a lightweight python wrapper around OpenCV Video I/O module that contains powerful multi-thread modules(gears) to enable high-speed video frames read functionality across various devices and platforms. It is a reworked implementation of imutils library's video modules with all major bugs fixed and comes with addition features like direct network streaming(GStreamer Pipeline supported) and flexible direct source parameters/attributes manipulation of OpenCV's VideoCapture Class properties on the go. This library is also very well compatible with Raspberry Pi Camera module's Picamera library and provides us the ability exploit its various features like brightness, saturation, sensor_mode etc. easily. This library supports Python 2.7 and all above versions.

Features:

Key features which differentiates it from the other existing multi-threaded open source solutions:

  • Multi-Threaded high-speed OpenCV video-frame capturing(resulting in High FPS)
  • Flexible Direct control over the video stream
  • Lightweight
  • Built-in Robust Error and frame synchronization Handling
  • Multi-Platform compatibility
  • Full Support for Network Video Streams(Including Gstreamer Raw Video Capture Pipeline)

Prerequisites

  • Critical: VidGear must require OpenCV(with contrib) library to be installed on your machine which is critical for its core algorithm functioning. You can build it from from scratch (Raspberry Pi) or install it from PyPi as follows(Latest versions recommended):
    pip install opencv-python
    pip install opencv-contrib-python
    
  • Additional: If you are using Raspberry Pi Camera Modules such as OmniVision OV5647 Camera Module and Sony IMX219 Camera Module. It requires additional Picamera library installation on your Raspberry Pi machine prior to its installation (Latest versions recommended). You can install it from PyPi easily as follows:
    pip install picamera
    
    Also, make sure to enable Raspberry Pi hardware specific settings prior using this library.

Installation

  • From PyPI(Stable Only): VidGear can be easily installed as follows(available on Python Package Index (PyPI)):
    sudo pip install vidgear
    
  • Clone this repository(Latest But experimental): You can also directly clone this repo. for latest patches(maybe experimental) and development purposes and thereby can install as follows:
    git clone https://github.com/abhiTronix/vidgear.git
    cd vidgear
    sudo pip install .
    
  • Conda Install: Anaconda prefers to use its own conda package manager, but it’s also possible to install packages using pip as follows:
    pip install vidgear
    

Documentation and Usage

You can checkout VidGear detailed Wiki-Section for detailed documentation with examples for each Class(Gear).

Basic example:

The basic example of VideoGear Class for webcam stream is as follows :

# import required libraries
from vidgear.gears import VideoGear
import cv2

stream = VideoGear(source=0).start() 
# define various attributes and start the stream

# infinite loop
while True:

	frame = stream.read()
	# read frames

	# check if frame is None
	if frame is None:
		#if True break the infinite loop
		break

	# do something with frame here

	cv2.imshow("Output Frame", frame)
	# Show output window

	key = cv2.waitKey(1) & 0xFF
	# check for 'q' key-press
	if key == ord("q"):
		#if 'q' key-pressed exit loop
		break

cv2.destroyAllWindows()
# close output window

stream.stop()
# safely close video stream.

Contribution and Development

You are welcome to contribute with suggestions, feature requests and pull requests.

Author

License

Copyright © 2019 Abhitronix

This project is under the MIT License. See the LICENSE file for the full license text.

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

vidgear-0.1.3.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

vidgear-0.1.3-py2.py3-none-any.whl (8.8 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file vidgear-0.1.3.tar.gz.

File metadata

  • Download URL: vidgear-0.1.3.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/39.1.0 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.6.7

File hashes

Hashes for vidgear-0.1.3.tar.gz
Algorithm Hash digest
SHA256 5cd819d2833da7a88d7e28a2d7762dc75c61af9fc5aabca0d0b5a88f3554811b
MD5 bf1604e8e376ef7ba8706895055442b4
BLAKE2b-256 95c62a104c07f01692560d82af0399f40b3a9d01b4fec25d9a0f62d21a47a89c

See more details on using hashes here.

File details

Details for the file vidgear-0.1.3-py2.py3-none-any.whl.

File metadata

  • Download URL: vidgear-0.1.3-py2.py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/39.1.0 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.6.7

File hashes

Hashes for vidgear-0.1.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 59c573363c726bdc0cc77d0744352bdbcc3e9266bf5ee16220e1bd46e247582e
MD5 3dc5c2f3c0fa8a75123956b6818d2a3d
BLAKE2b-256 f09f5725a25188eefde39049f81a4cb64ceb212b1f94a5f5c39aef81cf35a2b6

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