Image Sequence Abstraction for Python
Video data can appear in different forms: bunch of files, a video file, a network stream etc. We provide an abstraction for ordered image sources that serve as an isolation from a specific source type.
The interface is simple:
import imagesource
images = imagesource.VideoSource('tests/data/MOV02522.MPG')
img100 = images.get_image(100)
img101 = images.get_next_image()
images.rewind()
img000 = images.get_next_image()
images.write_images('out/%03d.png', 100)
images2 = imagesource.FilesSource('tests/data/frames/%03d.jpg')
# same interface as above ...
The basic sources are VideoSource and FilesSource for video files and sequences of image files respectively. The TimedVideoSource extracts frame timestamps from video files. The SynchronizedSource translates frame numbers using a table. This can be used for creating a synchronized set of sources.
For more examples see tests/test.py
Installation
Install OpenCV 3.x with Python bindings and Numpy using a system package manager.
$ pip install imagesource
The TimedVideoSource requires ffprobe command from the ffmpeg suite.
Testing
$ pip install nose
$ nosetests
Writing Extensions
It is simple to write transparent image source wrappers that post-process image data from an underlying image source (e.g. background subtraction, radial distortion removal, ...).
An example background subtracted image source:
class BackgroundSubtractedSource(imagesource.ImageSource):
def __init__(self, source):
self.source = source
self.bgs = cv2.createBackgroundSubtractorMOG2(...)
def get_image(self, frame):
img = self.source.get_image(frame)
return self.bgs.apply(img)
def get_next_image(self):
img = self.source.get_next_image()
return self.bgs.apply(img)
def rewind(self):
self.source.rewind()
Metadata
Release files for ImageSource 1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ImageSource-1.1.tar.gz | 5.1 kB | Without provenance | Details for ImageSource-1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ImageSource-1.1-py3-none-any.whl | Python 3 | none | any | Details for ImageSource-1.1-py3-none-any.whl |
Total release size: 13.0 kB
Release files / ImageSource-1.1.tar.gz
| Download URL | ImageSource-1.1.tar.gz |
|---|---|
| Size | 5.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3db0b6de5c7f6bca52e38916707168d6b62a675fc444c7cb6debf71544a183e6
|
|
BLAKE2b-256 checksum How to use checksums |
d4691aad30c414282eb890d5716978451943291f0390ccb7a85279055ae5c749
|
| 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/49.1.3 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.9.0
|
Release files / ImageSource-1.1-py3-none-any.whl
| Download URL | ImageSource-1.1-py3-none-any.whl |
|---|---|
| Size | 7.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7cf97132562e63b60342330d34d292757123b47ab6a21d61fc133ee156154b05
|
|
BLAKE2b-256 checksum How to use checksums |
4bcb5bef25818c21c0c796213af8fee44cf3b187dfe06b7d3fce29b6129501a0
|
| 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/49.1.3 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.9.0
|
Security for ImageSource 1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.