From ea3855f0ed20fcb840ec809e26be937a6db99388 Mon Sep 17 00:00:00 2001 From: karl Date: Tue, 1 Feb 2022 12:00:47 +0100 Subject: [PATCH] Adapt to rpi-camera --- detect.py | 9 ++++++++- requirements.txt | 4 ++++ 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 requirements.txt diff --git a/detect.py b/detect.py index 162452f..a6d96d9 100755 --- a/detect.py +++ b/detect.py @@ -9,8 +9,15 @@ import numpy as np from skimage import io import colorsys -img_path = 'IMG_20211204_220355.jpg' +img_path = 'input.jpg' +from picamera import PiCamera +camera = PiCamera() +time.sleep(2) # wait for the camera to initialize +camera.capture(img_path) + + +# Read the result img = io.imread(img_path)[:, :, :] # Average color diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..e20a3bc --- /dev/null +++ b/requirements.txt @@ -0,0 +1,4 @@ +picamera +opencv-python +matplotlib +numpy