Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

IMAQdx acquisition slows down

Hello,

 

I have written a vi to acquire groups of images from a GigE camera at high speed (200-1000 Hz). I use IMAQdx functions and add the acquired images to a queue to send them to processing loop (I followed the example "Low-Level Ring Parallel Workers"). In the processing loop, I plot few of the results. It works pretty well, except that the more data I acquire, the longer it takes to the program to run. At first, I get around 2 images/s and when I stop the program I get maybe around 1 image/ 4s. If I run the program many times without stopping it (I put it into a while loop to avoid starting and closing the camera each time), the same thing happens: the first scans are much faster than the last ones. Would anyone have any idea what I am not doing ok?

I thought about memory problems but the Task Manager indicates no memory increase...

 

I put my code in attachment. Its goal is to move a linear translation stage step by step, and at each position to grab few images from the camera. 

 

Thank you very much for taking a look at my program!

 

Marie

Message 1 of 15
(4,687 Views)
One problem I think I see is that each time you Extract a buffer, you have the flag set to release the previous one[s]. This means you have a race condition with your consumer loop. To use it he way you seem to be doing, you need to set that flag to false, then have your consumer loop call Release on that image buffer after processing it.
0 Kudos
Message 2 of 15
(4,666 Views)

when you want to work with image and camera always regard this rules
1 dispose image exactly after that you do not need it
2 make buffer and RAM free exactly after that you get new branch of image
you could not starting push your images inside the buffer and queue without handling and flushing and want your system  RAM to not overflow or system slow down

0 Kudos
Message 3 of 15
(4,659 Views)

Hello,

 

Thank you very much for your answer! I have tried setting the flag to false: the program runs the 1st iteration of the outside loop without problem, then at the second iteration the camera systematically times out and I cannot acquire any more images... I am still new to LabView and I don't really understand what is causing that... Did I have to change anything else other than setting the flag to false?

 

Than you!

0 Kudos
Message 4 of 15
(4,642 Views)

Hatef.fouladi, thank you very much also! Please can you confirm how I can make RAM free after each image acquisition? I release image and dispose all images after each acquisition, but maybe I am not doing it correctly or I can do something else?

 

Thank you!

0 Kudos
Message 5 of 15
(4,640 Views)

@kiroture wrote:

I have tried setting the flag to false: the program runs the 1st iteration of the outside loop without problem, then at the second iteration the camera systematically times out and I cannot acquire any more images... I am still new to LabView and I don't really understand what is causing that... Did I have to change anything else other than setting the flag to false?

 


You need to call "IMAQdx Release Image" inside your consumer loop after you are done with the image. Otherwise the acquisition cannot continue acquiring new data into the buffers in the background and will get paused.

 

Maybe the next question is, are you sure you really need to be using these two producer/consumer loops as opposed to a single loop? The Extract Image call is virtually "free", so you aren't really gaining any benefit of splitting it to the two loops. The main reason you would want to use that architecture is if you wanted to do something like have multiple consumer loops processing data in parallel. If you are always serializing the processing, splitting it from the acquisition doesn't have any benefit. It just makes your code much more complicated.

0 Kudos
Message 6 of 15
(4,633 Views)

Thank you for the advice with "IMAQdx Release Image". My program now runs normally, except that it still slows down as I do more and more acquisitions...

 

I agree with you, the producer/consummer loop is not really necessary. Actually, the first version of my program didn't have a queue and I had exactly the same problem (I put my previous code in attachment, I don't think I changed it much except for the queue), so I tried with the queue to see if it would make any difference... (I tried so many things honnestly...). Except for the code being more complicated, do you think that the queue affects the code in a bad way?

 

 

0 Kudos
Message 7 of 15
(4,626 Views)
monitor your CPU and RAM when you run your vi (use task manager)
for know witch one is your problem. tell me the result
to start analyse your code in correct attitude and not just wasting time for wrong thing
0 Kudos
Message 8 of 15
(4,615 Views)

Hello,

Here are the results from the task manager, regarding LabVIEW: 

 

Before I start the camera:

CPU 0%

Memory 252 MB

 

As soon I start the camera:

CPU 0%

Memory 260 MB

 

When the acquisition program runs:

CPU 1.5%

Memory 260 MB

 

Maybe also it's not a memory problem? But it was my first idea.

0 Kudos
Message 9 of 15
(4,614 Views)
?what about the time your acquisition becomes slow down
0 Kudos
Message 10 of 15
(4,603 Views)