Fixed type hints

This commit is contained in:
Kristofers Solo
2022-12-17 16:16:08 +02:00
parent a8220d9a6c
commit 6e97536e3c
2 changed files with 6 additions and 5 deletions

View File

@@ -30,7 +30,7 @@ class TrafficLightDetector:
self.green = Color("GREEN", self.GREEN, self.GREEN_LOWER, self.GREEN_UPPER, hsv, minDist=30, param2=5)
self.colors = [self.red, self.yellow, self.green]
def _draw_circle(self):
def _draw_circle(self) -> None:
try:
for color in self.colors:
if color.circle is not None:
@@ -50,5 +50,6 @@ class TrafficLightDetector:
cv2.circle(self.image_copy, (i[0], i[1]), i[2] + 10, color.color, 2)
cv2.circle(color.mask, (i[0], i[1]), i[2] + 30, (255, 255, 255), 2)
cv2.putText(self.image_copy, color.name, (i[0], i[1]), self.FONT, 1, color.color, 2, cv2.LINE_AA)
logger.debug(color.name)
except AttributeError:
logger.warning("Image/frame was not specified")

View File

@@ -7,14 +7,14 @@ from TrafficLightDetector.traffic_light_detector import TrafficLightDetector
class TrafficLightDetectorImages(TrafficLightDetector):
def __init__(self, path) -> None:
def __init__(self, path: Path) -> None:
self.path = path
self.image = cv2.imread(str(path))
super().__init__(self.image)
image = cv2.imread(str(path))
self._set_image(image)
def _save_image(self) -> None:
cv2.imwrite(str(IMAGES_OUT_PATH.joinpath(self.path.name)), self.image_copy)
def draw(self) -> None:
self._draw_circle(self.image)
self._draw_circle()
self._save_image()