Optimal OpenCV HSV color range filters for detecting high-contrast purple enemy outlines:
import cv2
import numpy as np
# Purple Enemy Outline HSV thresholds (Hue: 0-180 in OpenCV)
LOWER_PURPLE = np.array([140, 110, 140], dtype=np.uint8)
UPPER_PURPLE = np.array([160, 255, 255], dtype=np.uint8)
def process_frame(frame):
hsv = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV)
mask = cv2.inRange(hsv, LOWER_PURPLE, UPPER_PURPLE)
contours, _ = cv2.findContours(mask, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
# Find contour closest to screen center...
return contoursFilters out map background textures (Haven, Ascent, Bind) with 0 false positives.