Get video dimension in python-opencv

后端 未结 5 1072
有刺的猬
有刺的猬 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:46

    cv2.__version__
    '3.4.3' 
    
    w = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH))
    h = int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT))
    fps = int(cap.get(cv2.CAP_PROP_FPS))
    n_frames = int(cap.get(cv2.CAP_PROP_FRAME_COUNT))
    

提交回复
热议问题