import cv2 def capture(output_path: str) -> bool: cam = cv2.VideoCapture(0) s, img = cam.read() if s: cv2.imwrite(output_path, img) cam.release() return s