User`s guide
Bringing Image Data into the MATLAB Workspace
7-3
Bringing Image Data into the MATLAB Workspace
In this section...
“Overview” on page 7-3
“Moving Multiple Frames into the Workspace” on page 7-4
“Viewing Frames in the Memory Buffer” on page 7-6
“Bringing a Single Frame into the Workspace” on page 7-10
Overview
The toolbox provides three ways to move frames from the memory buffer into the
MATLAB workspace:
• Removing multiple frames from the buffer — To move a specified number
of frames from the memory buffer into the workspace, use the getdata function.
The getdata function removes the frames from the memory buffer as it moves
them into the workspace. The function blocks the MATLAB command line until
all the requested frames are available, or until a timeout value expires. For more
information, see “Moving Multiple Frames into the Workspace” on page 7-4.
• Viewing the most recently acquired frames in the buffer — To bring the most
recently acquired frames in the memory buffer into the workspace without removing
them from the buffer, use the peekdata function. When returning frames, peekdata
starts with the most recently acquired frame and works backward in the memory
buffer. In contrast, getdata starts at the beginning of the buffer, returning the
oldest acquired frame first. peekdata does not block the command line and is not
guaranteed to return all the frames you request. For more information, see “Viewing
Frames in the Memory Buffer” on page 7-6.
• Bringing a single frame of data into the workspace — As a convenience, the
toolbox provides the getsnapshot function, which returns a single frame of data
into the MATLAB workspace. Because the getsnapshot function does not require
starting the object or triggering an acquisition, it is the easiest way to bring image
data into the workspace. getsnapshot is independent of the memory buffer; it can
return a frame even if the memory buffer is empty, and the frame returned does
not affect the value of the FramesAvailable property. For more information, see
“Bringing a Single Frame into the Workspace” on page 7-10. For an example of
using getsnapshot, see the Image Acquisition Toolbox example Acquiring a Single
Image in a Loop in the Examples list at the top of the Image Acquisition Toolbox