From f3beb334668a0d878c3d9d61224c9f25ec1f3da5 Mon Sep 17 00:00:00 2001 From: rpi Date: Thu, 4 May 2023 07:58:30 +0100 Subject: [PATCH] fix: refresh cam --- led_control.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/led_control.py b/led_control.py index 50da410..486078a 100644 --- a/led_control.py +++ b/led_control.py @@ -30,7 +30,7 @@ FORMAT = ".jpg" PROMPT = "> " filename = None -cam = cv2.VideoCapture(0) +cam = cv2.VideoCapture() if not DEBUG: import RPi.GPIO as GPIO @@ -105,8 +105,10 @@ def parse_s3_url_payload(payload): def take_picture(): + cam.open(0) ret, frame = cam.read() ret, img = cv2.imencode(FORMAT, frame) + cam.release() return img.tobytes()