avi video from image error

2 views (last 30 days)
Ayesha
Ayesha on 21 Feb 2014
Commented: Walter Roberson on 21 Feb 2014
Hello,
Here, I'm trying to convert image frames to video. The image frames are contained in the folder 'folder_1'. Whenever I'm trying to run it, I'm getting the error: ''RIFF' did not appear as expected'. Below is the code. What might be wrong in here? And yes, the images are on high dynamic range format.
files = dir('folder_1');
aviobj = avifile('a.avi'); %creating a movie object
for i=1:numel(files) %number of images to be read
a = read_radiance(file(i));
a = uint8(a);%convert the images into unit8 type
M = im2frame(a);%convert the images into frames
aviobj = addframe(aviobj,M);%add the frames to the avi object created previously
fprintf('adding frame = %i\n', i);
end
disp('Closing movie file...')
aviobj = close(aviobj);
disp('Playing movie file...')
implay('a.avi');

Answers (1)

Walter Roberson
Walter Roberson on 21 Feb 2014
You have not defined a vector "file" that you take an element of to pass to read_radiance
If you are intending to pass files(i) instead of file(i) then recall that files(i) would be a struct rather than a file name. I do not find any routine named read_radiance() so I do not know if that is a problem for you.
You should also be taking into account that in the directory list there will be an entry for "." and another for ".." You should be removing those from consideration. For example after doing the dir() do
files([files.isdir]) = [];
  2 Comments
Ayesha
Ayesha on 21 Feb 2014
read_radiance is the same as hdrread.
This is still not solving the problem.
Walter Roberson
Walter Roberson on 21 Feb 2014
hdrread() takes a filename. Your code is not passing in a filename.
Please show your latest version of the code.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!