| MATLAB Function Reference | ![]() |
Syntax
Description
getframe
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 h.
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 width and height define the dimensions of the rectangle.
F = getframe(...)
returns a movie frame, which is a structure having two fields:
cdata -- The image data stored as a matrix of uint8 values. The dimensions of F.cdata are height-by-width-by-3.
colormap -- The colormap stored as an n-by-3 matrix of doubles. F.colormap is empty on true color systems.
To capture an image, use this approach:
Remarks
Usually, getframe is used in a for loop to assemble an array of movie frames for playback using movie. For example,
Capture Regions
Note that F = getframe; returns the contents of the current axes, exclusive of the axis labels, title, or tick labels. F = getframe(gcf); 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.
Examples
Make the peaks function vibrate.
Z = peaks; surf(Z)
axis tight
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
See Also
frame2im, image, im2frame, movie
Bit-Mapped Images for related functions
| getfield | get (memmapfile) | ![]() |
© 1994-2005 The MathWorks, Inc.