Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

VBAI - Calibrate Image Case Structure?

Solved!
Go to solution

Currently we have an inspection file in VBAI 2015 that is used across a variety of different stations to measure distances on printed cards. In this inspection file, I have a large list of states (20 options... really it's a switch statement) simply for changing which calibration data I'm using. I do a mixture of read a barcode/perform OCR and determine what calibrated template I'm looking at before providing measurements to the end user so I take that data to determine which transition to any of the 20 calibration states to run. A calibration state is made up of the Calibrate Image step, and a Set Variable state.

 

If I were doing something in LabVIEW I'd just drop a case structure with an enum containing all added stations and call the relevant subVI (or maybe go OOP and just use Dynamic Dispatch) - but this isn't LabVIEW... I do understand there's the ability to run a LabVIEW VI, but wouldn't this require the Vision Development Module (I don't have it)? I have the VBAI API installed, but afaik that's just to load/run/close inspections and get results from them.

I was just asked to add more states (27). Is there a more scalable way to do this (without the Vision Development Module)? I'm just concerned about how much clutter this is about to add to my inspection file (see the attached image). I am not aware of any way to control the Calibrate Image step and dictate which calibration to use aside from navigating into it and managing its configuration that way (hence having 20 different states).

Making a separate inspection file for each station would introduce a different (and imo way worse) scalability problem since this is packaged with test software my team distributes across our manufacturing floor.

Other things to note:
- I can't use VBAI 2018, VBAI 2018 SP1, or VBAI 2019 (at least last I checked) with the current API I'm using in a 64-bit .NET application. 64-bit isn't supported by the open-sourced API found at https://github.com/ni/vbai-dotnet

0 Kudos
Message 1 of 5
(2,707 Views)

You don't need VDM to call Run LabVIEW VIs that use VDM functions, but you would need VDM to create the VI in the first place. If all you need to do is have a VI that you can specify a calibration file path and pass in the image and apply the calibration info from the file to the image passed in, you can try using the attached VI. I would recommend getting VDM for your development machine where you can make these VIs on your own, and then you can distribute it with your VBAI inspection and won't need VDM on the other machines, just VBAI.

 

Hope that helps,

Brad

Message 2 of 5
(2,594 Views)
Solution
Accepted by topic author Nestarion

I think there is a more elegant way of doing that without using a Run LabVIEW step. The calibration step takes a previous measurement as an input. I would recommend using a Calculator step, where you would enter your part number as an input, and output the calibration name as a string.

Unfortunately, in VBAI 2015, the Calculator step does not support a case structure, but you can still use the selector to select the correct calibration name for the output. The code will be a bit messy, but you can definitely do it.

Then insert the calibration step and select the string output of the Calculator step for the calibration name.

This requires that you create all your calibrations up front.

This should work. Let me know if these instructions are enough or if you need an example.

 

Hope this helps.

 

Christophe

Message 3 of 5
(2,584 Views)

Christophe, all of our calibration data is created up front prior to being released so this worked perfectly.

 

I wish VBAI 2015 had a diagram cleanup tool; at least it has the ability to align elements vertically/horizontally. It turned out less messy than I was expecting because I'm using an array search (why is there no array constant???).

0 Kudos
Message 4 of 5
(2,563 Views)

No array constant in the calculator step? You 're right. We could have exposed it on the palette. You can create one by dropping for example an array search and doing a create constant the array input, then delete the array element and drop the constant of the right data type in there.

Another way to create a constant array is to declare it as a variable in the variable manager, then use the Set Variable step to initialize it.

You can then use it in any step that uses previous results as an input.

Message 5 of 5
(2,554 Views)