MATLAB Function Reference    

Get movie frame



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:

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:


Usually, 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:

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.


Make the peaks function vibrate.

See Also

frame2im, image, im2frame, movie

Bit-Mapped Images for related functions

  getfield get (serial)