Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
pmi432 / LR07 / 2read / image processing toolbox guide.pdf
Скачиваний:
150
Добавлен:
18.03.2015
Размер:
18.08 Mб
Скачать

Viewing Image Sequences

Viewing Image Sequences as a Montage

To view multiple frames in a multiframe array at one time, use 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.

This example creates an array of truecolor images and uses montage to display them all at once. Note how montage displays the images in a 2-by-2 grid. The first image frame is displayed in the first position of the first row, the next frame in the second position of the first row, and so on.

onion = imread('onion.png');

onionArray = repmat(onion, [ 1 1 1 4 ]); montage(onionArray);

4-63

4 Displaying and Exploring Images

montage supports several optional parameters that you can use to customize the display. For example, using the 'size' parameter, you can specify the number of rows and columns montage uses to display the images. To display the onion images in one horizontal row, specify the 'size' parameter with the value [1 NaN]. When you specify NaN for a dimension, montage calculates the number of images to display along that dimension. Using montage parameters you can also specify which images in the image array you want to display, and adjust the contrast of the images displayed. See montage

for more information.

Converting a Multiframe Image to a Movie

To create a MATLAB movie from a multiframe image array, use the immovie function. This example creates a movie from a multiframe indexed image.

mov = immovie(X,map);

4-64

Viewing Image Sequences

In the example, X is a four-dimensional array of images that you want to use for the movie.

To play the movie, use the implay function.

implay(mov);

This example loads the multiframe image mri.tif and makes a movie out of it. It won’t do any good to show the results here, so try it out; it’s fun to watch.

mri = uint8(zeros(128,128,1,27)); for frame=1:27

[mri(:,:,:,frame),map] = imread('mri.tif',frame); end

mov = immovie(mri,map); implay(mov);

Note To view a MATLAB movie, you must have MATLAB software installed. To make a movie that can be run outside the MATLAB environment, use the avifile and addframe functions to create an AVI file, or use movie2avi.

AVI files can be created using indexed and RGB images of classes uint8 and double, and don’t require a multiframe image.

4-65

Соседние файлы в папке 2read