01-10-2018 12:47 AM
Hi,
I need to detect the position of DIP switches using NI Vision Builder. The method I have tried is first to create an intensity plane, threshold the image, detect objects and measure the distance between found objects. Then I try to deduce the position of the switch based on the distance between objects.
The main problems are wrong objects detected and not all DIP switches detected. Is there any other ways or suggestions how to approach the challenge? This seems to be a tricky one.
I attached four example images and vbai which I have tried.
Any help would be appreciated.
Br,
Jick
01-10-2018 09:00 AM
I would try drawing a line across the switches. If you position it right, you will see white for OFF switches and dark for ON switches. You should know where each switch will be, so you can just go across the line and read the On/Off status at each position.
With VBAI, you may need to draw a small box for each switch and look at them one at a time. The single line might only work in LabVIEW.
Bruce
01-10-2018 09:20 AM
Can you reposition the camera to be looking at the dip switches straight on? If not, you could consider using a mirror to get a view of the DIP switches that don't overlap each other. The current angle makes it very difficult to tell if a DIP switch is up or down because adjacent switches can cover the area where the UP/DOWN position would be.
01-11-2018 01:41 AM
Hi,
The thing is that I cannot move the camera. Have to think about the mirror too.
Drawing a line might work but the problem in this case is that I have to find the DIP switch row position exactly from the image because there might be some shifting depending on the platform and the unit under test. Even though the camera position will be roughly calibrated, it is not 100% sure it is at the same position each time.
I am now trying to use Match Pattern step and teach it different kind of combinations of switches using template images. This seems to be quite good method but disadvantage is that there is a lot of combinations to teach.
Br,
Jick
01-11-2018 08:59 AM
Here's a method that works well.
Use Pattern Matching to find location and create Coordinate System.
Create Measure Intensity using the Coord System to reposition for each DIP. Have the Measure Intensity use a small ROI exactly where the DIP switch would be when it's up. If the Avg. Intensity isn't ~150, the DIP switch is down.
I attached a sample inspection to illustrate this. This will be much better than learning all the PM combinations.
Hope this helps,
Brad
01-17-2018 12:54 AM
Thanks for your reply. I get a warning message from Match Pattern 1 when opening your vbai (see attachment) and the rest of the steps fails after that.
Did you manage to get reliable reference point for the coordinate system which is detected every time? I am asking because it was difficult to find anything unique from the image for the Coordinate System step.
-Jick
01-17-2018 08:31 AM
Sorry, I forgot I was using pre-release DLLs for PM. Here's an updated VBAI inspection that should work for you.
Thanks,
Brad
01-18-2018 07:24 AM - edited 01-18-2018 07:29 AM
Thanks a lot, it seems to work. I just have to fine tune pass/fail limits due to surrounding lights.
-Jick
01-18-2018 07:19 PM
Thanks a lot, it worked fine with my own DIP switches too