Acquired image frames to MATLAB workspace
data = getdata(obj)
data = getdata(obj,n)
data = getdata(obj,n,type)
data = getdata(obj,n,type,format)
[data,time] = getdata(...)
[data, time, metadata] = getdata(...)
data is returned as an H-by-W-by-B-by-F matrix where
Image height, as specified in the object's ROIPosition property
Image width, as specified in the object's ROIPosition property
Number of color bands, as specified in the NumberOfBands property
The number of frames returned
data is returned to the MATLAB® workspace in its native data type using the color space specified by the ReturnedColorSpace property.
You can use the MATLAB image or imagesc functions to view the returned data. Use imaqmontage to view multiple frames at once.
data = getdata(obj,n,type) returns n frames of data associated with the video input object obj, where type is one of the text strings in the following table that specify the data type used to store the returned data.
Unsigned 8-bit integer
Unsigned 16-bit integer
Unsigned 32-bit integer
Uses native data type. This is the default.
If type is not specified, 'native' is used as the default. If there is no MATLAB data type that matches the object's native data type, getdata chooses a MATLAB data type that preserves numerical accuracy. For example, the components of 12-bit RGB color data would each be returned as uint8 data.
data = getdata(obj,n,type,format) returns n frames of data associated with the video input object obj, where format is one of the text strings in the following table that specify the MATLAB format of data.
Returns data as an H-by-W-by-B-by-F array. This is the default format if none is specified.
Returns data as an F-by-1 cell array of H-by-W-by-B matrices
[data,time] = getdata(...) returns time, an F-by-1 matrix, where F is the number of frames returned in data. Each element of time indicates the relative time, in seconds, of the corresponding frame in data, relative to the first trigger.
time = 0 is defined as the point at which data logging begins. When data logging begins, the object's Logging property is set to 'On'. time is measured continuously with respect to 0 until the acquisition stops. When the acquisition stops, the object's Running property is set to 'Off'.
[data, time, metadata] = getdata(...) returns metadata, an F-by-1 array of structures, where F is the number of frames returned in data. Each structure contains information about the corresponding frame in data. The metadata structure contains these fields:
Absolute time the frame was acquired, expressed as a time vector
Number identifying the nth frame since the start command was issued
Number identifying the nth frame relative to the start of a trigger
Number of the trigger in which this frame was acquired
In addition to the fields in the above table, some adaptors may choose to add other adaptor-specific metadata as well.
getdata is a blocking function that returns execution control to the MATLAB workspace after the requested number of frames becomes available within the time period specified by the object's Timeout property. The object's FramesAvailable property is automatically reduced by the number of frames returned by getdata. If the requested number of frames is greater than the frames to be acquired, getdata returns an error.
It is possible to issue a Ctrl+C while getdata is blocking. This does not stop the acquisition but does return control to MATLAB.
Construct a video input object associated with a Matrox® device at ID 1.
obj = videoinput('matrox', 1);
Initiate an acquisition and access the logged data.
start(obj); data = getdata(obj);
Display each image frame acquired.
Remove the video input object from memory.