LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

IMAQdx user event driven acquisition

Solved!
Go to solution

Hi all,

 

I'm currently developing a large(ish) GUI. One part of this is acquiring images from a USB-Vision camera (Pointgrey FLIR Chameleon3) while the GUI is running (single frame, multiframe sequences or just grabbing images continuously without saving)

 

Recently started using the IMAQ functions and used a few of the examples in LabVIEW to have the camera start and stop using a boolean control and an Event structure.

 

The LabVIEW example file I worked from registers a dynamic event (Frame Done) outside the While loop and acquires images until the user presses stop.

 

When I tried this approach but adding an additional event to start and stop the acquisition, it worked, but only the first time. The second time I try to generate a "start acquiring" event via a button press, the camera begins acquisition but the Frame Done event no longer registers so no new images appear on the screen.

 

I've eventually got it to work by essentially re-registering the event each time the camera begins acquisition again (see image below and VI attached - LabVIEW 2019).

 

IMAQ-dynamic_event_test.png

 

My question is: is this the correct approach and more importantly, why/why not?

When you stop a camera acquisition does that change something about the session info which means the original registered event no longer triggers? This also wasn't camera specific as I saw the same behaviour with my laptop webcam.

 

Trying to better understand LabVIEW and dynamic events in particular as they seem incredibly useful but I feel i'm missing crucial info.

 

Thanks for your help

 

Download All
0 Kudos
Message 1 of 6
(3,193 Views)

Let me start by saying I know nothing about IMAQ and I do not have 2019, so I can't open your code.

 

I suspect you are losing the IMAQ reference when another event fires.  This would happen if you aren't wiring the reference thru all of the events.  For this reason, I would suggest that you don't put your IMAQ code inside the event structure.  Instead, use a parallel loop for the image grabbing and use some sort of messaging scheme where the event structure sends a message to this loop telling it to grab a picture. 

 

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 2 of 6
(3,183 Views)

That looks just like the code I use, so I must have discovered the need to re-register at some point.  So I think your doing it right but I don't know the details why.

0 Kudos
Message 3 of 6
(3,167 Views)
Solution
Accepted by topic author Oldbhoy

I have also (just) independently verified that you want to (re-)register for the Frame Done Event at the time you do the IMAQdx Start Acquisition.  I built a little test routine that had a Start, Pause, and Stop Button, and set up my Web Cam to simply display sequential Buffers.  The Start Button did Start Acquisition and Registered the Event (much as you did), Pause did IMAQdx Stop Acquisition, and Stop did another Stop Acquisition and ended the While Loop, doing the usual IMAQdx cleanup.  One curious thing was that when I tried to do an Unregister for Events when the loop exited, I got "interesting" Error Conditions.

 

Vision and IMAQdx are "different" from other LabVIEW modules -- this is (I suppose) another example of a "Feature" not fully explained.

 

Bob Schor

0 Kudos
Message 4 of 6
(3,129 Views)

Thanks for the confirmation. I just assumed I was doing something overly complicated as this type of functionality seems like it should be more transparent to implement.

 

I'm perhaps oversimplifying it tho, and as aputman suggested, running acquisition in a parallel while loop would potentially work just as well

0 Kudos
Message 5 of 6
(3,113 Views)

@Oldbhoy wrote:

 

... running acquisition in a parallel while loop would potentially work just as well


Or be really buggy.  Image references are tricky to work with in parallel loops.  At best you'll be wasting effort reinventing what the "Frame Done" event already gives you.

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