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

10 Morphological Operations

Suppressing Minima and Maxima

In an image, every small fluctuation in intensity represents a regional minimum or maximum. You might only be interested in significant minima or maxima and not in these smaller minima and maxima caused by background texture.

To remove the less significant minima and maxima but retain the significant minima and maxima, use the imhmax or imhmin function. With these functions, you can specify a contrast criteria or threshold level, h, that suppresses all maxima whose height is less than h or whose minima are greater than h.

Note The imregionalmin, imregionalmax, imextendedmin, and imextendedmax functions return a binary image that marks the locations of the regional minima and maxima in an image. The imhmax and imhmin functions produce an altered image.

For example, this simple image contains two primary regional maxima, the blocks of pixels containing the value 14 and 18, and several smaller maxima, set to 11.

10-30

Morphological Reconstruction

To eliminate all regional maxima except the two significant maxima, use imhmax, specifying a threshold value of 2. Note that imhmax only affects the maxima; none of the other pixel values are changed. The two significant maxima remain, although their heights are reduced.

B = imhmax(A,2)

This figure takes the second row from the sample image to illustrate in 1-D how imhmax changes the profile of the image.

10-31

10 Morphological Operations

Imposing a Minimum

You can emphasize specific minima (dark objects) in an image using the imimposemin function. The imimposemin function uses morphological reconstruction to eliminate all minima from the image except the minima you specify.

To illustrate the process of imposing a minimum, this code creates a simple image containing two primary regional minima and several other regional minima.

mask = uint8(10*ones(10,10)); mask(6:8,6:8) = 2; mask(2:4,2:4) = 7;

mask(3,3) = 5; mask(2,9) = 9; mask(3,8) = 9; mask(9,2) = 9; mask(8,3) = 9

10-32

Morphological Reconstruction

Creating a Marker Image

To obtain an image that emphasizes the two deepest minima and removes all others, create a marker image that pinpoints the two minima of interest. You can create the marker image by explicitly setting certain pixels to specific values or by using other morphological functions to extract the features you want to emphasize in the mask image.

This example uses imextendedmin to get a binary image that shows the locations of the two deepest minima.

marker = imextendedmin(mask,1)

Applying the Marker Image to the Mask

Now use imimposemin to create new minima in the mask image at the points specified by the marker image. Note how imimposemin sets the values of pixels specified by the marker image to the lowest value supported by the datatype (0 for uint8 values). imimposemin also changes the values of all the other pixels in the image to eliminate the other minima.

10-33

10 Morphological Operations

I = imimposemin(mask,marker)

 

 

 

 

 

 

I =

 

 

 

 

 

 

 

 

 

11

11

11

11

11

11

11

11

11

11

11

8

8

8

11

11

11

11

11

11

11

8

0

8

11

11

11

11

11

11

11

8

8

8

11

11

11

11

11

11

11

11

11

11

11

11

11

11

11

11

11

11

11

11

11

0

0

0

11

11

11

11

11

11

11

0

0

0

11

11

11

11

11

11

11

0

0

0

11

11

11

11

11

11

11

11

11

11

11

11

11

11

11

11

11

11

11

11

11

11

This figure illustrates in 1-D how imimposemin changes the profile of row 2 of the image.

10-34

Morphological Reconstruction

Imposing a Minimum

10-35

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