|
Hi everyone,
I'm trying to create a video from a set of images. I've tried different codes but it doesn't seem that any of them is working very well. Has anyone already done that and can help me? Here is the last code that I use, it is creating a video but after that it doesn't run smooth, I mean it jumps over the images at a certain points and I don't what it is related to. Here it is:
fileFolder = fullfile('C:\Users\Dimitar\Documents\MATLAB\Plot');
path=fullfile(fileFolder,'data*.tif');
dirOutput = dir(path);
fileNames ={dirOutput.name};
numFrames = numel(fileNames);
I = imread(fullfile(fileFolder,fileNames{+1}));
rmax=size(I,1);
cmax=size(I,2);
sequence = zeros([size(I,1) size(I,2) 3 numFrames], class(I));
% load in array
for p = 1:numFrames
sequence(:,:,:,p) = imread(fullfile(fileFolder,fileNames{p}));
end
mov = avifile('test.avi','Compression','None','fps',8);
for j=1:size(sequence,4)
imshow(sequence(:,:,:,j));
f=getframe;
mov = addframe(mov, f);
end
mov = close(mov);
close all;
Please let me know if any of you has already solved that.
Thank you
Jimmy
|