Reputation: 11
Im trying to make a video from a file with 95 images in matlab.When i run the program,i get this error:
Error using VideoWriter/writeVideo (line 383)
Frame must be 481 by 272
Error in savenew (line 14)
writeVideo(writerObj,im2frame(Frame)
Although when the number of images that i use for making the video is under 11 i have no problem and the program is constructing the video that i want.Do you know how i can fix the problem?
Thanks in advance
Here is my update code:
ImagesFolder=uigetdir;
jpegFiles = dir(strcat(ImagesFolder,'\*.jpg'));
S = [jpegFiles(:).datenum];
[S,S] = sort(S);
jpegFilesS = jpegFiles(S);
VideoFile=strcat(ImagesFolder,'\MyVideo');
writerObj = VideoWriter(VideoFile);
fps= 10;
writerObj.FrameRate = fps;
open(writerObj);
for t= 1:length(jpegFilesS)
Frame=imread(strcat(ImagesFolder,'\',jpegFilesS(t).name));
B = imresize(Frame, 1.0);
C=im2double(B);
writeVideo(writerObj,im2frame(C));
end
close(writerObj);
implay('C:\Program Files\MATLAB\R2013a\bin\sfalmata neo\MyVideo.avi');
Upvotes: 0
Views: 880
Reputation: 36710
All frames of a video must have the same size. Resize your frames using 'imresize'. In case of different data types also apply 'im2double'
Upvotes: 3