Get video dimension in python-opencv

后端 未结 5 1163
有刺的猬
有刺的猬 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 16:43

    For the 3.3.1 version, the methods have changed. Check this link for the changes: https://docs.opencv.org/3.3.1/d4/d15/group__videoio__flags__base.html#ga023786be1ee68a9105bf2e48c700294d

    Instead of cv2.cv.CV_CAP_PROP_FRAME_WIDTH use cv2.CAP_PROP_FRAME_WIDTH and others as necessary from the link above.

提交回复
热议问题