|MATLAB Function Reference|
Get movie frame
returns a movie frame. The frame is a snapshot (pixmap) of the current axes or figure.
F = getframe
gets a frame from the current axes.
F = getframe(h)
gets a frame from the figure or axes identified by the handle
F = getframe(h,rect)
specifies a rectangular area from which to copy the pixmap.
rect is relative to the lower-left corner of the figure or axes
h, in pixel units.
rect is a four-element vector in the form
[left bottom width height], where
height define the dimensions of the rectangle.
returns a movie frame, which is a structure having two fields:
F = getframe(...)
cdata- The image data stored as a matrix of uint8 values. The dimensions of
colormap- The colormap stored as an n-by-3 matrix of doubles.
F.colormapis empty on true color systems.
To capture an image, use this approach:
[X,Map] = getframe(...)
returns the frame as an indexed image matrix
X and a colormap
Map. This version is obsolete and is supported only for compatibility with earlier version of MATLAB. Since indexed images cannot always capture true color displays, you should use the single output argument form of
getframe. To write code that is compatible with earlier version of MATLAB and that can take advantage of true color support, use the following approach:
getframe is used in a
for loop to assemble an array of movie frames for playback using
movie. For example,
To create movies that are compatible with earlier versions of MATLAB (before Release 11/MATLAB 5.3) use this approach:
F = getframe; returns the contents of the current axes, exclusive of the axis labels, title, or tick labels.
F = getframe(
); captures the entire interior of the current figure window. To capture the figure window menu, use the form
F = getframe(h,rect) with a rectangle sized to include the menu.
peaks function vibrate.
Z = peaks; surf(Z)
axistight set(gca,'nextplot','replacechildren'); for j = 1:20 surf(sin(2*pi*j/20)*Z,Z) F(j) = getframe; end movie(F,20) % Play the movie twenty times
Bit-Mapped Images for related functions