Get video dimension in python-opencv

后端 未结 5 1160
有刺的猬
有刺的猬 2021-01-07 16:35

I can get size of image, like this:

import cv2

img = cv2.imread(\'my_image.jpg\',0)
height, width = img.shape[:2]

How about video?

5条回答
  •  轮回少年
    2021-01-07 17:08

    width = vcap.get(cv2.CAP_PROP_FRAME_WIDTH )
    height = vcap.get(cv2.CAP_PROP_FRAME_HEIGHT )
    fps =  vcap.get(cv2.CAP_PROP_FPS)
    

    or

    width = vcap.get(3)
    height = vcap.get(4)
    fps = vcap.get(5)
    

提交回复
热议问题