Chapter 3 Programming with NI-IMAQ for 1394
NI-IMAQ for IEEE-1394 Cameras User Manual 3-6 ni.com
When you invoke a snap, it initializes the IMAQ 1394 device and acquires
the next incoming video frame to a buffer. Use a snap 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
Snap1394.c
example demonstrates how to perform a single snap
using
imaq1394SnapImage
. The example opens a session on a camera
and then performs a single snap. The buffer pointer that is passed to
imaq1394Snap
is allocated with malloc with theappropriate size. The size
of the buffer is calculated based on the region of interest (ROI) and the
number of bytes per pixel: ROI width multiplied by ROI height multiplied
by bytes per pixel. When you open a session, the ROI is set to the size of
the video mode you selected in MAX.
The sample then calls a process function to analyze the image. When the
program is finished, it calls
imaq1394Close
with the camera handle. This
instructs NI-IMAQ to free all of the resources associated with this camera,
which releases the session.
High-Level Grab Functions
A grab is a continuous high-speed acquisition of data to a single buffer in
host memory. Grab functions include
imaq1394SetupGrab
,
imaq1394Grab
,and
imaq1394GrabImage
. You can use these functions
to perform an acquisition that loops continually on one buffer. You can
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.
imaq1394CameraOpen
imaq1394CameraOpen opens
and configures the camera
according to the file set up by
Measurement & Automation Explorer.
User-specific image processing
imaq1394Close closes the camera and session.
imaq1394Snap acquires an image into a buffer.
imaq1394Snap
User-Specific Functions
imaq1394Close