| Customize Help

Grabbing a sequence of frames in real-time



To grab a sequence of frames in real-time, simply use successive, asynchronous calls to MdigGrab():

/* Put digitizer in asynchronous mode */
MdigControl(MilDigitizer, M_GRAB_MODE, M_ASYNCHRONOUS);
/* Grab the sequence. */
for (n=0; n<NbFrames; n++){
      /* Grab one buffer at a time. */
      MdigGrab(MilDigitizer, MilImage[n]);
   }

Alternatively, you can make a single call to MdigProcess(). For more information, see the Multiple buffering subsection of the Grabbing and processing section later in this chapter.

In either case, you must allocate buffers to store the frames of the sequence. After you have grabbed a sequence, you can use the MbufExportSequence() function to export the sequence of image buffers (compressed or uncompressed 8-bit) to an AVI file. When exporting, you must specify the number of buffers and the frame rate (number of images/second) of the sequence. Note, the MIL identifiers of the image buffers to export must be kept in an array.

Use the MbufImportSequence() to import a sequence of images from an AVI file into separate image buffers. You can import images in all formats supported by MIL. You can also choose to import the sequence into automatically allocated buffers or previously allocated buffers.