Immediately return single image frame
frame = getsnapshot(obj)
[frame, metadata] = getsnapshot(obj)
frame = getsnapshot(obj) immediately
returns one single image frame,
frame, from the
video input object
obj. The frame of data returned
is independent of the video input object
and has no effect on the value of the
obj must be a 1-by-1 video input
frame is returned as an H-by-W-by-B matrix
Image height, as specified in the
Image width, as specified in the
Number of bands associated with
frame is returned to the MATLAB® workspace in its native data
type using the color space specified by the
You can use the MATLAB
to view the returned data.
[frame, metadata] = getsnapshot(obj) returns
metadata, a 1-by-1 array of structures. This structure contains information
about the corresponding frame. The metadata structure contains the
AbsTime, which is the absolute time the frame
was acquired, expressed as a time vector. In addition to that field,
some adaptors may choose to add other adaptor-specific metadata as
To interrupt the
getsnapshot function and
return control to the MATLAB command
line, issue the
^C (Ctrl+C) command.
Note: To get a list of options you can use on a function, press the Tab key after entering a function on the MATLAB command line. The list expands, and you can scroll to choose a property or value. For information about using this advanced tab completion feature, see Using Tab Completion for Functions.
Create a video input object.
obj = videoinput('matrox', 1);
Acquire and display a single frame of data.
frame = getsnapshot(obj); image(frame);
Remove the video input object from memory.
For an example of using
the Image Acquisition Toolbox™ example Acquiring
a Single Image in a Loop in the Examples list
at the top of the Image Acquisition Toolbox main Documentation Center
page, or open the file demoimaq_GetSnapshot.m in the MATLAB Editor.