High-Level Ring Functions

NI IMAQ

High-Level Ring Functions

Ring and sequence functions include imgRingSetup, imgSessionStartAcquisition, and imgStopAcquisition. Use these functions to perform a continuous acquisition that loops or stops after a certain number of images have been captured. A ring initiates a continuous high-speed acquisition to multiple buffers. Calling imgRingSetup initiates a ring. imgRingSetup specifies both the buffer list used for transfers and the number of buffers. After you call imgRingSetup, you can monitor the status of the transfer and perform processing on any of the buffers in the ring. Use a ring for high-speed applications where you need to perform processing on every image. You must use multiple buffers because processing times may vary depending on other applications and processing results. You can configure a ring to acquire every frame or to skip a fixed number of frames between each acquisition.

For certain applications, you can temporarily extract a buffer from the ring to prevent it from being overwritten during the next pass of the ring. Use the imgSessionExamineBuffer and imgSessionReleaseBuffer functions to do this.

The following figure illustrates a typical ring programming order.

The HLRing.c example demonstrates how to perform a ring acquisition using imgRingSetup. The example sets up a ring containing six buffers and sets the skip count to three, which causes the program to acquire on every fourth frame. Unlike the sequence example, the skip count is set to the same value for every buffer in the ring. A skip count is the number of frames skipped prior to acquiring an image to a buffer. The program then loops, waiting for the next buffer to be acquired. The imgSessionStatus function queries NI-IMAQ for the buffer number of the last valid buffer that has been acquired. The last valid buffer is defined as the buffer that contains the most recent video image. This process continues until a designated condition is met and then the acquisition stops.