Custom Video Preview

The MATLAB image acquistion toolbox allows for customizing the preview of video.

Previewing Data in Custom GUIs

Instead of using the toolbox's Video Preview window, you can use the preview function to direct the live video stream to any Handle Graphics image object. In this way, you can incorporate the toolbox's previewing capability in a GUI of your own creation.

See MATLAB example vid5.m

Performing Custom Processing of Previewed Data

When you specify an image object to the preview function. You can optionally also specify a function that preview executes every time it receives an image frame.

See MATLAB example vid6.m

Using Events and Callbacks

You can enhance the power and flexibility of your image acquisition application by using event callbacks. An event is a specific occurrence that can happen while an image acquisition object is running. The toolbox defines a set of events that include starting, stopping, or acquiring frames of data.

When a particular event occurs, the toolbox can execute a function that you specify. This is called a callback. Certain events can result in one or more callbacks. You can use callbacks to perform processing tasks while your image acquisition object continues running. For example, you can display a message, analyze data, or perform other tasks. The start and stop callbacks, however, execute synchronously; the object does not perform any further processing until the callback function finishes.

Callbacks are controlled through video input object properties. Each event type has an associated property. You specify the function that you want executed as the value of the property.

Example of callback routine usage: vid7.m

This example samples 1 second of video (30 frames) and shows every 5 frames. The data captured can be written to an avi file. See vid7a.m


Maintained by John Loomis, last updated 30 January 2011