答案 0 :(得分:0)
您可以添加一个循环以显示您使用的窗口,并将键的条件添加到您批准关闭窗口的waitKey中(例如esc)
while video.isOpened(): #Starting a loop to play the video continuously
ret, frame = video.read()
if not ret:
break
cv2.imshow('Video Player',frame) # Display the video
k = cv2.waitKey(0) & 0xFF
if k == 27: # Use Esc key to exit the program
break