无法获取VideoCapture属性,因为未定义属性标识符 [英] Can't get VideoCapture property as the property identifier are not defined

查看:912
本文介绍了无法获取VideoCapture属性,因为未定义属性标识符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试处理视频文件中的帧,并知道视频中当前帧的位置.

cap = cv2.VideoCapture('Videos/IMG_2483.MOV')
print("Position : %d" % cap.get(cv2.CV_CAP_PROP_POS_MSEC))

我一直收到此错误:

AttributeError: 'module' object has no attribute 'CV_CAP_PROP_POS_MSEC'

我猜我错误地将属性称为"CV_CAP_PROP_POS_MSEC".我到处都在看,但是我想不通.

提前谢谢!

解决方案

在您安装的Opencv版本中似乎已弃用CV_CAP_PROP_POS_MSEC,请将其更改为cv2.CAP_PROP_POS_MSEC.在Opencv 3.1上对我有用

I am trying to process frames in a video file, and to know what is the current frame position in the video.

cap = cv2.VideoCapture('Videos/IMG_2483.MOV')
print("Position : %d" % cap.get(cv2.CV_CAP_PROP_POS_MSEC))

I keep getting this error :

AttributeError: 'module' object has no attribute 'CV_CAP_PROP_POS_MSEC'

I guess I am wrongly calling the attribute "CV_CAP_PROP_POS_MSEC". I've been looking everywhere but I can't figure it out.

Thanks in advance!

解决方案

It seems that CV_CAP_PROP_POS_MSEC is deprecated in your installed version of Opencv, Change it to cv2.CAP_PROP_POS_MSEC. Works good for me on Opencv 3.1

这篇关于无法获取VideoCapture属性,因为未定义属性标识符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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