Machine Vision

Showing results for 
Search instead for 
Did you mean: 

Ring type LED color matching

Go to solution

Hi friends 

I am working in one testing machine.

This led color verification is one of the functional test present.

Need to switch on the led through modbus communication, capture image through bastler camera , Check the current led color is matching with our master image or not

Give me your suggestion to achieve this  

LED images attached


Thanking You

Download All
0 Kudos
Message 1 of 4

In the color processing tools there are a couple of options for training colors then matching them.  Check the examples for how to use them.


For one of my programs, I created my own for speed.  Draw an ROI that only includes the color of interest.  In this case it would be an annulus.  You might need to use other tools to locate the annulus if it moves around.  Use the color histogram to find the median brightness for each of the colors (mode would probably be fine).  The RGB values are your color.


Record the RGB values for each of your colors, as well as any other cases that could come up (black, white maybe).  This will give you five or six colors for matching.  During testing, loop through the colors and measure the distance between the test result and the trained color (square R,G,B differences, sum and square root).  The min distance will be the best match.  You could also check the magnitude of the min distance to see if it is small enough if the precise color is important.



Bruce Ammons
Ammons Engineering
0 Kudos
Message 2 of 4

Hi sir

Thanks for reply 

I am new for image processing 

Can u please give some sample vi for reference

0 Kudos
Message 3 of 4
Accepted by topic author kps001

Because you have a dark background, and because I did not feel like defining an ROI, much less deal with tracking an object in image space, I cheated.


By running the image through Color Histograph VI, and sorting by HUE, the result is a spectral chart of the color of the lamp. The VI sorts the colors into 256 bins, the first bin being black in this case, and because it takes up most of the image the number of pixels in this bin is massive.. It's easy to filter out the background bin, by using the Delete From Array VI to delete the first few values of the array. What's left is sort of a spectrogram of the colors.  Looking at the location of the Max Value of the spectrogram tells you what bin the peak is in.  From there its easy enough find the value for each color, and record that as a constant.  Add some space around the value for tolerance, and you generate an output for each color.


It's a pretty simple VI.  . I am no master coder, and am sure it's open to improvement.


Comments welcome.

0 Kudos
Message 4 of 4