OpenCV加载视频
2020-02-23 本文已影响0人
zqyadam
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()