imp pen tro release cap show read waitkey python

# -*- coding: utf-8 -*-

import cv2
import numpy as np

cap = cv2.VideoCapture("test.avi")
while True:
    # get a frame
    ret, frame = cap.read()
    # show a frame
    cv2.imshow("capture", frame)
    if cv2.waitKey(100) & 0xFF == ord(q):
        break
cap.release()
cv2.destroyAllWindows() 

Python OpenCV 讀取視頻文件