frame2im

Converts a movie frame into image data and a colormap.

Category: Graphics > 2-D and 3-D Plots

Syntax

im = frame2im(F)

Returns the image stored in the frame F.

[X, map] = frame2im(F)

Returns an indexed image and its colormap when the frame holds one.

Description

A movie frame is a structure; frame2im just unpacks it so the picture can be shown with imshow, saved with imwrite or processed. It is the inverse of im2frame.

Input arguments

F
Frame structure with the fields cdata and colormap, as made by getframe or im2frame.

Output arguments

im
Image array: m-by-n-by-3 truecolor data, or m-by-n indices if the frame has a colormap.
map
Colormap of the frame, empty for a truecolor frame.

Example

Indexed frame

F = im2frame(uint8([0 1; 2 3]), gray(4));
[X, map] = frame2im(F);
X
size(map)
Output
X = 2×2 uint8 matrix

   0   1
   2   3
ans = 1×2

     4     3

See also

im2frame getframe movie imshow imwrite