Figure 3-3. grab programming flowchart – National Instruments NI-IMAQ User Manual

Page 23

Advertising
background image

Chapter 3

Programming with NI-IMAQ for 1394

© National Instruments Corporation

3-7

NI-IMAQ for IEEE-1394 Cameras User Manual

Calling

imaq1394SetupGrab

initializes a session for a grab acquisition.

After

imaq1394SetupGrab

, 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. Figure 3-3 illustrates a typical grab
programming order.

Figure 3-3. Grab Programming Flowchart

The

Grab1394.c

example demonstrates how to perform a grab using

imaq1394Grab

. The example performs multiple grabs until an appropriate

condition is met. The program configures the session to perform a grab
operation by calling the

imaq1394Grab

function.

The program then calculates the area to grab using the current ROI and
bytes per pixel. In this example, the program allocates a user buffer for
grabbing and passes this buffer to

imaq1394Grab

. When the acquisition is

complete, it stops. The program then frees the user buffer and all of the
resources associated with this camera by calling

imaq1394Close

.

imaq1394CameraOpen

imaq1394CameraOpen

opens

and configures the camera
according to the file set up by
Measurement & Automation Explorer.

imaq1394Grab

and imaq1394GrabImage

copy the contents of the driver buffer
to a user buffer. You can call

imaq1394Grab

and imaq1394GrabImage multiple times
for high-speed acquisition.

User-specific image processing

imaq1394Close

closes the camera and session.

imaq1394SetupGrab

configures the camera for a

continuous acquisition.

imaq1394SetupGrab

imaq1394Grab

or imaq1394GrabImage

User-Specific Functions

imaq1394Close

(Loop)

Advertising