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개)
Image Analyst
2013년 6월 5일
Yes, you can use im2frame(), as I show in my demo: http://www.mathworks.com/matlabcentral/answers/77594#answer_87271
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!