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

Working with Image Sequences

I = imread(fileNames{1});

% Preallocate the array

sequence = zeros([size(I) numFrames],class(I)); sequence(:,:,1) = I;

%Create image sequence array for p = 2:numFrames

sequence(:,:,p) = imread(fileNames{p});

end

%Process sequence

sequenceNew = stdfilt(sequence,ones(3));

% View results figure;

for k = 1:numFrames imshow(sequence(:,:,k));

title(sprintf('Original Image # %d',k)); pause(1);

imshow(sequenceNew(:,:,k),[]); title(sprintf('Processed Image # %d',k)); pause(1);

end

Process Multi-Frame Image Arrays

The toolbox includes two functions, immovie and montage, that work with a specific type of multi-dimensional array called a multi-frame 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 multi-frame 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.

2-25

2 Introduction

Note To process a multi-frame array of grayscale images as an image sequence, as described in “Working with Image Sequences” on page 2-21, you can use the squeeze function to remove the singleton dimension.

You can use the cat command to create a multi-frame array. For example, the following stores a group of images (A1, A2, A3, A4, and A5) 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.

2-26

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