opencv-python 读取视频时如何判断读取到最后一张

opencv-python 读取视频时如何判断读取到最后一张

读取视频的代码:
通过 if img is None来判断是否读取到最后一帧

import cv2 as cv

capture = cv.VideoCapture(avipath)
if capture.isOpened():
    while 1:
        ret,img = capture.read()
        if img is None:
            break


你可能感兴趣的:(python,opencv,python-opencv,pytorch,python,计算机视觉)