import cv2 cap = cv2.VideoCapture('data/zuqiu.mp4') while cap.isOpened(): ret, frame = cap.read() # 显示文字:图片,文字,位置,字体类型,字体大小,字体颜色,字体粗细 cv2.putText(frame, "foot ball", (10, 30), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 0, 255), 2) cv2.imshow('frame', frame) if cv2.waitKey(1) & 0xFF == ord('q'): break cap.release() cv2.destroyAllWindows()