im2frame
Converts an image into a movie frame structure.
Category: Graphics > 2-D and 3-D Plots
Syntax
F = im2frame(RGB)
Makes a frame from a truecolor m-by-n-by-3 image.
F = im2frame(X, map)
Makes a frame from an indexed image and its colormap.
Description
A movie is a struct array of frames. im2frame lets you build those frames from images you already have, for instance read from files or computed, and then play them with movie. frame2im goes the other way. A truecolor image must have exactly three planes; an indexed image needs a colormap.
Input arguments
RGB- Truecolor image of class
uint8. X, map- Indexed image and a colormap with three columns.
Output arguments
F- Structure with fields
cdataandcolormap. For a truecolor imagecolormapis empty.
Example
Indexed and truecolor frames
F = im2frame(uint8([0 1; 2 3]), gray(4));
size(F.cdata)
size(F.colormap)
G = im2frame(uint8(cat(3, ones(2), 2*ones(2), 3*ones(2))));
size(G.cdata)
Output
ans = 1×2
2 2
ans = 1×2
4 3
ans = 1×3
2 2 3