I want to convert 95 tiffs to an avi.
this is the code I'm using:
v = VideoWriter('newfile.avi','Uncompressed AVI');
open(v);
%95 images
for k=1:95
yr=2005;
icnt=yr+1;
frame = sprintf('scale%dRCP2.6.tif', icnt);
input = imread(frame);
writeVideo(v,input);
end
close(v);
It creates the avi file, but it only seems to pull in one image? I think it's probably a problem with when the frame is being read in within the loop but I can't figure out what's going wrong.
I have also tried this approach:
% Create a video writer object
writerObj = VideoWriter('Video.avi');
% Set frame rate
writerObj.FrameRate = 10;
% Open video writer object and write frames sequentially
open(writerObj)
yr=2005;
for i=1:95;
icnt=yr+1;
frame = sprintf('scale%dRCP2.6.tif', icnt);
input = imread(frame);
% Write frame now
writeVideo(writerObj, input);
end
% Close the video writer object
close(writerObj);
But the avi does not work at all using this code. There are no images being pulled in to it.