Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Questions about example LL RIng.vi

Hello All,

I am new to NI-IMAQ, so sorry if my questions are too simple.

I plan to use low-level IMAQ VIs to code my application, and I start with example of "LL RIng.vi". However, I don't understand some aspects of the code, so I post here hoping to clarify my confusions.

The block diagram is as following:



1.  Buffer to extract input to the IMAQ Extract Buffer VI

If I set 10 as the number of buffers (0~9),  then within the second loop structure, if iteration number i>9, will the acquisition hardware wraps around the buffer list? I mean, if i=10, the acquired image will be written to buffer #0? Similarly, image of i=11 will be written to buffer #1? I am not sure whether my understanding is correct.

2. The purpose of using multiple buffers

According to NI-IMAQ help: 'Need to use multiple buffers when need to process images on every image.' So, I guess using multiple buffers is helpful when the image processing speed can not catch up with image acquisition speed. But using how using 10 buffers can solve this problem? Before the IMAQ Extract Buffer VI is called again, a buffer is protected  against writting. So, as long as the image processing speed is lower than the image acquisition speed, finally all 10 buffers will be protected, waiting for the image process to complete..... So, finally using 10 buffers will be the same as using one buffer, even in the case that several buffer images can be processed simultaneously.

3. Why use another IMAQ Extract Buffer VI after the second loop structure?

Here the 'buffer to extract' is set to '-1', meaning 'release the currently extracted buffer without extracting a new buffer'.
I don't understand why do this step here:  (1) why just release 'currently extracted' buffer instead of all 10 buffers?  (2) SInce IMAQ close and Dispose VIs are used here, why we still need to release here?

Message Edited by Dejun on 09-07-2007 09:46 AM

0 Kudos
Message 1 of 3
(3,379 Views)
Hi Dejun,

Thank you for using National Instruments forums.

1.  Yes, your understanding is correct.  The buffer number will go higher and higher, but the physical reference is will always remain from 0-9 in your example.

2.  This is with any buffer that exists anywhere.  As long as we read out of the buffer (post processing) quickly enough, then we won't run into any problems.  So regardless of whether you have 1 buffer or 1000, you will always run out of buffer spaces if you process too slowly.  This is as long as your average post processing speed is faster than your acquisition.  There many be points where your instantaneous processing speed is actually slower than your acquisition due to the CPU being used by another process or the CPU just decided to make your program wait for a random reason.  The buffer will take care of you for a few moments while your CPU catches up.

3.  In this case, it is more of a good coding practice rather than a requirement.  So you are right, since we are removing the buffer from memory, we should not need to code a release into it.  But in case you are actually performing any last moment processing, you will want to release the last buffer and this is more of a 'let people know' about than a requirement to the code.

I hope this helps.  If you come up with any other answers, feel free to post them here as well to your own questions.

Justin
0 Kudos
Message 2 of 3
(3,355 Views)
Thanks a lot for your help, Justin.

Can you also answer my another post related with LL Ring VI? Thanks.

-Dejun
0 Kudos
Message 3 of 3
(3,348 Views)