2022-10-30 08:57:00 +00:00
|
|
|
from kuukar.kuukar_lcd import lcd
|
|
|
|
from kuukar.kuukar_leds import leds
|
2022-11-14 04:14:27 +00:00
|
|
|
import threading
|
|
|
|
import multiprocessing
|
|
|
|
import cv2
|
|
|
|
|
2022-10-23 06:49:59 +00:00
|
|
|
|
2022-10-25 15:01:26 +00:00
|
|
|
|
2022-10-22 12:39:10 +00:00
|
|
|
class cv:
|
2022-10-25 07:49:19 +00:00
|
|
|
def __init__(self, lcd: lcd, leds: leds) -> None:
|
2022-10-23 06:49:59 +00:00
|
|
|
self.lcd = lcd
|
|
|
|
self.leds = leds
|
2022-12-12 09:10:23 +00:00
|
|
|
#self.camera = cv2.VideoCapture(0)
|
|
|
|
#threading.Thread(target=self._cv_loop).start()
|
2022-10-25 15:01:26 +00:00
|
|
|
|
2022-11-14 04:14:27 +00:00
|
|
|
def _cv_loop(self):
|
|
|
|
while True:
|
|
|
|
img = self.capture_image()
|
2022-12-11 14:34:17 +00:00
|
|
|
##stop_sign = self.detect_sign(img)
|
2022-11-14 04:14:27 +00:00
|
|
|
|
2022-12-11 04:24:46 +00:00
|
|
|
def get_road_curve(self, frame):
|
|
|
|
pass
|
2022-10-25 15:01:26 +00:00
|
|
|
|
2022-11-14 04:14:27 +00:00
|
|
|
def capture_image(self):
|
|
|
|
ret, frame = self.camera.read()
|
|
|
|
return frame
|
2022-12-11 04:24:46 +00:00
|
|
|
|
2022-11-14 04:14:27 +00:00
|
|
|
def detect_sign(self, frame):
|
|
|
|
stopsign_cascade = cv2.CascadeClassifier('./stopsign_good.xml')
|
|
|
|
image = frame.array
|
|
|
|
gray_img=cv2.cvtColor(image,cv2.COLOR_BGR2GRAY)
|
|
|
|
found_stopsigns=stopsign_cascade.detectMultiScale(gray_img,1.1,5)
|
|
|
|
return found_stopsigns
|
2022-12-12 09:10:23 +00:00
|
|
|
|