Detect two Colors

With this template you can detect the color of two objects by counting pixels. Therefore a camera with a color image chip is necessary. The object can be tracked independent of its position and two different regions of interest can be created on the relevant parts of the object. After transforming the image in a binary black and white image the color can be checked by counting pixels in each region of interest. The digital outputs switch if the number of white pixels of each region are within the tolerances.