LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Skipping a capture using IMAQ

Hello,

I'm running a code on Labview 2018 that loads buffers and captures images in a sequential format, adding them to a Queue to be saved after the capturing is over. For the most part the code works good. However, I'm having a problem with my code seemingly skipping/not capturing a image every once and a while. I'm running my camera at 200 fps, looking at a stop clock and expecting every image to show a time change of 0.005(1/200) seconds apart. When doing different trial runs, say 60 seconds, I see the first image at 0.0 seconds and the last image at something like 60.020. I added the High Resolution Relative Seconds.vi to my program to see the time difference between capture loops and was able see that most were 0.005 seconds as expected, but some would be higher and around integer values of 0.005 such as 0.010, 0.015, 0.020... I would then look at the saved images and see the time differences where about the same, inferring that there was one, two...or more images being lost/not captured. Any information on why this could happen or ways to find out would be greatly appreciated.

Thanks

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

It's a little difficult to follow what you are doing, but you seem to be processing images sequentially, rather than in parallel.  You have 100 buffers in the Driver, and at at 200 FPS, have at most a half-second of time to get the images out of the driver and into a file for safe keeping.  You don't need a lot of Images (you create many) -- you may be able to get away with one (I just checked my own code -- my "Consumer" State Machine initializes itself by creating a single Image, which is used to hold the Image retrieved from the Driver and passed to the Write AVI function.  Since the limiting factor is how fast you can write frames to the AVI, having to manage multiple buffers won't speed things up for you.

 

There are some "unconventional" things with IMAQdx.  For one thing, if you use a Producer/Consumer pattern, you don't really need a Queue to pass Images from Producer (the Grab loop) to the Consumer (the Write to AVI loop) -- you can simply use the built-in Finite Queue that is the circular buffers inside the Driver, those 100 buffers you created with Configure Grab.  In place of a Queue, just use a Property Node to get the Current Buffer -- if you are saving images (in the Consumer), you save "as fast as you can" until the buffer you last saved is the Camera's "current buffer" (which means you've "caught up").  When this happens, you just "sleep" the Consumer for, say, 100 msec (a 100 msec "Wait (ms)") and keep streaming if the Camera has taken more frames.

 

Slightly unconventional, but very effective.

 

Bob Schor

0 Kudos
Message 2 of 2
(1,997 Views)