www.gusucode.com > images 案例代码 matlab源码程序 > images/ViewImageSequenceAsMontageExample.m

    %% View Image Sequence as Montage
% This example shows how to view multiple frames in a multiframe array at
% one time, using the |montage| function. |montage| displays all the image
% frames, arranging them into a rectangular grid. The montage of images is
% a single image object. The image frames can be grayscale, indexed, or
% truecolor images. If you specify indexed images, they all must use the
% same colormap.
%%
% Create an array of truecolor images.
onion = imread('onion.png');
onionArray = repmat(onion, [ 1 1 1 4 ]);
%%
% Display all the images at once, in a montage. By default, the |montage|
% function displays the images in a grid. The first image frame is in
% the first position of the first row, the next frame is in the second
% position of the first row, and so on.
montage(onionArray);
%%
% To specify a different number of rows and columns, use the |'size'|
% parameter. For example, to display the images in one horizontal row,
% specify the |'size'| parameter with the value |[1 NaN]|. Using other
% |montage| parameters you can specify which images you want to display and
% adjust the contrast of the images displayed.
montage(onionArray,'size',[1 NaN]);