Ask Your Question

Revision history [back]

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

  1. Load BGR Image from File
  2. Convert that into HSV format by using cvtcolor()
  3. Create an Gray image Mask Mat
  4. Find the HSV Range of LED in ON State & in OFF State [Note]Opencv uses Hue Range from 0-180.
  5. Find the LED ON State Color Mask of the image by using the function cvInRange()
  6. 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.