Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

LED On/Off Detection

Hi all,

 

I have this image that I pulled via my Basler camera and NI Vision Assistant. I'm trying to detect if each of the LEDs are on/off, the first thing I've done is extracted the green layer. The two tools I've been using is Line Profile and Histogram where line profile cuts across the LED and Histogram I've put a box over the entire LED. Line Profile looks extremely simple and I may go ahead with that as my option.

 

The camera and UUT may move, so before this step I've added a Find Straight Edge which captured my edge. Then when using either tool the "Reposition Region of Interest" is greyed out and I can't figure out how to use a relative coordinate system against the edge.

 

My 'vision' experience comes from Keyence's vision tools so creating evaluations was a breeze and I'm trying to figure out how to do that with NI Vision Assistant with CVI. I still don't know how this is going to convert into C code nor do I know how to get 'results' of each step of the script or how this tools is to be used really...

 

Below is the unedited image and attached is the script I've worked on. 

 

Unmodified.png

 

Thanks in advance.

0 Kudos
Message 1 of 7
(3,955 Views)

Went through this https://www.ni.com/pdf/manuals/372228p.pdf

 

Now I figured out how to set a coordinate system and generate code. However, still confused how I can get access to the line profile tool. If it was a 2D int array I'd be set. Just don't know what to do here....

0 Kudos
Message 2 of 7
(3,924 Views)

After running the code and looking at each call to IVA_LineProfile_Gray I see my tools being called. Each labelled as roi0-6. Is common practice to use Vision Assistant to generate everything, rename roi0-6 with the respective 'tool name' and make it global so you can access it and make judgements after the full script is run? 

 

Is there anyway for Vision assistant to push the Step Name into roi0-6 so I don't have to manually edit it? Not an issue once all ROI's are stable, but feels like it will be annoying if I have to move/edit the script order. 

0 Kudos
Message 3 of 7
(3,922 Views)

I saw you hadn't had any replies so I thought I'd try to help.

 

I couldn't open your Vision Assistant file. I get an "invalid script file selected" error, which may be because I'm on 2015 and you're likely using a newer version.

 

However, I'm puzzled by the approach you're taking. If you just want to know if each LED is on or off couldn't you do that with thresholding and particle analysis?

 

A couple of other comments if I may.

 

I never use a color camera unless I absolutely have to. It gives you an 8 bit image and saves having to separate out a color plane.

 

It looks as though you're using a short focal length lens and a short working distance, which is distorting where the LEDs appear. Could you go with a longer lens and working distance? And why not aim the camera at the LEDs if that's all you want to see?

 

Last, Vision Assistant is very much just a prototyping tool. I use it for playing around with ideas and experimenting. When I think I have something that's going to work I use the Create LabVIEW VI function and then cut-n-paste the parts I want into a new vi.

 

Hopefully this is of some help. Get back to me with any other questions so I can fail to answer them too.

0 Kudos
Message 4 of 7
(3,897 Views)

Fully agreed the proposal of thresholding and particle analysis in LabVIEW rather than VA.

 

if I may add more about the coordination system. The normal process is as following:

 

In a template:

1) Search a pattern in image which as an "Anchor".

2) Setup the base coordination system based on information(origin, X, Y) extracted from the "anchor".

2) Define the ROI(in your case may be an rectangle to include all LEDs) in base coordination system.

 

For image to inspect:

1) Search the location of pattern save to "Anchor".

2) Update the coordination system based on the new location of "Anchor".

3) Place the ROI in new coordination system(the ROI position relative to Anchor are same)

4) Perform thresholding and particle analysis to detect LED on/off.

 

Gaoke

0 Kudos
Message 5 of 7
(2,901 Views)

选择C代码,在工具中生成代码即可屏幕截图 2022-09-23 210704.png

0 Kudos
Message 6 of 7
(1,875 Views)

There are so many fun ways to make this measurement.  

 

Per other comments, color cameras are never a good idea unless you actually need to extract color data.  Even if the LED change color, it might well be possible to differentiate color differences by using a color filter and sorting by intensity.

 

Color cameras almost all use Bayer Filters to decode color information at the cost of resolution.  In this case resolution does not seem to be a problem.

 

No Matter, if you have a color camera it will work just fine.

 

If the part is fixtured so that the LEDs are in the same place in the image, things get a lot easier, but there is a fiducial mark on the board that can be used as a reference as well.

 

I hope you have already solved the problem.  Keep the thread alive until you do and let us know the final result.

0 Kudos
Message 7 of 7
(1,826 Views)