napari plugin for reading videos.
Project description
napari-video
Napari plugin for working with videos.
Relies on pyvideoreader as a backend which itself uses opencv for reading videos.
Installation
pip install napari[all] napari_video
Usage
From a terminal:
napari video.avi
Or from within python:
import napari
from napari_video.napari_video import VideoReaderNP
path='video.mp4'
vr = VideoReaderNP(path)
with napari.gui_qt():
viewer = napari.view_image(vr, name=path)
Internals
napari_video.napari_video.VideoReaderNP
exposes a video with a numpy-like interface, using opencv as a backend.
For instance, open a video:
vr = VideoReaderNP('video.avi')
print(vr)
video.avi with 60932 frames of size (920, 912, 3) at 100.00 fps
Then
vr[100]
will return the 100th frame as a numpy array with shape(902, 912, 3)
.vr[100:200:10]
will return 10 frames evenly spaced between frame number 100 and 200 (shape(10, 902, 912, 3)
).- Note that by default, single-frame and slice indexing return 3D and 4D arrays, respectively. To consistently return 4D arrays, open the video with
remove_leading_singleton=False
.vr[100]
will then return a(1, 902, 912, 3)
array. - We can also request specific ROIs and channels. For instance,
vr[100:200:10,100:400,800:850,1]
will return an array with shape(10, 300, 50, 1)
.
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
napari_video-0.2.10.tar.gz
(6.3 kB
view details)
Built Distribution
File details
Details for the file napari_video-0.2.10.tar.gz
.
File metadata
- Download URL: napari_video-0.2.10.tar.gz
- Upload date:
- Size: 6.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.27.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 79c0d9ae17f51d85dcef2c41d42b207d0a67cbbb0f4a372e09fd34a7834cef1e |
|
MD5 | ee239d62fcbef44d8e4e19fdc863e026 |
|
BLAKE2b-256 | a6b55f448079146e0765a6de3e2b8b9f8e48c4ed524431a032fb73ee68591cda |
File details
Details for the file napari_video-0.2.10-py3-none-any.whl
.
File metadata
- Download URL: napari_video-0.2.10-py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.27.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ddccec9fc065cda4812e95e4856058490fd62db28ae597d35d3f62ddbe9d5b35 |
|
MD5 | 9af828947bc32e8dfe0a984767b92dad |
|
BLAKE2b-256 | 53f32212b547306519cbd4d9a446d5a850938f534e3bd7735b0fc53d55514b88 |