File size: 579 Bytes
5778f20
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import cv2
import rich

if __name__ == '__main__':
    videoCapture = cv2.VideoCapture('niuzi.mp4')

    # 创建一个窗口,并设置大小
    cv2.namedWindow('sudemo', cv2.WINDOW_NORMAL)
    cv2.resizeWindow('sudemo', 800, 600)  # 设置窗口的宽度和高度

    while True:
        ret, frame = videoCapture.read()
        if not ret:
            rich.print("播放完毕")
            break
        else:
            cv2.imshow('sudemo', frame)

        if cv2.waitKey(25) & 0xFF == ord('q'):
            break

    videoCapture.release()
    cv2.destroyAllWindows()