I have the following problem: when detecting a while line under various lighting conditions, a mask (based on HSV) results in good performance in only one scenario (very bright or very shaded areas).
My code is as follows, I am using HSV. The threshold for upper and lower is a constant value (+x/-x); the same constant value for H, S, V
hsv = cv2.cvtColor(crop_img, cv2.COLOR_BGR2HSV) lower_white = np.array([0,0,154], dtype=np.uint8) upper_white = np.array([170,135,255], dtype=np.uint8) # Threshold the HSV image to get only yellow colors mask = cv2.inRange(hsv, lower_white, upper_white)
The results that I get usually work in one case but not the other case. For instance, when the video is in the shaded region it is fine, the white line is the only color seen. Once the video reaches the sunny area, the mask shows everything in white! Could I get help setting the ranges, should I be adjusting H, S, V independently?