How to loop images using for loop and making it run on mp4

9 visualizaciones (últimos 30 días)
James Chang
James Chang el 9 de Nov. de 2016
Comentada: Image Analyst el 9 de Nov. de 2016
I want to loop 4 images onto a mp4 player as a result im stuck on the looping using for loop may anyone help me.
My Code:
x = VideoWriter('myAnimation','MPEG-4');
x.FrameRate = 0.5;
x.VideoCompressionMethod
open(x);
for B = 1:5;
Bimread('mob.jpg'); %inputting images here!
C = imresize(B, .25);
end
writeVideo(x,C);
close(x);
*Im not sure where the

Respuestas (2)

Image Analyst
Image Analyst el 9 de Nov. de 2016
After you've created the video, use movie() to play it.

James Chang
James Chang el 9 de Nov. de 2016
Editada: James Chang el 9 de Nov. de 2016
I have a mp4 video but will not loop all my images.
Here is my new code:
%% My Animation
x = VideoWriter('myAnimation','MPEG-4');
x.FrameRate = 0.5;
open(x);
imfile{1}='mob.jpg';
imfile{2}='parkes.jpg';
imfile{3}='mob.jpg';
for i=1:3
img = imread(imfile{i}); % process img here if you wish
figure;
imshow(img);
end
writeVideo(x,C);
close(x);

Community Treasure Hunt

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

Start Hunting!

Translated by