Hi Amir -
Are you using a color camera? If so, I recommend using the
Color Matching or
Color Location functions instead. These will examine the hue spectrum of your ROI, which disregards saturation and intensity changes. This will eliminate many of the problems you'll face when trying to work under different lighting conditions. (Chapter 15 of the
Vision Concepts Manual explains this advantage more fully.)
If you are using a B&W camera, I have this question: Is the LED moving within the frame, or is its pixel location static every time? If it does not move, then I recommend examination of the average pixel intensity in the region (with a
Histogram or
Histograph) instead of trying to match a specific pattern. You'll find more success this way, since the entire average should be different between the "off" and "on" conditions.
If neither of these options seems viable, please give me more details about your setup so I can see what we can do.
David Staab, CLA
Staff Systems Engineer
National Instruments