aranga
aranga

Reputation: 377

How to detect a defective LED in an Image

In my project i have a set of led's in a board with same pattern.While seeing that led's using a camera,found white holes in an image.(first attachment)

(1). My first requirement is i need to find No of working and not working led's.This one is much easier when i used blob detection using opencv. i found successfully.

(2). My second requirement is i need to draw working led's in green color and not working led's in red color.i was struggled here.

if all the led's are working properly i got the center of all the blobs easily and using that center points i was drawn in green color.But the problem is if any one led's are not working.i did not get any white hole in an image.I did not get any blobs in the image.How can i draw a not working led in red color.

please find the attachment below which is useful to understand my problem.Thanks in advance

enter image description here Input Image
enter image description here

if all the led's are working i drawn like this

enter image description here One led Was not working.Now i need to identify that not working led and i will draw it in a red color like my fourth attachment. enter image description here

Upvotes: 1

Views: 1267

Answers (2)

Alessandro Jacopson
Alessandro Jacopson

Reputation: 18675

As Francesco wrote in his answer, if these assumptions are valid:

  1. the sizes of the LEDs, as seen in the image, are constant and known;
  2. the arrangements of the LEDs is constant and known;
  3. a working LED gives bright grey levels, a not working LED gives dark grey levels;

then, as suggested by Rethunk, you can try a simple algorithm like this one:

  1. Start from your image https://i.sstatic.net/OC0lr.jpg where all the LED are working.
  2. Get from that image the centroids of all the green blobs, call them c_i
  3. Get from that image the radius of all the green blobs, call them r_i
  4. When you have to inspect a new image: for each c_i compute the histogram of the pixels contained in a circle centered at c_i and with radius equal to a_i*r_i (where 0 < a_i <= 1). If a percentage p_i of the number of pixels considered in the histogram have the grey level greater than a threshold t_i then draw a green disk centered at c_i with radius a_i*r_i, else, draw a red disk.

Find with some experiments the right values for a_i, p_i, t_i.

Upvotes: 0

Francesco Callari
Francesco Callari

Reputation: 11825

If the LED arrangement and scale is constant (which probably should be, if this is a manufactured part), can't you just register to the test image a "reference" one with all the LEDs working, and then find blob-sized-and-shaped mismatches, which would be indicative of a malfunctioning device?

Upvotes: 3

Related Questions