Process Multiframe Image Arrays

The toolbox includes two functions, immovie and montage, that work with a specific type of multidimensional array called a multiframe array. In this array, images, called frames in this context, are concatenated along the fourth dimension. Multi-frame arrays are either m-by-n-by-1-by-p, for grayscale, binary, or indexed images, or m-by-n-by-3-by-p, for truecolor images, where p is the number of frames.

For example, a multiframe array containing five, 480-by-640 grayscale or indexed images would be 480-by-640-by-1-by-5. An array with five 480-by-640 truecolor images would be 480-by-640-by-3-by-5.


To process a multiframe array of grayscale images as an image sequence, you can use the squeeze function to remove the singleton dimension.

You can use the cat command to create a multiframe array. For example, the following stores a group of images in a single array.

A = cat(4,A1,A2,A3,A4,A5)

You can also extract frames from a multiframe image. For example, if you have a multiframe image MULTI, this command extracts the third frame.

FRM3 = MULTI(:,:,:,3)

Note that, in a multiframe image array, each image must be the same size and have the same number of planes. In a multiframe indexed image, each image must also use the same colormap.