06-13-2017 04:15 PM
Hi all,
Is it available to output all buffers of images as a 2D array at a time? I could only obtain one image though the number of buffer set in IMAQdx get image.vi and configure acquisition.vi is larger than one.
Ninghao
Solved! Go to Solution.
06-13-2017 09:27 PM
Sorry, I'm not sure from your description what you are trying to do. Also, please do not use a Stacked Sequence Structure -- simply put all of your functions on one (long) Error Line, or (much better) encapsulate related functions in a sub-VI, create a mnemonic icon for your sub-VI, and simplify your code. Simple code makes it easier to guess what you are trying to do.
Bob Schor
06-14-2017 08:25 AM
I am trying to output all the images in the buffer at a time. For example, if the buffer number is five, is it possible to output five images as a 2D array by IMAQdx vi? I have simplified my code, hope it's more readable. Thanks.
06-14-2017 09:06 AM
Now that I can see your code more clearly, the answer to your "real" question, is it possible to acquire (and save) multiple images from a Camera, is "Yes", but not the way you are doing.
IMAQdx is, unfortunately, "under-documented", and it is not always clear how it works or what its parameters should be. If you are doing a "Grab" (or continuous Video), you need to allocate space in the IMAQdx driver for multiple Images -- these driver spaces are called "buffers". Say you allocate 6, and say that you are taking images at 30 frames/second. The default IMAQdx Get Image2 will use buffers 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, etc. in a sequential "circular" fashion, saving images in the "next available" buffer, and returning a pointer ("Image Out") to it for you to manipulate.
The reason to have multiple Buffers for videos is as soon as one Image has been acquired by the Camera, it needs to start saving the pixels for the next Image. If only one buffer was being used, the incoming Image would immediately start overwriting the storage area for the preceding Image. If you are only doing a Snap (single Image) instead of a Continuous Grab, you'd have time to process the Image.
Having multiple Buffers for Grab does no good at all if (as your code seems to do) you use the same Buffer for each Get Image. Recall that the Buffer, and its associated Image wire, only point to areas in memory, and if they are the same, you will have over-writing of data.
I hope this is clear. With reference to your code, I'd make the following suggestion(s):
Bob Schor
06-14-2017 11:02 AM
Hi Bob,
Thanks for suggestions. I've tried the outer for loop before and it can work. But if my camera needs to be synchronized with a 500Hz external trigger, could the loop work at such a high speed without losing data?
Ninghao
06-14-2017 11:23 PM
500 images per second is a very large amount of data. Most of the cameras I'm using are not capable of such speeds.
Bob Schor
06-15-2017 08:00 AM
I've solved this problem- For loop can follow the 500 frame rate. Thank you.
Ninghao