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

10 Morphological Operations

One way to create a marker image is to subtract a constant from the mask image, using imsubtract.

marker = imsubtract(A,2)

 

 

 

 

 

 

marker =

 

 

 

 

 

 

 

 

 

8

8

8

8

8

8

8

8

8

8

8

12

12

12

8

8

9

8

9

8

8

12

12

12

8

8

8

9

8

8

8

12

12

12

8

8

9

8

9

8

8

8

8

8

8

8

8

8

8

8

8

9

8

8

8

16

16

16

8

8

8

8

8

9

8

16

16

16

8

8

8

8

9

8

8

16

16

16

8

8

8

9

8

9

8

8

8

8

8

8

8

8

8

8

8

8

9

8

8

8

2Call the imreconstruct function to morphologically reconstruct the image. In the output image, note how all the intensity fluctuations except the intensity peak have been removed.

recon = imreconstruct(marker, mask)

Pixel Connectivity

Morphological processing starts at the peaks in the marker image and spreads throughout the rest of the image based on the connectivity of the pixels. Connectivity defines which pixels are connected to other pixels. A set of pixels in a binary image that form a connected group is called an object or a connected component.

10-20

Morphological Reconstruction

Determining which pixels create a connected component depends on how pixel connectivity is defined. For example, this binary image contains one foreground object or two, depending on the connectivity. If the foreground is 4-connected, the image is all one object — there is no distinction between

a foreground object and the background. However, if the foreground is 8-connected, the pixels set to 1 connect to form a closed loop and the image has two separate objects: the pixels in the loop and the pixels outside the loop.

0

0

0

0

0

0

0

0

0

1

1

1

1

1

0

0

0

1

0

0

0

1

0

0

0

1

0

0

0

1

0

0

0

1

0

0

0

1

0

0

0

1

1

1

1

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

Defining Connectivity in an Image

The following table lists all the standard twoand three-dimensional connectivities supported by the toolbox. See these sections for more information:

“Choosing a Connectivity” on page 10-22

“Specifying Custom Connectivities” on page 10-23

Supported Connectivities

Two-Dimensional

 

 

Connectivities

 

 

4-connected

Pixels are connected if their edges touch.

 

 

This means that a pair of adjoining pixels are

 

 

part of the same object only if they are both

 

 

on and are connected along the horizontal or

 

 

vertical direction.

 

10-21

10 Morphological Operations

Supported Connectivities (Continued)

8-connected

Pixels are connected if their edges or corners

 

 

touch. This means that if two adjoining pixels

 

 

are on, they are part of the same object,

 

 

regardless of whether they are connected

 

 

along the horizontal, vertical, or diagonal

 

 

direction.

 

Three-Dimensional

 

 

Connectivities

 

 

6-connected

Pixels are connected if their faces touch.

 

 

 

 

18-connected

Pixels are connected if their faces or edges

 

 

touch.

 

 

 

 

26-connected

Pixels are connected if their faces, edges, or

 

 

corners touch.

 

 

 

 

Choosing a Connectivity

The type of neighborhood you choose affects the number of objects found in an image and the boundaries of those objects. For this reason, the results of many morphology operations often differ depending upon the type of connectivity you specify.

For example, if you specify a 4-connected neighborhood, this binary image contains two objects; if you specify an 8-connected neighborhood, the image has one object.

10-22

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