OpenCV/Python: read specific frame using VideoCapture

后端 未结 5 994
温柔的废话
温柔的废话 2021-01-30 16:34

Is there a way to get a specific frame using VideoCapture() method?

My current code is:

import numpy as np
import cv2

cap = cv2.VideoCaptur         


        
5条回答
  •  南笙
    南笙 (楼主)
    2021-01-30 17:10

    For example, to start reading 15th frame of the video you can use:

    frame = 15
    cap.set(cv2.CAP_PROP_POS_FRAMES, frame-1)
    

提交回复
热议问题