Machine Vision

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. 




Thanks in advance.

0 Kudos
Message 1 of 4

Went through this


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 4

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 4

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 4