Beruflich Dokumente
Kultur Dokumente
2/25/14
Review
Images are represented as matrices Color images
RGB 3D matrices
Indexed Images
Colormap
Is a 2D matrix with 3 columns Each row represents an RGB value
Each pixel value of an indexed image serves as an index into the colormap
image(A)
Display RGB image if A is mn3 Display indexed image (using current colormap) if A is 2D
Image Functions
Converting between image types
rgb2gray rgb2ind ind2rgb ind2gray
Can allow interaction between a user and a figure! Applies to figures in general, not just images
Movies
A movie is just an array of individual images! Create a movie in Matlab
Create a bunch of images and use getframe
getframe takes a snapshot of the current axis Often done in a loop see example_file9.m
movie play the frames back in Matlab movie2avi create .avi file from frames VideoWriter
Movies
Read a movie into Matlab
VideoReader
m=VideoReader('matlab_light_message.avi'); image_stack=read(m);
image_stack is a 4-D matrix An additional input argument allows you to select just a subset of the frames
implay
Opens a movie player Input can be
Filename Movie structure Image stack
Like 'matlab_light_message.avi' Created using getframe and loop Like image_stack from above
Structures
Has multiple fields
To access different fields, use a dot
variable_name.field_name
See example_file9.m for examples The movie structure we created using getframe has two fields and one element for each frame
1x100 struct array with fields: cdata colormap
save
Save all or just specific variables to a file save my_datafile.mat save my_datafile2.mat x y
load
Load data from a file load my_datafile.mat
save, load
Can deal with both MAT and ASCII files If loading from a text file, the See documentation for details data is stored in a variable
named after the file (without the file extension)
Final Notes
Lecture slides and examples posted on Canvas Homework #6 Upcoming Schedule
Exam Review
Come prepared with questions
2/25: Image Processing (part 2) 2/27: Curve Fitting/Exam Review
Exam covers through todays lecture (through HW6) 3/4: Exam 3/6: Sound/Curve Fitting SPRING BREAK!!!