To find the threshold values whether RGB/HSL/Whatever I found it easiest to use the NI Vision Assistant, i believe it comes with the labview install, if you didn't install labview you might be able to just install the Vision Assistant, but i'm not sure. Either way it's pretty easy - either acquire an image from your axis camera directly into the VA or open an existing image like the one you posted.
Then go to "Process Images"
Then off the color menu choose color threshold
You can look at the image below for reference on the rest.
1. Choose HSL(Blue arrow), you'll see the H/S/L Histograms change to show those values
2. Now (purple/green arrows) with your mouse select rectangular areas in the picture that represent what you want to select, you can hold down ctrl to select multiple areas. As you do this you'll see the histograms change to only show the values of the are you selected (inclusive of all areas you chose)
3. Now change the red/blue threshold markers on each histogram (dark red arrows) you can drag the blue/red lines or change the min/max values on each one. The spots on the image that match your threshold mark will get colored with the "preview color" default is red... So in the image below you can see i got most of your areas, but not parts of the left - their values are outside the thresholds so now i could just easily draw another box around the spots it didn't get and expand the thresholds to catch it all...
I would also suggest you play with RGB thresholds, i found that worked best for us last year, especially with a green light.
Lastly you can test every operation you're doing in code with vision assistant before you code it, if you click oK on the threshold, you'll see that action added to the script list on the bottom right, then you can add each operation in serial to replicate your intended code then you can test the outcome and play with values for each operation to make sure they'll work on the robot.
Have fun and good luck!
