diff --git a/cat.png b/cat.png new file mode 100644 index 0000000..d730aad Binary files /dev/null and b/cat.png differ diff --git a/image.py b/image.py new file mode 100644 index 0000000..2999689 --- /dev/null +++ b/image.py @@ -0,0 +1,23 @@ +import time + +import Adafruit_GPIO.SPI as SPI +import Adafruit_SSD1306 + +from PIL import Image + +RST = 24 +disp = Adafruit_SSD1306.SSD1306_128_32(rst=RST) + +disp.begin() +disp.clear() +disp.display() + +image = Image.open('cat.png').convert('1') + +def cat(): + disp.image(image) + disp.display() + +def no_cat(): + disp.clear() + disp.display() diff --git a/main.py b/main.py index e0e5f6d..5c4d3d9 100644 --- a/main.py +++ b/main.py @@ -5,6 +5,8 @@ import importlib.util from threading import Thread import time +from image import * + IM_WIDTH = 1280 IM_HEIGHT = 720 @@ -110,7 +112,11 @@ def pet_detector(frame, detection_time): detection_time += 1 else: detection_time = 0 - print(detection_time) + no_cat() + print(detection_time) + if detection_time >= 2: + cat() + return frame, detection_time