frame2im
Return image data associated with movie frame
Description
Examples
Convert Movie Frame to Image Data
Create a surface plot. The data tip gives the x-, y- and z-coordinate of points along the surface.
surf(peaks)
Use getframe
to capture the plot as a movie frame. The 'colormap'
field is empty, therefore the movie frame contains a truecolor (RGB) image.
F = getframe
F = struct with fields: cdata: [357x452x3 uint8] colormap: []
Convert the captured movie frame to image data.
RGB = frame2im(F);
Display the truecolor image. The data tip gives information about the column and row indices and RGB value of pixels.
figure imshow(RGB)
Input Arguments
F
— Movie frame
structure
Movie frame, specified as a structure with two fields:
cdata
— The image data stored as an array ofuint8
values.colormap
— The colormap. If the movie frame contains a truecolor (RGB) images, then this field is empty ([]
).
You can create a movie frame structure by using the functions im2frame
and getframe
.
Output Arguments
RGB
— Truecolor image
m-by-n-by-3 numeric array
Truecolor image, returned as an m-by-n-by-3 numeric array.
Data Types: uint8
X
— Indexed image
m-by-n numeric matrix
Indexed image, returned as an m-by-n numeric matrix.
Data Types: uint8
map
— Colormap
c-by-3 numeric matrix
Colormap associated with indexed image X
, returned as
a c-by-3 numeric matrix with values in the range [0, 1].
Each row of map
is a three-element RGB triplet that
specifies the red, green, and blue components of a single color of the
colormap.
Data Types: double
Version History
Introduced before R2006a
Open Example
You have a modified version of this example. Do you want to open this example with your edits?
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)