How to make a video from two arrays?

4 views (last 30 days)
TheBeginner
TheBeginner on 5 Jun 2013
Hi,
I have two arrays, one "image" 200x200xN (N number of images) and a curve N x [x y], ie N times a point.
I want to make a video which is the sum of the two arrays.
I already know how to make a video using avifile and by displaying the picture on a figure. I have used this method for this particular case, by displaying the two arrays on the same figure and using "hold on"," hold off".
I would like to know if I could do this without having to display the arrays on a figure.
Here's my code :
aviobj = avifile('example.avi','compression','None');
fig = figure;
for i=1:size(image,3) %image = 200x200xN arrays
imagesc(image(:,:,i));
hold on;
%vect is a N*2 arrays
plot(vect(:,1),vect(:,2),'r*','LineStyle','none'), axis ij;
hold off
f = getframe(fig);
aviobj = addframe(aviobj,f);
end
aviobj = close(aviobj);

Answers (1)

Image Analyst
Image Analyst on 5 Jun 2013
Yes, you can use im2frame(), as I show in my demo: http://www.mathworks.com/matlabcentral/answers/77594#answer_87271

Categories

Find more on Convert Image Type in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!