Hello.
Please,I have a folder with a name (Photos) and it is containing four subfolders with names (Order1,Order2,Order3,Order4). each folder containing 100 images. I am trying to make a movie for each subfolder. I will get 4 movies. I used below code and its read images from each folder automatically and create movies and save it in the same folder. So, I got four movies. The problem that there is jump during movie so picture number 1 is repeated many times during the video at different times. Can anyone help me with this code? or if there are any other code that can accomplish this job.
startpath = pwd; for k = 1:4 folder = fullfile(startpath, 'Photos', sprintf('Order%d', k)); cd(folder) Files = dir('*.jpg'); NumFiles= size(Files,1); Megamind_Images = uint8(zeros([600 1000 3 NumFiles*5])); VideoObj = VideoWriter('Create_Video.mp4','MPEG-4'); VideoObj.FrameRate = 5; VideoObj.Quality = 80; count=1; for i = 1 : NumFiles I = imread(Files(i).name); ResizeImg = imresize(I,[600 1000]); for j = 1 : 5 Megamind_Images(:,:,:,count)=ResizeImg; count = count + 1; end end open(VideoObj); writeVideo(VideoObj, Megamind_Images); close(VideoObj); end
Best Answer