10-03-2024 10:31 PM
Hello,
I'm making a relatively simple code for a USB 3.0 device using IMAQdx that acquires something like 5000 images and averages them for the user. We use low level configure, start, get image VIs. In particular, its very important for us to collect every frame as fast as possible, so we pre-initialize the buffers and collect them for averaging. Loading an image into a user buffer, acquiring, and averaging runs in parallel. Afterwards, we close everything.
Here is where things get interesting: When looking at how the code operates as a function of the number of images, we find that "configure" and "start" scale linearly with the image number. Averaging also scales linearly with the image number and matches perfectly with expected FPS limit. Closing a session scales exponentially.
We ultimately want to run these averages multiple times, however, the time it takes to close each camera session really starts to add up and become inefficient.
Is it possible to overwrite pre-existing internal buffers instead of closing sessions and recreating them all over again? This way, start the camera and configure once at the beginning of the VI and close at the very end. I looked into Ring acquisition as possibility, however, it seems like lost buffers are extremely common with this method which is not acceptable for our application.
My VI is attached, as well as a picture of VI and the operation time. The picture circles how we configure and start as well as the closing session that scales exponentially.
10-04-2024 05:04 AM - edited 10-04-2024 05:11 AM
jat2214@columbia.edu wrote:
Is it possible to overwrite pre-existing internal buffers instead of closing sessions and recreating them all over again?
Yes just use start and stop as needed, you should not have to use configure again unless the number of images changes. Also I don't think the Unconfigure Acquisition is needed, why not try leaving it out? I think it just resets to default behavior and maybe does some memory cleanup.
You don't need the top queue for just creating IMAQ buffers, it is way faster than acquiring a frame anyway. Just create the buffers during initialization.
A ring buffer is only needed when you would run out of memory storing all the frames you are going to need or if you plan to run continuously.