Chapter3 Programmingwith NI-IMAQ for 1394
NI-IMAQfor IEEE-1394 Cameras User Manual 3-6 ni.com
Whenyou invoke a snap, it initializes the IMAQ 1394 device and acquires
the nextincomin g video frame to a buffer.Use a snap for low-speed or
single-captureapplications where ease of programming is essential.
Figure 3-2 illustrates a typical snap programming order.
Figure3-2. SnapProgramming Flowchart
The Snap1394.cexample demonstrates howto perform a single snap
using imaq1394SnapImage.The example opens a session on a camera
and thenperforms a single snap. The buffer pointer that is passed to
imaq1394Snapis allocated with malloc with the appropriate size. The size
ofthe buffer is calculated based on the region of interest (ROI) and the
numberof bytes per pixel: ROI width multiplied by ROI height multiplied
bybytes per pixel. When you open a session, the ROI is set to the size of
the video mode you selected in MAX.
The samplethen calls a process function to analyze the image. When the
programis finished, it calls imaq1394Close with the camera handle. This
instructsNI-IMAQ to free all of the resources associated with this camera,
which releasesthe session.
High-Level Grab Functions
Agrab is a continuous high-speed acquisition of data to a single buffer in
host memory. Grab functions include imaq1394SetupGrab,
imaq1394Grab,andimaq1394GrabImage.You can use these funct ions
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 function s, you must have a valid session handle.
imaq1394CameraOpen
imaq1394CameraOpenopens
andconfigures the camera
accordingto the file set up by
Measurement& Automation Explorer.
User-specificimage processing
imaq1394Closecloses the camera and session.
imaq1394Snapacquires an image into a buffer.
imaq1394Snap
User-SpecificFunctions
imaq1394Close