03-07-2014 10:14 AM - edited 03-07-2014 10:19 AM
Hi,
I'm after some help with grabbing and saving images at high speed (400fps+) please. I'm not particularly familiar with cameras and have been given some code that will apparently be a good solution. The aim is to run the camera at max frame rate for a given ROI size. Ideally every frame will be saved to disk. If this is only possible for a short amount of time, that's ok, but it would also be nice if it could capture images for a long time period. Getting a high frame rate and not missing frames is the primary aim, however.
I've modified the code that I was given, and this is roughly the form that I'm using now:
My understanding of this is that the camera collects N images (where N is the value of "Number of Buffers), and that these are saved to RAM. The images are then pulled out of RAM in the for loop (in this example I've wired the "Image Out" indicator in place of the save to disk functions). Also the camera collects images as fast as possible based on the ROI and exposure time etc. Is that all true?
I've been able to use this code successfully for 36000 frames or less. If I go much beyond that it crashes the computer. This is only 3 minutes of image acquisition. I assume that this is a limitation of how much space in RAM can be allocated? If so it would seem that I won't be able to increase the number of frames grabbed with this method.
I've been using this "One Shot" method because I was told that it was more reliable when you don't want to miss frames, is that true? Presumably I'd have to use the Continuous grab to grab for longer, I just want to check that this won't be at the expense of anything else.
Thanks for any help.
03-07-2014 10:54 AM
Also one reason I'm asking these questions is because I feel like the code above should work for more frames. The PC we're using has 8GB RAM and images are only 240x240 pixels or less (8 bit).
03-10-2014 06:59 AM
Hi Orbital,
Have you tried the example code which ships with the imaq driver 'low-level sequence.vi' (in the example finder under Vision Aquisition >NI-IMAQdx>Low-level)? This appears to be designed for what you're trying to do.
Out of interest, what value are you entering into Number of Buffers? And also, if you watch the Physical Memory Usage chart in Windows Task Manager while running your code, what do you see in the lead up to your computer crashing?
03-10-2014 07:33 AM
Hi, thanks for the reply.
I hadn't seen that code before, and I could try it out later (probably tomorrow) but it looks practically identical to my code. The main difference being that I only call IMAQ Create once because I save to disk inside my for loop and don't need separate locations in memory for each image, while the example code looks like it's keeping them all in memory in an array.
For Number of Buffers I've successfully used 36000 with no crash. I can't recall the lowest number that caused a crash but it was probably ~50000. Certainly 100000 caused a crash. I was hoping that when the buffers are created the amount of memory reserved is based on the image type and size (8bit and ~240x240 pixels in this case) but I don't know if that's the case.
I'll try to check task manager next time, thanks for the suggestion.
03-10-2014 09:32 AM
No problem Orbital.
It might also be worth checking out the following KB: http://digital.ni.com/public.nsf/allkb/1922FCDCE6623ABC8625735300592793
I don't know if you're getting this error just before the computer crashes, but the symptons sound similar.