Hi @robyf1!
The easiest way to detect & segment the LED's is by using Color Based method. You can achieve this by the following steps
- Load BGR Image from File
- Convert that into HSV format by using cvtcolor()
- Create an Gray image Mask Mat
- Find the HSV Range of LED in ON State & in OFF State
[Note]Opencv uses Hue Range from 0-180.
- Find the LED ON State Color Mask of the image by using the function cvInRange()
- Find Contours & count the number of contours present in the Mask image. Filter the contours with respect to area if needed.
You can refer this link for reference.