User`s guide

6 Working with Acquired Image Data
6 Bring multiple fram es into the w orksp ace —Callthegetdata
function to bring multiple image frames into the MATLAB workspace.
data = getdata(vid,10 );
The g etda ta function brings 10 frames of data into the workspace.
Note that the returned data is a four-dimensional array: each frame is
three-dimensional and the nth frame is indicated by the fourth dimension.
size(data)
ans =
480 640 1 10
7 Clean up Always rem ove image acquisition objects from mem ory, and
the variables that re ference them, when you n o longer need them.
delete(vid)
clear vid
Determining the Data Type of Image Frames
By default, the toolbox returns image frames in the d ata type used by the
image acquisition device. If there is no MATLAB data type that matches
the object’s native d ata type,
getdata chooses a MATLAB data type that
preserves n umerical accuracy. For example, in RGB 555 format, each color
component is expressed in 5-bits.
getdata returns each color as a uint8 value.
Yo u can specify the data type you want
getdata to use for the returned data.
For example, you can specify that
getdata return image frames as an array of
class
double. To see a list of all the data type s supported, see t he getdata
reference page.
The following example illustrates the data type of returned image data.
1 Create an im age acquisition object Th i s example creates a video
input o bj ect for a M atrox ima ge acquisition device. To run th is example on
your system, use the
imaqhwinfo function to get the object constructor for
your image acquisition device and substitute that syntax for the following
code.
6-16