Get movie frame
Synopsis
M = getframe
M = getframe(h)
M = getframe(h,rect)
[X,Map] = getframe(...)
Description
getframe
returns a column vector containing one movie frame. The frame is a snapshot (pixmap) of the current Axes.
M = getframe
gets a frame from the current Axes.
M = getframe(h)
gets a frame from the Figure or Axes graphics object identified by h
.
M = 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 graphics object identified by 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.
[X,Map] = getframe(...)
returns the frame as an indexed image matrix X
and a colormap Map
. In this case, h
is a handle to a Figure or Axes object. You display the image matrix using image
or imagesc
.
Remarks
Usually, getframe
is put in a for
loop to assemble movie matrix M
for playback using movie
. To provide more efficient memory use, use moviein
to allocate movie matrix M
before building the movie. This generates an appropriate size matrix of zeros.
Note that M = getframe;
returns the contents of the current Axes, exclusive of the axis labels, title, or tick labels. M = getframe(
gcf
);
captures the entire interior of the current Figure window.
If you plan to convert the MATLAB movie to another format (such as QuickTime) and you want to include the axis labels in this new format, you should capture the Figure, not just the Axes. If you are using moviein
to pre-allocate the movie matrix, be sure to specify the same Figure handle that you use with getframe
.
Examples
Make the peaks
function vibrate:
Z = peaks; surf(Z)
M = moviein(20);
axis
manual %
Freeze Axes limits
set(gca,'nextplot','replacechildren');
for j = 1:20
surf(sin(2*pi*j/20)*Z,Z)
M(:,j) = getframe;
end
movie(M,20) % Play the movie twenty times
See Also
movie
, moviein
,qtwrite
[ Previous | Help Desk | Next ]