Opencv color segmentation of traffic signs: HSV ranges I am working on a project to detect and recognize signs in images from the LISA Traffic Sign Dataset. Since the images are very noisy (in regard to background) I am trying to segment the signs based  on their color using HSV and cv2.inRange().

The problem I am running into is my algorithm is segmenting far too much of the image. For example, when I try to segment the image based on different variations of yellow/orange for a "nice" image I get the following, without any false positives:



However, on images that are at a later point in the day, I receive the following:



I have played with the values for hours now, and cannot seem to find a happy medium that doesn't select both yellow and green in images. I was hoping the community could help provide some insight, since I've been scouring the web looking for examples of what I'm trying to accomplish for several days. I understand there are many examples of this being done in academic and scholarly paper/journals however I have no clue how to convert the complicated formulas they use into code. 

Here is the relevant python code:

# the below is pairs of yellow and red respectively
hsv_color_pairs = (
    (np.array([21, 100, 75]), np.array([25, 255, 255])),
    (np.array([1, 75, 75]), np.array([9, 225, 225]))
)
...
# this code is in a for loop and loops over the above HSV color ranges
mask = cv2.inRange(hsv, colors[0], colors[1])
out = cv2.bitwise_and(im, im, mask=mask)
blur = cv2.blur(out, (5, 5), 0)
imgray = cv2.cvtColor(blur, cv2.COLOR_BGR2GRAY)
ret, thresh = cv2.threshold(imgray, 0, 255, cv2.THRESH_OTSU)

heir, contours, _ = cv2.findContours(thresh, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)


so to sum things up, my question is: what are some tips/tricks I can use to segment the images for the specific colors of the orange/yellow warning signs with regard to shadows/exposure without picking up other colors such as green.

Thanks all!
To those looking at this in the future, I realized I was being silly and forgot how HSV worked! To pick up the yellow more so than the green I needed to heighten the threshold of the saturation value within the range!

As a side note, I also was able to "normalize" the colors of the image a bit more by converting to Lab color space and applying CLAHE (for localized histogram equalization) and as well on the saturation values within the HSV color space. This allowed me to get the signs in ideal lighting conditions almost 100% of the time (roughly speaking of course) with very little false positives, but didn't really alleviate my problems on images with a redish/orangeish hue as seen in the second example image. But, as was mentioned by harshkn, this approach is very simple so I suppose I can only ask for so much success! Thanks to all who replied with suggestions!