Chapter 3 Programming with NI-IMAQ
©
National Instruments Corporation 3-15 NI-IMAQ User Manual
for you when you acquire an image with it, you must perform the alignment
yourself if you use window widths not aligned on a 32-bit boundary.
After the program sets the ROI, it locks the memory and acquires the
image. If you choose to plot the image using the imgPlot function,
you must align the image wid th on a 32-bit boundary as well.
Performing a Grab Using Low-Level Functions
The LLGrab.c example demonstrates how to perform a grab acquisition
using low-level calls. The example sets up a continuous acquisition to a
single user-allocated buffer.
As described in the low-level snap example, the program retrieves the
acquisition window width of the selected camera and aligns it on a 32-bit
boundary. The program creates a buffer list to describe the acquisition
buffers. Next, the program sets the ROI to the acquisition window width.
The program performs a calculation to determine the correct memory
requirements of the user buffer. The program creates the buffer and
configures buffer element 0 for a single continuous acquisition. The
program then locks the memory and starts the image acquisition
asynchronously. The main processing loop of the code shows how to wait
for vertical blank and copy the buffer to an analysis buffer.
Keep your analysis code fast to minimize the number of missed frames
during analysis. If you need more time to examine a buffer, set up a
multiple-buffer ring and call imgSessionExamineBuffer to extract
the desired buffer from the live sequence.
Performing a Sequence Acquisition Using Low-Level Functions
The LLSeq.c example demonstrates how to perform a sequence
acquisition using low-level calls. The example sets up a sequence
acquisition to multiple buffers allocated by NI-IMAQ. As described in the
low-level snap example, the program retrieves the acquisition window
width of the selected camera and aligns it on a 32-bit boundary. It creates a
buffer list to describe the acquisition buffers. Next, the program sets the
ROI to the acquisition window width. The program calculates the correct
memory requirements of the frame buffer. However, this is not necessary
if you choose to use the default acquisition window width, rowPixels, and
ROI. In this case, NI-IMAQ will allocate the correct size buffer if you pass
a NULL as the size parameter to imgCreateBuffer. The program creates
the buffer and configures the buffer list for each buffer element in the ring.
The program locks the memory and starts the image acquisition
asynchronously.
UM.book Page 15 Monday, July 13, 1998 9:49 AM