# Path: navigation/ObjectDetector.py
# class ObjectDetector(metaclass=abc.ABCMeta):
#     def __init__(self):
#         self._detected = False
#         self._circle_coordonates = None
# 
#     @abc.abstractmethod
#     def process(self, image):
#         pass
# 
#     @property
#     def detected(self):
#         return self._detected
# 
#     @property
#     def circle_coordonates(self):
#         return self._circle_coordonates
# 
#     @detected.setter
#     def detected(self, value):
#         self._detected = value
# 
#     @circle_coordonates.setter
#     def circle_coordonates(self, value):
#         self._circle_coordonates = value


import cv2
from navigation.ObjectDetector import ObjectDetector



class ColoredObjectDetector(ObjectDetector):
    def __init__(self, hsv_bounds):
        self.__hsv_bounds = hsv_bounds
        super().__init__()

    def process(self, image):
        self.detected = False
        hsv_frame = cv2.cvtColor(image, cv2.COLOR_BGR2HSV)
        mask = cv2.inRange(hsv_frame, self.__hsv_bounds[0], self.__hsv_bounds[1])
        mask = cv2.erode(mask, None, iterations=2)

# Path: navigation/ObjectDetector.py
# class ObjectDetector(metaclass=abc.ABCMeta):
#     def __init__(self):
#         self._detected = False
#         self._circle_coordonates = None
# 
#     @abc.abstractmethod
#     def process(self, image):
#         pass
# 
#     @property
#     def detected(self):
#         return self._detected
# 
#     @property
#     def circle_coordonates(self):
#         return self._circle_coordonates
# 
#     @detected.setter
#     def detected(self, value):
#         self._detected = value
# 
#     @circle_coordonates.setter
#     def circle_coordonates(self, value):
#         self._circle_coordonates = value


# Path: navigation/ColoredObjectDetector.py
import cv2
from navigation.ObjectDetector import ObjectDetector




class ColoredObjectDetector(ObjectDetector):
    def __init__(self, hsv_bounds):
        self.__hsv_bounds = hsv_bounds
        super().__init__()

    def process(self, image):
        self.detected = False
        hsv_frame = cv2.cvtColor(image, cv2.COLOR_BGR2HSV)
        mask = cv2.inRange(hsv_frame, self.__hsv_bounds[0], self.__hsv_bounds[1])
        mask = cv2.erode(mask, None, iterations=2)

        mask = cv2.dilate(mask, None, iterations=2)