LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

enqueue image buffer number

Hi, Could anyone help me to find a way to save PNG file sequences, on demand, while the camera is still showing images. I have to start the imagery a few seconds prior to save PNG files in order to let the camera stabilize before anything else.  Thank you for your help.

 

I included 2 different VIs in which I tried to inplement this code but haven't succeeded.

Download All
0 Kudos
Message 1 of 5
(2,877 Views)

I can't look at your code right now since I don't have LabVIEW here with me.

 

But is sounds like you should use a Producer/Consumer to save off your images.  Have one loop (the producer) getting your camera images and another loop (the consumer) saving the images.  You send the data from the producer to the consumer using a queue.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 5
(2,855 Views)

Hi crossrulz, thank you for this answer

 

That's what I have tried to do.  I have tried by using low level LV VIs and I have also tried by using high level LV VIs.  I know the producer/consumer loop architecture but where I am stuck is when it's time to pass the image buffer and to recieve it in the other loop.  I can't find how/what to send, how to read and process it in another loop.  The hardware is already used, I can't reuse the reference, I don't know what to do with that.  I am sure it is very simple but I am stuck there.

0 Kudos
Message 3 of 5
(2,827 Views)

Travelling with wrong version of LabVIEW on laptop, can't look at your code.  However, we've done what I think you want to do,  In our case, we are taking images at 30 frames/second.  We are monitoring (using serial communication hardware) some "Events", and want to capture .AVI videos starting 2.5 seconds before the Event and continuing for 5 seconds after the Event.

 

What we do is to configure the Camera (using IMAQdx) with sufficient buffer space to hold all the images we need (with maybe a factor of 2-3 for "safety").  When the Event is registered, we note the current Buffer Number, then start a Producer loop to send the "pre-Event buffers" and the "post-Event buffers" to a Consumer loop.  The Consumer loop retrieves the buffer and uses it to write the frame to the .AVI file (we actually do this in another Consumer/Producer loop, as I recall, taking care of opening and closing the File as appropriate).

 

It seems to work.  We're actually monitoring 24 cameras (and 24 "Event-detectors") simultaneously, and usually have no problems capturing our Events (which occur at the rate of 10-20 per hour, but all asynchronous).

 

Message 4 of 5
(2,818 Views)

Crossrulz is right that a producer/consumer setup is what is needed. However, the IMAQ and IMAQdx drivers already have a producer architecture built into them internally. Using the grab setup VIs, a developer can configure a buffer that will enqueue the images so that they can be extracted later in a consumer loop. Try looking at some of the IMAQ grab examples in the NI Example finder to see how this works.

 

Also, Bob is right that you set up your code to read the images from several seconds ago from the buffer once there is a trigger signal. This is actually how the pretrigger works in DAQmx applications as well.

 

Jeremy P.

Applications Engineer
National Instruments
0 Kudos
Message 5 of 5
(2,812 Views)