Tue 06 Jul 2010 10:11:35 AM UTC, original submission:
In short: imread returns an error trying to read more frames than an image has. I'd like it to return all frames of an arbitrary multiple-frame image (e.g. .gif, .tiff files) and store them in an array.
Currently, imread() supports reading multiple frames of a .GIF (say) image using an optional second argument. For example, if I know my example.GIF has 16 frames, I can do:
M = imread('example.GIF',7);
to read one frame, or
M = imread('example.GIF',1:16);
to read a range of frames (though this isn't in the documentation for imread() at the moment). However, if I do not know the number of frames in my image, and tried to read the first 17 frames of my image that only has sixteen frames,
M = imread('example.GIF',1:17);
Octave returns an error with no array. This is really the problem. If there is not some way to do this already, the cleanest way I see to fix it is to modify imfinfo to be able to detect the number of frames in an image (if this is something that's in the metadata of GIF files, i'm not sure), then use that to implement a parameter to read all the frames in imread, or if the user is requesting to read frames that don't exist, return what can be read up to that point.
|