Making a movie from images

10 ビュー (過去 30 日間)
Olu adroit
Olu adroit 2015 年 2 月 8 日
編集済み: Olu adroit 2015 年 2 月 9 日
Hi all,
I am trying to make a movie from a set of sequential images using the code below.
However I am getting an error message:
"Error using im2frame
Indexed movie frame must have a non-empty colormap"
"Error in movie (line 13)
writeVideo(writerObj,im2frame(Frame));"
Please is there some words i forgot to add to the line13?
Thanks for your help in advance
ImageFolder = ('C:\Work\2015 CA\Contour\Von Mises');
TiffFiles = dir(strcat(ImageFolder,'\*.tiff'));
S = [TiffFiles(:).datenum]
[S,S] = sort(S);
TiffFilesS = TiffFiles(S)
VideoFile = strcat(ImageFolder,'\Video');
writerObj = VideoWriter(VideoFile);
writerObj.FrameRate = 10;
open(writerObj);
for t= 1:length(TiffFilesS)
Frame = imread(strcat(ImageFolder,'\',TiffFilesS(t).name));
writeVideo(writerObj,im2frame(Frame));
end
close(writerObj);

採用された回答

Olu adroit
Olu adroit 2015 年 2 月 9 日
編集済み: Olu adroit 2015 年 2 月 9 日
Thanks all for your inputs. i was able to solve the issue by replacing the 'FOR' loop with the lines below:
for t= 1:length(TiffFilesS)
[Frame,map] = imread(strcat(ImageFolder,'\',TiffFilesS(t).name));
if ~isempty(map)
FramedImage = ind2rgb(Frame,map);
end
writeVideo(writerObj,im2frame(FramedImage));
end

その他の回答 (2 件)

Erik S.
Erik S. 2015 年 2 月 8 日
Hi,
Reading the error message there is an error when you are using the function im2frame, which is called on line 13.
What are you passing to the function in2frame?

Image Analyst
Image Analyst 2015 年 2 月 8 日
This is all demonstrated in well commented detail in my attached demo. Pay particular attention in the latter half of the demo where I create frame and colormaps.

カテゴリ

Help Center および File ExchangeConvert Image Type についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by