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()