Skip to content
Snippets Groups Projects
Commit f9a13668 authored by Lukas Hoffleit's avatar Lukas Hoffleit
Browse files

Rot funktioniert jetzt

parent 8e107f55
Branches
Tags
No related merge requests found
...@@ -2,7 +2,7 @@ import cv2 ...@@ -2,7 +2,7 @@ import cv2
import numpy as np import numpy as np
class MarkerDetector: class MarkerDetector:
def __init__(self, camera_index=0): def __init__(self, camera_index=4):
""" """
Initialize the detector to find markers anywhere in the frame. Initialize the detector to find markers anywhere in the frame.
""" """
...@@ -52,8 +52,19 @@ class MarkerDetector: ...@@ -52,8 +52,19 @@ class MarkerDetector:
for contour in green_contours: for contour in green_contours:
self._process_contour(contour, 'O') self._process_contour(contour, 'O')
# lower mask (0-10)
lower_red = np.array([0,30,30])
upper_red = np.array([10,255,255])
mask0 = cv2.inRange(hsv, lower_red, upper_red)
# upper mask (170-180)
lower_red = np.array([170,30,30])
upper_red = np.array([180,255,255])
mask1 = cv2.inRange(hsv, lower_red, upper_red)
red_mask = mask0 + mask1
# Detect red (X) markers # Detect red (X) markers
red_mask = cv2.inRange(hsv, self.red_lower, self.red_upper) #red_mask = cv2.inRange(hsv, self.red_lower, self.red_upper)
red_contours = self._find_valid_contours(red_mask) red_contours = self._find_valid_contours(red_mask)
for contour in red_contours: for contour in red_contours:
self._process_contour(contour, 'X') self._process_contour(contour, 'X')
...@@ -85,9 +96,6 @@ class MarkerDetector: ...@@ -85,9 +96,6 @@ class MarkerDetector:
if __name__ == "__main__": if __name__ == "__main__":
detector = MarkerDetector() detector = MarkerDetector()
print("Starting Marker Detection. Press 'q' to quit.")
while True: while True:
success = detector.update() success = detector.update()
if success: if success:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment