Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

Liz Kantor

2016 MCB 105 Systems Neuroscience


Engert/TF Clemens Riegler

10 Feb
Prof. Florian

Digital Assignment Two


Part I: Identifying the Right Files
1. strcat concatenates strings, which means that it links strings (which
are sequences of characters not related to a variable) in a series.
2. sprintf converts what is inside the parentheses into the string. Input
One is Frame%d.jpg, which tells the program what the string is going
to look like. Input two is what replaces of %d
3. The sprintf function allows the program to run a for loop, where %d
acts as i, and can be replaced, in this instance, with 1-16. This
method is much more efficient than using strcat because you dont
have to individually list each frame.
Part II: Import the First Two Frames Manually
1. imread reads an image from a file, which can later be called to make
our movie, specifies that information is read from a specific location
and the thing its reading is an image
2. Movie has 4 dimensions
3. 282 x 352 x 3 x 16
4. Movie has 4 dimensions x, y, color, time, where (x, y) specifies the
pixel coordinate
Part III: Optimize Part II
>> Movie(:,:,:,1) = imread(Frame1Location);
>> Movie(:,:,:,2) = imread(Frame2Location);
Part IV: Use a For Loop
>>for i = 3:16
Frameifile = sprintf('Frame%d.jpg',i);
FrameiLocation = strcat(Path,Frameifile);
Movie(:,:,:,i) = imread(FrameiLocation);
end
Part V: Saving the Movie
1. Frame1file = Frame1.jpg
2. Frame1Location = strcat(Path,Frame1file)
3. Movie(:,:,:,1) = imread(Frame1Location)
4. for i = 3:16
Frameifile = sprintf('Frame%d.jpg',i);
FrameiLocation = strcat(Path,Frameifile);
Movie(:,:,:,i) = imread(FrameiLocation);
end

5. obj = VideoWriter(DopestMovieEver.avi)
open(obj)
writeVideo(obj,Movie)
close(obj)

You might also like