美文网首页
OpenCV加载视频

OpenCV加载视频

作者: zqyadam | 来源:发表于2020-02-23 22:46 被阅读0次
import cv2

def main():
    cap = cv2.VideoCapture('test.mp4')
    if cap.isOpened():
        ret, frame = cap.read()
    else:
        return

    while (True and ret):
        cv2.imshow('video', frame)

        if cv2.waitKey(40) & 0xff == ord('q'):
            break
        ret, frame = cap.read()

    cap.release()
    cv2.destroyAllWindows()


if __name__ == "__main__":
    main()

相关文章

网友评论

      本文标题:OpenCV加载视频

      本文链接:https://www.haomeiwen.com/subject/tgueqhtx.html