Python OpenCV video.get(cv2.CAP_PROP_FPS)返回0.0 FPS [英] Python OpenCV video.get(cv2.CAP_PROP_FPS) returns 0.0 FPS
本文介绍了Python OpenCV video.get(cv2.CAP_PROP_FPS)返回0.0 FPS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我的视频
这是找到fps的脚本:
This is the script to find fps:
import cv2
if __name__ == '__main__' :
video = cv2.VideoCapture("test.mp4");
# Find OpenCV version
(major_ver, minor_ver, subminor_ver) = (cv2.__version__).split('.')
if int(major_ver) < 3 :
fps = video.get(cv2.cv.CV_CAP_PROP_FPS)
print "Frames per second using video.get(cv2.cv.CV_CAP_PROP_FPS): {0}".format(fps)
else :
fps = video.get(cv2.CAP_PROP_FPS)
print "Frames per second using video.get(cv2.CAP_PROP_FPS) : {0}".format(fps)
video.release();
这是该视频的脚本输出:
Frames per second using video.get(cv2.CAP_PROP_FPS) : 0.0
This is the output of the script for this video:
Frames per second using video.get(cv2.CAP_PROP_FPS) : 0.0
为什么它返回0.0? FPS为14.0
Why is it returning 0.0? The FPS is 14.0
推荐答案
执行pip install python-opencv
解决了该问题,并且可以正确检测到FPS.
Performing pip install python-opencv
fixed the problem and the FPS is correctly detected.
这篇关于Python OpenCV video.get(cv2.CAP_PROP_FPS)返回0.0 FPS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文