High-Level Grab Functions

NI IMAQ

High-Level Grab Functions

A grab is a continuous high-speed acquisition of data to a single buffer in host memory. Grab functions include imgGrabSetup, imgGrab, and imgGrabArea. You can use these functions to perform an acquisition that loops continually on one buffer. Obtain a copy of the acquisition buffer by grabbing a copy to a separate buffer. To use these functions, you must have a valid session handle.

Calling imgGrabSetup initializes a session for a grab acquisition. After imgGrabSetup, each successive grab copies the last acquired buffer into a user buffer where you can perform processing on the image. Use grab for high-speed applications where you need processing performed on only one image at a time.

The following figure illustrates a typical grab programming order.

The hlgrab.c example demonstrates how to perform a grab using imgGrabArea. The example performs multiple grabs until an appropriate condition is met. The program configures the session to perform a grab operation by calling the imgGrabSetup function. The program then calculates the area to grab using the current ROI, rowPixels, and bytesPerPixel, and starts the acquisition by calling imgSessionStartAcquisition. In this example, the program allocates a user buffer for grabbing and passes this buffer to imgGrabArea. When the acquisition is complete, it stops. The program then frees the user buffer and all of the resources associated with this interface by calling imgClose.