Python用OpenCV播放视频迟缓这个问题谁能帮我解决一下,要改进的代码在下面,谢谢
import cv2 as cv
cap = cv.VideoCapture('XXX.mp4')
while cap.isOpened():
ret, frame = cap.read()
if not ret:
break
k = cv.waitKey(1)
if (k & 0xff == ord('q')):
break
gray = cv.cvtColor(frame, cv.COLOR_BGR2GRAY)
cv.imshow('', gray)
cv.imshow('', frame)
cap.release()
cv.destroyAllWindows()