initial implementation of kuukar_cv

This commit is contained in:
Siwat Sirichai 2022-11-14 11:14:27 +07:00
parent d0999b8307
commit 03f6dd41e2
2 changed files with 22 additions and 8 deletions

View File

@ -1,17 +1,30 @@
from kuukar.kuukar_lcd import lcd from kuukar.kuukar_lcd import lcd
from kuukar.kuukar_leds import leds from kuukar.kuukar_leds import leds
import threading
import multiprocessing
import cv2
class cv: class cv:
def __init__(self, lcd: lcd, leds: leds) -> None: def __init__(self, lcd: lcd, leds: leds) -> None:
self.lcd = lcd self.lcd = lcd
self.leds = leds self.leds = leds
self.camera = cv2.VideoCapture(0)
threading.Thread(target=self._cv_loop).start()
def _cv_loop(self):
while True:
img = self.capture_image()
stop_sign = self.detect_sign(img)
def capture_image(self): def capture_image(self):
pass ret, frame = self.camera.read()
return frame
def detect_face(self, image): def detect_sign(self, frame):
pass stopsign_cascade = cv2.CascadeClassifier('./stopsign_good.xml')
image = frame.array
def handle_face_detected(self): gray_img=cv2.cvtColor(image,cv2.COLOR_BGR2GRAY)
pass found_stopsigns=stopsign_cascade.detectMultiScale(gray_img,1.1,5)
return found_stopsigns

View File

@ -1,3 +1,4 @@
telemetrix-rpi-pico telemetrix-rpi-pico
pyaudio pyaudio
flask flask
opencv-python