MATLAB Answers

How do I generate a video from images that I create on MATLAB?

I am generating a missile simulation input for which I created a sequence of images using an iterative for loop. The code starts with a single aerial image using which I have generated a sequence of images that make it seem like the image is rotating. I used campan, camzoom, camva and drawnow to consecutively display the sequence of images when I run the code. It looks like a video of an aerial image rotating when I run the code. My problem is, that I need to extract a video from these generated images, and save it on my computer to use as input for the missile simulator. Please help.

  댓글 수: 0

로그인 to comment.

답변 수: 2

Image Analyst 님의 답변 11 Jun 2017
 채택된 답변

  댓글 수: 3

Sir, if I understand correctly, this is for a collection of PNG images stored in a folder. My issue is that I am generating these images first-hand when I run the code, and I cannot save them on the computer owing to the extremely large number of images. One image in the loop is rotated by about 0.1 degree compared to its predecessor. And once I save them, if I save them, they both turn out to be the same. They both turn out to be the original image.
Sir, my apologies. Your demo seems to resemble what I'm looking for. I shall try it out and get back to you. Many thanks.
Sir, this is one portion of the code I have. Now, I need to generate a similar video with the resultant images. Please help? Thank you.
A = imread('aerial.jpg');
imshow(A, 'InitialMagnification', 'fit')
camtarget([3300 1500 0])
for i = 10:-0.1:9
for j = 4:8
camzoom(j)
camva(i)
campan(1, 0)
drawnow
% imsave
end
end

로그인 to comment.


Stalin Samuel 님의 답변 11 Jun 2017

  댓글 수: 3

Sir, I've read this. My problem is, that I am generating new images. One image is about 0.1 degrees rotated compared to its previous image. I need to use the images generated when the code is run, to make the movie, not pre-stored images on my computer. The code generates an extremely large number of images so I didn't think saving all of them would be viable. In any case, when I did try saving them with imsave in the for loop, one, it asks me under which filename I must save these for all 1000 images, and two, the image subsequently saved is the same as the image I input. Once I use campan, camzoom and camva, and try and save the images, it saves the original image itself.
Hi, Have you found a way to create the video without saving the images on your computer? I have the same problem, but I cannot find a solution.
Thank you
Yes they did. The code I attached in my answer does that. Did you just not "find" my Answer above? Where in there do you see that it's saving individual frames to disk before constructing the movie? It does not (though it could be altered to do that if someone wanted to).

로그인 to comment.



Translated by