# Revision history [back]

### Detecting colour under different lighting conditions

G'day, I'm trying to use simplecv to read a gauge needle, which I have seen some others do, and am having success with the following:

img = Image('gauge.jpg')
img = img.colorDistance(color=(172,89,115)).stretch(0,50).binarize()
blobs = img.findBlobs()
print "Found angle: %d" % blobs[0].angle()


Example image:

I have taped a large piece of coloured paper to the needle as the original is just black and very fine, so I could easily use a different colour/shape/whatever. The problem I'm having is that this gauge is in a place where I can't control the lighting very well. So the RGB colour that I'm using here that works may not work well under slightly different lighting conditions.

Does anyone have any suggestions on how I can improve the detection? Is there something I can do besides using the specific RGB color in colorDistance() ?