✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.
import cv2video_input = cv2.VideoCapture(0)frame_size = (int(video_input.get(3)), int(video_input.get(4)))video_output = cv2.VideoWriter('video.avi', cv2.VideoWriter_fourcc('M', 'J', 'P', 'G'), 20, frame_size)while(video_input.isOpened()): ret, frame = video_input.read() if ret: ... key = cv2.waitKey(20) if key == ord('q'): break else: breakvideo_input.release()video_output.release()cv2.destroyAllWindows()Для наведеного вище коду вкажіть рядки, які треба вставити на місці ..., щоб комп’ютерна програма мовою Python читала та відображала у вікні із заголовком “My Video” відеопотік з веб-камери і зберігала його у файлі з ім’ям “video.avi” за допомогою бібліотеки OpenCV: