Numpy视频帧服务器
vidsrc的Python项目详细描述
vidsrc是一个python库,它将视频文件中的帧作为numpy数组读取 通过DirectShow IMediadet接口。
Author: | Christoph Gohlke |
---|---|
Organization: | Laboratory for Fluorescence Dynamics. University of California, Irvine |
Version: | 2019.1.1 |
要求
- CPython 2.7 or 3.5+
- Numpy 1.14
- Microsoft Visual Studio(内部版本)
- DirectX 9.0C sdk(内部版本)
- DirectShow基类包含文件(生成)
- directshow strmbase.lib(生成)
修订版
- 2019.1.1
- 更新版权年。
注释
DirectShow IMediadet接口已弃用,可以从 Windows的未来版本 (https://docs.microsoft.com/en-us/windows/desktop/directshow/imediadet)。
示例
>>> from vidsrc import VideoSource >>> video = VideoSource('test.avi', grayscale=False) >>> len(video) # number of frames in video 48 >>> video.duration # length in s 1.6016 >>> video.framerate # frames per second 29.970089850329373 >>> video.shape # frames, height, width, color channels (48, 64, 64, 3) >>> frame = video[0] # access first frame >>> frame = video[-1] # access last frame >>> for frame in video: ... pass # do_something_with(frame)