24
Contents: Contents: CSE 489: Digital Image CSE 489: Digital Image Processing Processing Topic – 7: Topic – 7: Image Image Segmentation Segmentation 1 Fall 2012 Fall 2012

Topic 7 (image segmentation)

Embed Size (px)

Citation preview

Page 1: Topic   7 (image segmentation)

Contents:Contents:

CSE 489: Digital Image CSE 489: Digital Image ProcessingProcessing

Topic – 7: Topic – 7: Image SegmentationImage Segmentation

1

Fall 2012Fall 2012

Page 2: Topic   7 (image segmentation)

Image SegmentationImage SegmentationImage segmentation is the process of dividing

an image into regions or objects. It is the first step in the task of image analysis. Image processing displays images and alters them to make them look "better", while image analysis tries to discover what is in the image.

2

Page 3: Topic   7 (image segmentation)

Histogram-Based SegmentationHistogram-Based SegmentationHistogram-based image segmentation is one of the

most simple and most often used segmentation techniques.

It uses the histogram to select the gray levels for grouping pixels into regions.

In a simple image there are two entities: the background and the object.

The background is generally one gray level and occupies most of the image.

Therefore, its gray level is a large peak in the histogram. The object or subject of the image is another gray level, and its gray level is another, smaller peak in the histogram.

3

Page 4: Topic   7 (image segmentation)

4

Page 5: Topic   7 (image segmentation)

5

Page 6: Topic   7 (image segmentation)

ThresholdingThresholding

We choose a threshold point in the valley between the two peaks and threshold the image.

Thresholding takes any pixel whose value is on the object side of the point and sets it to one; it sets all others to zero.

The histogram peaks and the valleys between them are the keys.

6

Page 7: Topic   7 (image segmentation)

7

Page 8: Topic   7 (image segmentation)

Thresholding and Region GrowingThresholding and Region Growing

The “object” in Figure 9.9 is a happy face. It comprises three different regions (two eyes and the smile). Region growing takes this image, groups the pixels in each separate region, and gives them unique labels. Figure 9.10 shows the result of region growing performed on Figure 9.9. Region growing grouped and labeled one eye as region 1, the other eye as region 2, and the smile as region 3.

8

Page 9: Topic   7 (image segmentation)

9

Page 10: Topic   7 (image segmentation)

Histogram-Based TechniquesHistogram-Based Techniques

The following pages present four segmentation techniques:

Manual technique Histogram peak technique Histogram valley technique Adaptive technique

10

Page 11: Topic   7 (image segmentation)

Manual TechniqueManual Technique

In the manual technique the user inspects an image and its histogram manually. Trial and error comes into play and the result is as good as you want it to be.

11

Page 12: Topic   7 (image segmentation)

12

Page 13: Topic   7 (image segmentation)

The purpose is to break the image into pieces so later computer processing can interpret their meaning. The output is for computer not human consumption. Also note how difficult it is for the computer, even with manual aid, to find objects that are trivial for humans to see. Anyone could trace over the input image and outline the objects better than the segmentation process.

13

Page 14: Topic   7 (image segmentation)

Histogram Peak TechniqueHistogram Peak Technique

The technique is to examine the histogram and select threshold values automatically using the peaks of the histogram.

This technique finds the two peaks in the histogram corresponding to the background and object of the image. It sets the threshold halfway between the two peaks.

Look at the smoothed histogram in Figure 9.8. The background peak is at two and the object peak is at seven. The midpoint is four, so the low threshold value is four and the high is nine.

14

Page 15: Topic   7 (image segmentation)

15

Histogram Peak TechniqueHistogram Peak Technique

Page 16: Topic   7 (image segmentation)

16

Histogram Peak TechniqueHistogram Peak Technique

Page 17: Topic   7 (image segmentation)

Histogram Valley TechniqueHistogram Valley TechniqueThe second automatic technique uses the peaks of

the histogram, but concentrates on the valleys between them.

Instead of setting the midpoint arbitrarily halfway between the two peaks, the valley technique searches between the two peaks to find the lowest valley.

17

Page 18: Topic   7 (image segmentation)

Histogram Valley TechniqueHistogram Valley TechniqueSuppose an image had the histogram shown in

Figure 9.17.Which peak corresponds to the background? The peak for gray level eight is the highest, but it

corresponds to the object not the background.The reason is the mountain surrounding the peak at

gray level two has a much greater area than that next to gray level eight. Therefore, gray levels zero through six occupy the vast majority of the image, and they are the background.

18

Page 19: Topic   7 (image segmentation)

19

Histogram Valley TechniqueHistogram Valley Technique

Page 20: Topic   7 (image segmentation)

Histogram Valley TechniqueHistogram Valley TechniqueLook back at the histogram of Figure 9.17. The

peaks are at gray levels two and eight and the

peaks technique would set the midpoint at five. In

contrast, the valley technique searches from two

through eight to find the lowest valley. In this case,

the “valley point” is at gray level seven.

20

Page 21: Topic   7 (image segmentation)

21

Histogram Valley TechniqueHistogram Valley Technique

Page 22: Topic   7 (image segmentation)

Adaptive Histogram Technique The final technique uses the peaks of the histogram in

a first pass and adapts itself to the objects found in the image in a second pass. In the first pass, the adaptive technique calculates the histogram for the entire image.

It smoothes the histogram and uses the peak technique to find the high and low threshold values.

In the second pass, the technique segments using the high and low values found during the first pass.

Then, it calculates the mean value for all the pixels segmented into background and object. It uses these means as new peaks and calculates new high and low threshold values.

Now, it segments that area - again using the new values.

22

Page 23: Topic   7 (image segmentation)

Figure 9.20 shows the result of applying the adaptive technique to the image of Figure 9.12. The first pass found the high-and low-threshold values to be 255 and 166. The second pass thresholded the image array and found the background mean to be 94 and the object mean to be 205. The new threshold values were 255 and 149.

23

Page 24: Topic   7 (image segmentation)

ConclusionConclusion

This lecture has introduced image segmentation. This is the first step in locating and labeling the contents of an image. The techniques discussed work on simple images with good contrast and gray level separation between the object and background. We will need additional techniques to attack more complex images.

24