LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Store/communicate IMAQ (binary) image between case structures

Solved!
Go to solution

Hi all,

 

I'm trying to build a VI for a machine-vision controlled setup and that constists of 2 process: first a calibration image is generated from a discrete sequence of images. After, the user can start and pause the continuous machine-vision controlled process. This process then uses the calibration image to remove some background artefacts etc.

Since the two processes cannot run at the same time, I have programmed it as an event-driven state machine (following this tutorial: https://www.youtube.com/watch?v=RuIN31rSO2k) combined with continuous acquisition.

 

My question is how to store and communicate the calibration image between the case structures. It's basically a static image that is generated once at the beginning of a run and then used during the continuous control loop.

For now I tried storing it in an IMAQ Control with a local variable, but that fails when I try to read out the image. Preferably the image should be passed on in the background without any front panel interference. I could probably get it to work if I pass on the image as an array and then converting it back, but I want to avoid unnecessary conversions and understand how to correctly handle images.

 

Attached is the codeblock showing the part where I (attempt to) store the image, and the way the continuous measurement process is connected (yes, I know the live view is wired incorrectly in the latter schematic, it was a test to show a colleague).

 

Thanks in advance for any help!

Download All
0 Kudos
Message 1 of 6
(3,039 Views)
Solution
Accepted by topic author irPaul

Consider putting the image data into a shift register on your main WHILE loop.

 

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 2 of 6
(3,016 Views)

Thanks for the suggestion. I have attempted that, yet now an empty image is passed on - if I probe it, it says value "". I guess I have something wired up wrong still.

 

I have the IMAQ Create output directly wired as the shift register (and further to the input of the Volume subVI). In the Calibrate case, I have the output of the threshold directly wired to the output shift register.

0 Kudos
Message 3 of 6
(3,007 Views)

Have you tried using a shift register on the while loop? That's the most common way to pass data from a previous iteration to the next one. http://www.ni.com/getting-started/labview-basics/shift-registers


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 4 of 6
(3,004 Views)

See my previous reaction, I have just tried that. I also just realised that connecting the empty image as input probably won't work.

Now I have nothing connected as input for the shift register, only the calibration image to the output. Still when I probe the output, I see the calibration image for a split second when the calibration is done, and from then on an empty image is passed around.

I've tried both connecting the in- and output terminals within the case structure as well as "Use Default if Unwired". 

0 Kudos
Message 5 of 6
(2,990 Views)

Nevermind, making a shift register was the solution. I just had to make sure that both in the event structure as well as the case structure, the input of the shift register was directly connected to the output. With "use default if unwired" no image was passed on.

It was an easy solution. Thanks for the help!

0 Kudos
Message 6 of 6
(2,985 Views)