Picking HSV thresholds that survive daylight
Thresholds tuned under office lights fail by the window. Two things help: equalise the V channel with CLAHE before thresholding, and keep the S lower bound generous.
hsv = cv2.cvtColor(img, cv2.COLOR_BGR2HSV) h, s, v = cv2.split(hsv) v = cv2.createCLAHE(clipLimit=2.0, tileGridSize=(8, 8)).apply(v) mask = cv2.inRange(cv2.merge((h, s, v)), (35, 60, 40), (85, 255, 255))