# napari-video
[![napari hub](https://img.shields.io/endpoint?url=https://api.napari-hub.org/shields/napari_video)](https://napari-hub.org/plugins/napari_video)
Napari plugin for working with videos.
Relies on [pyvideoreader](https://pypi.org/project/pyvideoreader/) as a backend which itself uses [opencv](https://opencv.org) for reading videos.
## Installation
```shell
pip install napari[all] napari_video
```
## Usage
From a terminal:
```shell
napari video.avi
```
Or from within python:
```shell
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:
```python
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)`.
Raw data
{
"_id": null,
"home_page": "https://github.com/janclemenslab/napari-video",
"name": "napari_video",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": null,
"author": "Jan Clemens",
"author_email": "clemensjan@googlemail.com",
"download_url": "https://files.pythonhosted.org/packages/a6/b5/5f448079146e0765a6de3e2b8b9f8e48c4ed524431a032fb73ee68591cda/napari_video-0.2.10.tar.gz",
"platform": null,
"description": "# napari-video\n[![napari hub](https://img.shields.io/endpoint?url=https://api.napari-hub.org/shields/napari_video)](https://napari-hub.org/plugins/napari_video)\n\nNapari plugin for working with videos.\n\nRelies on [pyvideoreader](https://pypi.org/project/pyvideoreader/) as a backend which itself uses [opencv](https://opencv.org) for reading videos.\n\n## Installation\n```shell\npip install napari[all] napari_video\n```\n\n## Usage\nFrom a terminal:\n```shell\nnapari video.avi\n```\n\nOr from within python:\n```shell\nimport napari\nfrom napari_video.napari_video import VideoReaderNP\n\npath='video.mp4'\nvr = VideoReaderNP(path)\nwith napari.gui_qt():\n viewer = napari.view_image(vr, name=path)\n```\n\n## Internals\n`napari_video.napari_video.VideoReaderNP` exposes a video with a numpy-like interface, using opencv as a backend.\n\nFor instance, open a video:\n```python\nvr = VideoReaderNP('video.avi')\nprint(vr)\n```\n```\nvideo.avi with 60932 frames of size (920, 912, 3) at 100.00 fps\n```\nThen\n\n- `vr[100]` will return the 100th frame as a numpy array with shape `(902, 912, 3)`.\n- `vr[100:200:10]` will return 10 frames evenly spaced between frame number 100 and 200 (shape `(10, 902, 912, 3)`).\n- 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.\n- 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)`.\n\n",
"bugtrack_url": null,
"license": null,
"summary": "napari plugin for reading videos.",
"version": "0.2.10",
"project_urls": {
"Bug Tracker": "https://github.com/janclemenslab/napari-video/issues",
"Documentation": "https://github.com/janclemenslab/napari-video/blob/main/README.md",
"Homepage": "https://github.com/janclemenslab/napari-video",
"Source Code": "https://github.com/janclemenslab/napari-video",
"User Support": "https://github.com/janclemenslab/napari-video/issues"
},
"split_keywords": [],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "53f32212b547306519cbd4d9a446d5a850938f534e3bd7735b0fc53d55514b88",
"md5": "9af828947bc32e8dfe0a984767b92dad",
"sha256": "ddccec9fc065cda4812e95e4856058490fd62db28ae597d35d3f62ddbe9d5b35"
},
"downloads": -1,
"filename": "napari_video-0.2.10-py3-none-any.whl",
"has_sig": false,
"md5_digest": "9af828947bc32e8dfe0a984767b92dad",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 4377,
"upload_time": "2024-10-13T07:39:02",
"upload_time_iso_8601": "2024-10-13T07:39:02.964085Z",
"url": "https://files.pythonhosted.org/packages/53/f3/2212b547306519cbd4d9a446d5a850938f534e3bd7735b0fc53d55514b88/napari_video-0.2.10-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "a6b55f448079146e0765a6de3e2b8b9f8e48c4ed524431a032fb73ee68591cda",
"md5": "ee239d62fcbef44d8e4e19fdc863e026",
"sha256": "79c0d9ae17f51d85dcef2c41d42b207d0a67cbbb0f4a372e09fd34a7834cef1e"
},
"downloads": -1,
"filename": "napari_video-0.2.10.tar.gz",
"has_sig": false,
"md5_digest": "ee239d62fcbef44d8e4e19fdc863e026",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 6340,
"upload_time": "2024-10-13T07:39:04",
"upload_time_iso_8601": "2024-10-13T07:39:04.846268Z",
"url": "https://files.pythonhosted.org/packages/a6/b5/5f448079146e0765a6de3e2b8b9f8e48c4ed524431a032fb73ee68591cda/napari_video-0.2.10.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-13 07:39:04",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "janclemenslab",
"github_project": "napari-video",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "napari_video"
}