High-level snap functions, Figure 3-2. snap programming flowchart, High-level snap functions -7 – National Instruments Image Acquisition Software User Manual

Page 27: Figure 3-2, Snap programming flowchart -7

Advertising
background image

Chapter 3

Programming with NI-IMAQ

©

National Instruments Corporation

3-7

NI-IMAQ User Manual

High-Level Snap Functions

A snap acquires a single image into a memory buffer. Snap functions
include

imgSnap

and

imgSnapArea

. Use these functions to acquire a

single frame or field to a buffer. To use these functions, you must have a
valid session handle.

When you invoke a snap, it initializes the board and acquires the next
incoming video frame (or field) to a buffer. A snap is appropriate for
low-speed or single-capture applications where ease of programming
is essential. Figure 3-2 illustrates a typical snap programming order.

Figure 3-2.

Snap Programming Flowchart

The

hlsnap.c

example demonstrates how to perform a single snap using

imgSnap

. The example opens an interface and a session and then performs

a single snap. The buffer pointer that is passed to

imgSnap

is initialized to

NULL, which instructs

imgSnap

to automatically allocate a buffer for the

image. The size of the buffer is calculated based on the region of interest
(ROI) and the rowPixel attributes: ROI height multiplied by rowPixel
multiplied by the number of bytes per pixel. When you open a session, the
ROI values are initialized from the acquisition window (ACQWINDOW)
dimensions that are configured in the IMAQ Configuration Utility. The
ACQWINDOW dimensions will vary depending on the type of camera you
are using.

imgInterfaceOpen

imgInterfaceOpen

opens

and configures the interface
according to the file setup by the
IMAQ Configuration Utility.

imgSessionOpen

opens a session that

will be used for all acquisition and configuration.

User-specific image processing

imgClose

closes the interface and session.

imgSnap

acquires an image into a buffer. The

buffer may be passed into

imgSnap

or automatically

allocated by NI-IMAQ. If no buffer is passed into

imgSnap

, it will automatically snap into a new buffer

and return a pointer to the buffer.

imgSessionOpen

imgSnap

User-Specific Functions

imgClose

UM.book Page 7 Monday, July 13, 1998 9:49 AM

Advertising