📜  如何在 cv2 中读取视频的帧宽 - Python 代码示例

📅  最后修改于: 2022-03-11 14:47:16.788000             🧑  作者: Mango

代码示例1
import cv2

vcap = cv2.VideoCapture('video.avi') # 0=camera
 
if vcap.isOpened(): 
    # get vcap property 
    width  = vcap.get(cv2.cv.CV_CAP_PROP_FRAME_WIDTH)   # float `width`
    height = vcap.get(cv2.cv.CV_CAP_PROP_FRAME_HEIGHT)  # float `height`
    # or
    width  = vcap.get(3)  # float `width`
    height = vcap.get(4)  # float `height`

    # it gives me 0.0 :/
    fps = vcap.get(cv2.cv.CV_CAP_PROP_FPS)