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

Working with Image Sequences

Working with Image Sequences

In this section...

“Overview of Toolbox Functions That Work with Image Sequences” on page 2-21

“Process Image Sequences” on page 2-24

“Process Multi-Frame Image Arrays” on page 2-25

Overview of Toolbox Functions That Work with Image Sequences

Some applications work with collections of images related by time, such as frames in a movie, or by spatial location, such as magnetic resonance imaging (MRI) slices. These collections of images are referred to by a variety of names, such as image sequences or image stacks.

The ability to create N-dimensional arrays can provide a convenient way to store image sequences. For example, an m-by-n-by-p array can store an array of p two-dimensional images, such as grayscale or binary images, as shown in the following figure. An m-by-n-by-3-by-p array can store truecolor images where each image is made up of three planes.

Multidimensional Array Containing an Image Sequence

Many toolbox functions can operate on multi-dimensional arrays and, consequently, can operate on image sequences. For example, if you pass a multi-dimensional array to the imtransform function, it applies the same 2-D transformation to all 2-D planes along the higher dimension.

2-21

2 Introduction

Some toolbox functions that accept multi-dimensional arrays, however, do not by default interpret an m-by-n-by-p or an m-by-n-by-3-by-p array as an image sequence. To use these functions with image sequences, you must use particular syntax and be aware of other limitations. The following table lists these toolbox functions and provides guidelines about how to use them to process image sequences. For information about displaying image sequences, see “Viewing Image Sequences” on page 4-54.

 

 

Image Sequence

Guideline When Used with an

 

 

Function

Dimensions

Image Sequence

 

 

bwlabeln

m-by-n-by-p only

Must use the bwlabeln(BW,conn)

 

 

 

 

syntax with a 2-D connectivity.

 

 

deconvblind

m-by-n-by-p or

PSF argument can be either 1-D

 

 

 

m-by-n-by-3-by-p

or 2-D.

 

 

deconvlucy

m-by-n-by-p or

PSF argument can be either 1-D

 

 

 

m-by-n-by-3-by-p

or 2-D.

 

 

edgetaper

m-by-n-by-p or

PSF argument can be either 1-D

 

 

 

m-by-n-by-3-by-p

or 2-D.

 

 

entropyfilt

m-by-n-by-p only

nhood argument must be 2-D.

 

 

imabsdiff

m-by-n-by-p or

Image sequences must be the same

 

 

 

m-by-n-by-3-by-p

size.

 

 

imadd

m-by-n-by-p or

Image sequences must be the same

 

 

 

m-by-n-by-3-by-p

size. Cannot add scalar to image

 

 

 

 

sequence.

 

 

imbothat

m-by-n-by-p only

SE argument must be 2-D.

 

 

imclose

m-by-n-by-p only

SE argument must be 2-D.

 

 

imdilate

m-by-n-by-p only

SE argument must be 2-D.

 

 

imdivide

m-by-n-by-p or

Image sequences must be the same

 

 

 

m-by-n-by-3-by-p

size.

 

 

imerode

m-by-n-by-p only

SE argument must be 2-D.

 

 

imextendedmax

m-by-n-by-p only

Must use the

 

 

 

 

imextendedmax(I,h,conn)

 

 

 

 

syntax with a 2-D connectivity.

 

2-22

Working with Image Sequences

 

 

Image Sequence

Guideline When Used with an

 

 

Function

Dimensions

Image Sequence

 

 

imextendedmin

m-by-n-by-p only

Must use the

 

 

 

 

imextendedmin(I,h,conn)

 

 

 

 

syntax with a 2-D connectivity.

 

 

imfilter

m-by-n-by-p or

With grayscale images, h can be

 

 

 

m-by-n-by-3-by-p

2-D. With truecolor images (RGB),

 

 

 

 

h can be 2-D or 3-D.

 

 

imhmax

m-by-n-by-p only

Must use the imhmax(I,h,conn)

 

 

 

 

syntax with a 2-D connectivity.

 

 

imhmin

m-by-n-by-p only

Must use the imhmin(I,h,conn)

 

 

 

 

syntax with a 2-D connectivity.

 

 

imlincomb

m-by-n-by-p or

Image sequences must be the same

 

 

 

m-by-n-by-3-by-p

size.

 

 

immultiply

m-by-n-by-p or

Image sequences must be the same

 

 

 

m-by-n-by-3-by-p

size.

 

 

imopen

m-by-n-by-p only

SE argument must be 2-D.

 

 

imregionalmax

m-by-n-by-p only

Must use the

 

 

 

 

imextendedmax(I,conn) syntax

 

 

 

 

with a 2-D connectivity.

 

 

imregionalmin

m-by-n-by-p only

Must use the

 

 

 

 

imextendedmin(I,conn) syntax

 

 

 

 

with a 2-D connectivity.

 

 

imtransform

m-by-n-by-p or

TFORM argument must be 2-D.

 

 

 

m-by-n-by-3-by-p

 

 

 

imsubtract

m-by-n-by-p or

Image sequences must be the same

 

 

 

m-by-n-by-3-by-p

size.

 

 

imtophat

m-by-n-by-p only

SE argument must be 2-D.

 

 

padarray

m-by-n-by-p or

PADSIZE argument must be a

 

 

 

m-by-n-by-3-by-p

two-element vector.

 

 

rangefilt

m-by-n-by-p only

NHOOD argument must be 2-D.

 

 

stdfilt

m-by-n-by-p only

NHOOD argument must be 2-D.

 

 

 

 

 

 

2-23

2 Introduction

 

 

Image Sequence

Guideline When Used with an

 

 

Function

Dimensions

Image Sequence

 

 

tformarray

m-by-n-by-p or

T must be 2-D to 2-D (compatible

 

 

 

m-by-n-by-3-by-p

with imtransform).

 

 

 

 

R must be 2-D.

 

 

 

 

TDIMS_A and TDIMS_B must be

 

 

 

 

2-D, i.e., [2 1] or [1 2].

 

 

 

 

TSIZE_B must be a two-element

 

 

 

 

array [D1 D2], where D1 and

 

 

 

 

D2 are the first and second

 

 

 

 

transform dimensions of the

 

 

 

 

output space.

 

 

 

 

TMAP_B must be [TSIZE_B 2].

 

 

 

 

F can be a scalar or a p-by-1

 

 

 

 

array, for m-by-n-by-p arrays.

 

 

 

 

Or F can be a scalar, 1-by-p

 

 

 

 

array; 3-by-1 array; or 3-by-p

 

 

 

 

array, for m-by-n-by-3-by-p

 

 

 

 

arrays.

 

 

watershed

m-by-n-by-p only

Must use watershed(I,conn)

 

 

 

 

syntax with a 2-D connectivity.

 

Process Image Sequences

This example starts by reading a series of images from a directory into the MATLAB workspace, storing the images in an m-by-n-by-p array. The example then passes the entire array to the stdfilt function and performs standard deviation filtering on each image in the sequence. Note that, to use stdfilt with an image sequence, you must use the nhood argument, specifying a 2-D neighborhood.

% Create an array of filenames that make up the image sequence fileFolder = fullfile(matlabroot,'toolbox','images','imdemos'); dirOutput = dir(fullfile(fileFolder,'AT3_1m4_*.tif')); fileNames = {dirOutput.name}';

numFrames = numel(fileNames);

2-24

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