如何在python中将视频转换为时空卷 [英] How to convert video to spatio-temporal volumes in python

查看:91
本文介绍了如何在python中将视频转换为时空卷的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在做视频分析方面的项目.我必须密集采样视频.采样是指将视频转换为时空视频量.我正在使用python语言.我该如何在python中做到这一点?该选项在opencv或任何其他软件包中可用吗?输入视频序列和所需的输出显示在

I am doing my project in video analytics. I have to densely sample video. Sampling means converting video to spatio-temporal video volumes. I am using the python language. How can I do that in python? Is that option available in opencv or any other package? Input video sequence and desired output is shown

推荐答案

使用

cap = cv2.VideoCapture(fileName)

遍历每帧:

while(cap.isOpened()):

    # Read frame
    ret, frame = cap.read()

如果需要,您可以将每一帧插入3D矩阵中以获得所需的时空矩阵

If you want you can just insert every frame to a 3D matrix to get the spatio-temporal matrix that you wanted

这篇关于如何在python中将视频转换为时空卷的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆