Framework to process video data
Project description
Videopypeline
A fancy wrapper for opencv inspired by the keras model API.
Install
pip install videopypeline
Usage
videopypeline can be used to process any datatype. Nonetheless, its primary use is intended for videos. The examples below show some use cases. Refer to the Python-Notebook in this repository to see a more established usage example.
Linear pipeline
import videopypeline as vpl
video_path = './path/to/video.mp4'
output_path = './path/to/output.mp4'
# Setup pipeline model
raw_video = videopypeline.generators.ReadVideoFile(video_path)
grey = videopypeline.functions.Rgb2Greyscale()(raw_video)
crop = videopypeline.functions.Crop((100, 200), (500, 500))(grey)
smooth1 = videopypeline.functions.Smooth(101)(crop)
stats = videopypeline.core.Action(lambda frame: print(frame.mean(), frame.std()))(smooth1)
writer = videopypeline.actions.VideoWriter(output_path, 30, aggregate=True, collect=False, verbose=True)(stats)
# Invoke pipeline
_ = writer()
Tree pipeline
import videopypeline as vpl
video1_path = './path/to/video1.mp4'
video2_path = './path/to/video2.mp4'
output_path = './path/to/output.mp4'
# Setup pipeline model
raw_video1 = videopypeline.generators.ReadVideoFile(video1_path)
grey1 = videopypeline.functions.Rgb2Greyscale()(raw_video1)
smooth1 = videopypeline.functions.Smooth(101)(grey1)
raw_video2 = videopypeline.generators.ReadVideoFile(video2_path)
grey2 = videopypeline.functions.Rgb2Greyscale()(raw_video2)
smooth2 = videopypeline.functions.Smooth(101)(grey2)
# This node has two parents
diff = videopypeline.core.Function(lambda *frames: frames[0] - frames[1])([smooth1, smooth2])
writer = videopypeline.actions.VideoWriter(output_path, 30, aggregate=True, collect=False, verbose=True)(diff)
# Invoke pipeline
_ = writer()
Graph pipeline
</code></pre>
<h3>Filter pipeline</h3>
<pre lang="py"><code>
Terminology
Node
Generator
Function
Remarks
When adding custom Nodes, which inherit from vpl.core.Function
, make sure the output object is different from the
input object, as this could lead to unexpected behaviour.
Action
Pipeline
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
videopypeline-0.0.3.tar.gz
(9.0 kB
view details)
Built Distribution
File details
Details for the file videopypeline-0.0.3.tar.gz
.
File metadata
- Download URL: videopypeline-0.0.3.tar.gz
- Upload date:
- Size: 9.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e884a4fc2806ee2d7d763cba22ca190984c7ff88d11c7a9eff5bd4d4451c70b6 |
|
MD5 | 6755d7239b18d9c22cb92d6729c98252 |
|
BLAKE2b-256 | 6faffcf886a918ef48584cf4d11104a58ef3ca31cf9875eb591aeb0137af3772 |
File details
Details for the file videopypeline-0.0.3-py3-none-any.whl
.
File metadata
- Download URL: videopypeline-0.0.3-py3-none-any.whl
- Upload date:
- Size: 8.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | aba455a780baf5cd4fa0d1a08a900a7e6399270a8fc15ec3d71eeb77e6a02fcf |
|
MD5 | 4ee56a0aa63f9eec288ec2b62a50c9a1 |
|
BLAKE2b-256 | 94f8ca57794f59f681f21676cdf74c55261965600faaf9f5c79775529fb6a1df |