Yes, you can use im2frame(), as I show in my demo: http://www.mathworks.com/matlabcentral/answers/77594#answer_87271
How to make a video from two arrays?
1 次查看(过去 30 天)
显示 更早的评论
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);
0 个评论
回答(1 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!