[英]Matlab-Making video from images
Im trying to make a video from a file with 95 images in matlab.When i run the program,i get this error: 我试图在matlab中从具有95张图像的文件制作视频。当我运行该程序时,出现此错误:
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? 虽然当我用来制作视频的图像数量少于11个时,我没有问题,并且程序正在构造我想要的视频。您知道我如何解决该问题吗?
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');
All frames of a video must have the same size. 视频的所有帧必须具有相同的大小。 Resize your frames using 'imresize'. 使用“ imresize”调整帧的大小。 In case of different data types also apply 'im2double' 如果数据类型不同,也请应用“ im2double”
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.