| Customize Help

Setting your inputs and outputs

Once you have allocated your sequence context and specified the operation to perform, you must set the sources and destinations of the inputs and outputs of your operation, respectively, using MseqDefine(). The specified operation is characterized by a certain number of inputs and a certain number of outputs. Each input can only take one source, but each output can be saved in multiple destinations.

To define the source of an input, choose the source of which input to define using M_SEQ_INPUT() and then select the type of its source. To define a destination of an output, use M_SEQ_OUTPUT() + M_SEQ_DEST() to select which destinations of an output to set and then select the type of this destination; each output can have 32 destinations. The source of the input can be a file (M_FILE), a buffer list (M_BUFFER_LIST), or a manual image feed, where the images are passed individually (M_USER_FEED). The destination(s) of an output can be files, buffer lists, or the data can be retrieved from the internal output buffer of the sequence processing operation using a hook function (M_USER_HOOK). A buffer list is essentially a list of image buffers, whose individual buffer identifiers are passed using a user array. AVI, MP4, and elementary H.264 are supported formats for file sources and destinations.

Depending on the operation, certain types might not be supported as a source of an input or a destination of an output; for example, a buffer list cannot be used as the source of an input for a decompression operation or as the destination of an output for a compression operation. By default, when you allocate your sequence context, MIL defines an M_USER_FEED source for each input and an M_USER_HOOK destination for your output(s).

If the source of an input is set to a file or buffer list, the operation will be performed as soon as the sequence processing operation is started using MseqProcess(). However, if the source is an image feed, you must perform additional steps after starting the operation.

If the source of an input is an image feed, you must feed each image individually. Feeding your images individually is useful when your images are available gradually. For example, you might want to perform the sequence processing operation on an image immediately after it has been grabbed, preprocessed, and/or analyzed. To feed an image, call MseqFeed() with the identifier of the buffer in which the image is stored. As soon as an image is fed, it is copied to the internal queue of the sequence processing operation where it waits to be operated on. Images can only be fed if M_ASYNCHRONOUS is specified when starting the operation.

If using MdigProcess() to grab, process, and/or analyze each image on which you want to perform a sequence processing operation (for example, sequence compression), you can make the call to MseqFeed() from the hook function of MdigProcess(). If your images are fed faster than they are operated on by the sequence operation, the queue will fill and MseqFeed() will wait for the queue to free up before returning control to the calling thread. This will cause your processing function to stall, and frames might be dropped.

Once images are operated on by the sequence processing operation, they are written to an internal output buffer before being copied to the specified destination. If you set M_USER_HOOK as the destination and this is the only destination, the output of the operation will be lost unless you retrieve it with a hook function. You can use MseqHookFunction() with M_FRAME_END to hook a user-defined function that will be called every time the internal output buffer is modified. You can call MseqGetHookInfo() with M_MODIFIED_BUFFER + M_BUFFER_ID from within your user-defined function to inquire the MIL identifier of the internal output buffer.

You can use hook functions to retrieve data about the internal output buffer, even if a file and/or buffer list destination is specified.