High-level Function Programming Examples

NI-IMAQdx

High-level Function Programming Examples

This section contains examples of high-level and low-level image acquisitions. Refer to Fundamentals of Building Applications with NI-IMAQdx section for directory paths to the code examples discussed in this section.

High-Level Snap Functions

Capture all or a portion of a single image to the user buffer. The following figure illustrates the typical programming order of a high-level snap acquisition.



Use a snap for low-speed or one-shot applications where ease of programming is essential. When you invoke a snap, the driver opens a session on a camera and initializes the camera. Opening a session sets the region of interest (ROI) to the size of the settings you configured in MAX.

Note Note  If you do not have a valid session, a temporary session is created using cam0.

Then, the snap acquires the next incoming image into a user buffer. After the image is acquired, the program calls image processing and analysis functions. When the processing and analysis functions are finished, the program calls the Close Camera function using the camera handle. This function instructs NI-IMAQdx to free all of the resources associated with this camera, which releases the session.

High-Level Grab Functions

Grab functions perform an acquisition that loops continually on one or more internal buffers. You can copy the last acquired buffer to a separate user buffer for processing or analysis. The following figure illustrates the typical programming order of a high-level grab acquisition.




Use a grab for high-speed applications during which you need to process only one image at a time. You can copy the last acquired buffer to a separate user buffer for processing or analysis. To use these functions, you must have a valid session. If you do not have a valid session, the Configure Grab function creates a session using cam0.

Calling the Configure Grab function opens a session for a grab acquisition. During acquisition, each successive grab copies the last acquired internal buffer into a user buffer where you can process the image.

High-Level Sequence Functions

A sequence acquires a specified number of internal buffers and then stops.

The following figure illustrates the programming order of a low-level sequence acquisition.




Use a sequence in applications where you need to process a series of consecutive images. Sequence acquisitions are synchronous. If you do not specify a session, a temporary session is created using cam0.