34
DIGITAL IMAGE PROCESSING Instructors: Dr J. Shanbehzadeh [email protected] M.Yekke Zare Chapter 10 – Image Segmentation ( J.Shanbehzadeh M.Yekke Zare )

DIGITAL IMAGE PROCESSING

Embed Size (px)

DESCRIPTION

DIGITAL IMAGE PROCESSING. Chapter 10 – Image Segmentation. Instructors: Dr J. Shanbehzadeh [email protected] M.Yekke Zare. Road map of chapter 10. 10.5. 10.3. 10.3. 10.4. 10.1. 10.1. 10.2. 10.2. 10.4. 10.5. 10.6. 10.6. Point, Line and Edge Detection. Thresholding. - PowerPoint PPT Presentation

Citation preview

Page 1: DIGITAL IMAGE PROCESSING

DIGITAL IMAGE PROCESSING

Instructors:

Dr J. [email protected]

M.Yekke Zare

Chapter 10 – Image Segmentation

( J.Shanbehzadeh M.Yekke Zare )

Page 2: DIGITAL IMAGE PROCESSING

Point, Line and Edge DetectionThresholdingRegion-Based SegmentationSegmentation Using Morphological watershedsThe Use of Motion in SegmentationImage Smoothing Using Frequency Domain FiltersFundamentals

10.610.610.510.410.310.2 10.510.410.310.210.110.1

Road map of chapter 10

10.1- Fundamentals10.2- Point, Line and Edge Detection10.3- Thresholding10.4- Region-Based Segmentation 10.5 - Segmentation Using Morphological watersheds10.6- The Use of Motion in Segmentation

( J.Shanbehzadeh M.YekkeZare )

Page 3: DIGITAL IMAGE PROCESSING

Thresholding

( J.Shanbehzadeh M.Yekke Zare )

Page 4: DIGITAL IMAGE PROCESSING

Thresholding

Foundation

Basic Global Thresholding

Optimum Global Thresholding Using Otsu’s Method

Using Image Smoothing to improve Global Thresholding

Using Edges to improve Global thresholding

Multiple Thresholds

Variable Thresholding

Foundation10.1- Fundamentals

10.2- Point, Line and Edge Detection

10.3- Thresholding

10.4- Region-Based Segmentation 10.5 - Segmentation Using Morphological watersheds

10.6- The Use of Motion in Segmentation

Multivariable Thresholding

( J.Shanbehzadeh M.Yekke Zare )

Page 5: DIGITAL IMAGE PROCESSING

5

Thresholding

image with dark background and

a light object

image with dark background and two light objects

Foundation

10.1- Fundamentals

10.2- Point, Line and Edge Detection

10.3- Thresholding

10.4- Region-Based Segmentation 10.5 - Segmentation Using Morphological watersheds

10.6- The Use of Motion in Segmentation

( J.Shanbehzadeh M.Yekke Zare )

Page 6: DIGITAL IMAGE PROCESSING

6

Thresholding

a point (x,y) belongs to to an object class if T1 < f(x,y)

T2

to another object class if f(x,y) > T2

to background if f(x,y) T1

T depends on only f(x,y) : only on gray-level

values Global threshold both f(x,y) and p(x,y) : on gray-

level values and its neighbors Local

threshold

Foundation- Multilevel thresholding

10.1- Fundamentals

10.2- Point, Line and Edge Detection

10.3- Thresholding

10.4- Region-Based Segmentation 10.5 - Segmentation Using Morphological watersheds

10.6- The Use of Motion in Segmentation

( J.Shanbehzadeh M.Yekke Zare )

Page 7: DIGITAL IMAGE PROCESSING

7

Thresholding

f(x,y) = i(x,y) r(x,y)a). computer generated

reflectance functionb). histogram of reflectance functionc). computer generated illumination function (poor)d). product of a). and c).e). histogram of product image

easily use global thresholdingobject and background are separated

difficult to segment

Foundation-The Role of Illumination

( J.Shanbehzadeh M.Yekke Zare )

Page 8: DIGITAL IMAGE PROCESSING

Thresholding

Foundation

Basic Global Thresholding

Optimum Global Thresholding Using Otsu’s Method

Using Image Smoothing to improve Global Thresholding

Using Edges to improve Global thresholding

Multiple Thresholds

Variable Thresholding

Basic Global Thresholding

10.1- Fundamentals

10.2- Point, Line and Edge Detection

10.3- Thresholding

10.4- Region-Based Segmentation 10.5 - Segmentation Using Morphological watersheds

10.6- The Use of Motion in Segmentation

Multivariable Thresholding

( J.Shanbehzadeh M.Yekke Zare )

Page 9: DIGITAL IMAGE PROCESSING

9

ThresholdingBasic Global Thresholding

based on visual inspection of histogram

1. Select an initial estimate for T.2. Segment the image using T. This

will produce two groups of pixels: G1 consisting of all pixels with gray level values > T and G2 consisting of pixels with gray level values T

3. Compute the average gray level values 1 and 2 for the pixels in regions G1 and G2

4. Compute a new threshold value5. T = 0.5 (1 + 2)6. Repeat steps 2 through 4 until the

difference in T in successive iterations is smaller than a predefined parameter To.

10.1- Fundamentals

10.2- Point, Line and Edge Detection

10.3- Thresholding

10.4- Region-Based Segmentation 10.5 - Segmentation Using Morphological watersheds

10.6- The Use of Motion in Segmentation

( J.Shanbehzadeh M.Yekke Zare )

Page 10: DIGITAL IMAGE PROCESSING

10

10.1- Fundamentals

10.2- Point, Line and Edge Detection

10.3- Thresholding

10.4- Region-Based Segmentation 10.5 - Segmentation Using Morphological watersheds

10.6- The Use of Motion in Segmentation

ThresholdingBasic Global Thresholding-Example: Heuristic method

note: the clear valley of the histogram and the effective of the segmentation between object and background

T0 = 03 iterations with result T = 125

( J.Shanbehzadeh M.Yekke Zare )

Page 11: DIGITAL IMAGE PROCESSING

Thresholding

Foundation

Basic Global Thresholding

Optimum Global Thresholding Using Otsu’s Method

Using Image Smoothing to improve Global Thresholding

Using Edges to improve Global thresholding

Multiple Thresholds

Variable Thresholding

Optimum Global Thresholding Using Otsu’s Method

10.1- Fundamentals

10.2- Point, Line and Edge Detection

10.3- Thresholding

10.4- Region-Based Segmentation 10.5 - Segmentation Using Morphological watersheds

10.6- The Use of Motion in Segmentation

Multivariable Thresholding

( J.Shanbehzadeh M.Yekke Zare )

Page 12: DIGITAL IMAGE PROCESSING

12

ThresholdingOptimum Global Thresholding Using Otsu’s Method

Otsu’s Method

• Assumptions– It does not depend on modeling the

probability density functions.– It does assume a bimodal

histogram distribution

10.1- Fundamentals

10.2- Point, Line and Edge Detection

10.3- Thresholding

10.4- Region-Based Segmentation 10.5 - Segmentation Using Morphological watersheds

10.6- The Use of Motion in Segmentation

( J.Shanbehzadeh M.Yekke Zare )

Page 13: DIGITAL IMAGE PROCESSING

13

Thresholding

Optimum Global Thresholding Using Otsu’s Method

Otsu’s Method• Segmentation is based on “region

homogeneity”.• Region homogeneity can be

measured using variance (i.e., regions with high homogeneity will have low variance).

• Otsu’s method selects the threshold by minimizing the within-class variance.

10.1- Fundamentals

10.2- Point, Line and Edge Detection

10.3- Thresholding

10.4- Region-Based Segmentation 10.5 - Segmentation Using Morphological watersheds

10.6- The Use of Motion in Segmentation

( J.Shanbehzadeh M.Yekke Zare )

Page 14: DIGITAL IMAGE PROCESSING

14

ThresholdingOptimum Global Thresholding Using Otsu’s Method

Otsu’s Method (cont’d) Mean andVariance• Consider an image with L gray levels and its normalized histogram – P(i) is the normalized frequency of i.

• Assuming that we have set the threshold at T, the normalized fraction of pixels that will be classified as background and object will be:

Tbackground object

10.1- Fundamentals

10.2- Point, Line and Edge Detection

10.3- Thresholding

10.4- Region-Based Segmentation 10.5 - Segmentation Using Morphological watersheds

10.6- The Use of Motion in Segmentation

( J.Shanbehzadeh M.Yekke Zare )

Page 15: DIGITAL IMAGE PROCESSING

15

Thresholding

Optimum Global Thresholding Using Otsu’s Method

• The mean gray-level value of the background and the object pixels will be:

• The mean gray-level value over the whole image (“grand” mean) is:

10.1- Fundamentals

10.2- Point, Line and Edge Detection

10.3- Thresholding

10.4- Region-Based Segmentation 10.5 - Segmentation Using Morphological watersheds

10.6- The Use of Motion in Segmentation

( J.Shanbehzadeh M.Yekke Zare )

Page 16: DIGITAL IMAGE PROCESSING

16

The variance of the background and the object pixels will be:

The variance of the whole image is:

10.1- Fundamentals

10.2- Point, Line and Edge Detection

10.3- Thresholding

10.4- Region-Based Segmentation 10.5 - Segmentation Using Morphological watersheds

10.6- The Use of Motion in Segmentation

Thresholding

Optimum Global Thresholding Using Otsu’s Method

( J.Shanbehzadeh M.Yekke Zare )

Page 17: DIGITAL IMAGE PROCESSING

17

Otsu’s Method (cont’d) Within-class and between-class variance

It can be shown that the variance of the whole image can be written as follows:

within-class variance

between-class variance

should be minimized!

should be maximized!

Thresholding

Optimum Global Thresholding Using Otsu’s Method

10.1- Fundamentals

10.2- Point, Line and Edge Detection

10.3- Thresholding

10.4- Region-Based Segmentation 10.5 - Segmentation Using Morphological watersheds

10.6- The Use of Motion in Segmentation

( J.Shanbehzadeh M.Yekke Zare )

Page 18: DIGITAL IMAGE PROCESSING

18

ThresholdingOptimum Global Thresholding Using Otsu’s Method

Otsu’s Method (cont’d) Determining the threshold

Since the total variance does not depend on T, the T that minimizes will also maximize

Let us rewrite as follows:

Find the T value that maximizes

where

10.1- Fundamentals

10.2- Point, Line and Edge Detection

10.3- Thresholding

10.4- Region-Based Segmentation 10.5 - Segmentation Using Morphological watersheds

10.6- The Use of Motion in Segmentation

( J.Shanbehzadeh M.Yekke Zare )

Page 19: DIGITAL IMAGE PROCESSING

19

ThresholdingOptimum Global Thresholding Using Otsu’s Method

Otsu’s Method (cont’d) Determining the threshold• Start from the beginning of the histogram and test each gray- level value for the possibility of being the threshold T that maximizes

10.1- Fundamentals

10.2- Point, Line and Edge Detection

10.3- Thresholding

10.4- Region-Based Segmentation 10.5 - Segmentation Using Morphological watersheds

10.6- The Use of Motion in Segmentation

( J.Shanbehzadeh M.Yekke Zare )

Page 20: DIGITAL IMAGE PROCESSING

20

ThresholdingOptimum Global Thresholding Using Otsu’s Method

Otsu’s Method (cont’d)

Drawbacks of the Otsu’s method The method assumes that the histogram

of the image is bimodal (i.e., two classes). The method breaks down when the two

classes are very unequal (i.e., the classes have very different sizes) In this case, may have two maxima. The correct maximum is not necessary the

global one. The method does not work well with

variable illumination.

10.1- Fundamentals

10.2- Point, Line and Edge Detection

10.3- Thresholding

10.4- Region-Based Segmentation 10.5 - Segmentation Using Morphological watersheds

10.6- The Use of Motion in Segmentation

( J.Shanbehzadeh M.Yekke Zare )

Page 21: DIGITAL IMAGE PROCESSING

21

ThresholdingOptimum Global Thresholding Using Otsu’s Method

Otsu’s Method (cont’d)

10.1- Fundamentals

10.2- Point, Line and Edge Detection

10.3- Thresholding

10.4- Region-Based Segmentation 10.5 - Segmentation Using Morphological watersheds

10.6- The Use of Motion in Segmentation

( J.Shanbehzadeh M.Yekke Zare )

Page 22: DIGITAL IMAGE PROCESSING

Thresholding

Foundation

Basic Global Thresholding

Optimum Global Thresholding Using Otsu’s Method

Using Image Smoothing to improve Global Thresholding

Using Edges to improve Global thresholding

Multiple Thresholds

Variable Thresholding

Using Image Smoothing to improve Global Thresholding

10.1- Fundamentals

10.2- Point, Line and Edge Detection

10.3- Thresholding

10.4- Region-Based Segmentation 10.5 - Segmentation Using Morphological watersheds

10.6- The Use of Motion in Segmentation

Multivariable Thresholding

( J.Shanbehzadeh M.Yekke Zare )

Page 23: DIGITAL IMAGE PROCESSING

23

Thresholding

Using Image Smoothing to improve Global Thresholding

10.1- Fundamentals

10.2- Point, Line and Edge Detection

10.3- Thresholding

10.4- Region-Based Segmentation 10.5 - Segmentation Using Morphological watersheds

10.6- The Use of Motion in Segmentation

( J.Shanbehzadeh M.Yekke Zare )

Page 24: DIGITAL IMAGE PROCESSING

( J.Shanbehzadeh M.Gholizadeh )

Thresholding

Foundation

Basic Global Thresholding

Optimum Global Thresholding Using Otsu’s Method

Using Image Smoothing to improve Global Thresholding

Using Edges to improve Global thresholding

Multiple Thresholds

Variable Thresholding

Using Edges to improve Global thresholding

10.1- Fundamentals

10.2- Point, Line and Edge Detection

10.3- Thresholding

10.4- Region-Based Segmentation 10.5 - Segmentation Using Morphological watersheds

10.6- The Use of Motion in Segmentation

Multivariable Thresholding

Page 25: DIGITAL IMAGE PROCESSING

25

Thresholding

Using Edges to improve Global thresholding

10.1- Fundamentals

10.2- Point, Line and Edge Detection

10.3- Thresholding

10.4- Region-Based Segmentation 10.5 - Segmentation Using Morphological watersheds

10.6- The Use of Motion in Segmentation

( J.Shanbehzadeh M.Yekke Zare )

Page 26: DIGITAL IMAGE PROCESSING

26

Thresholding

Using Edges to improve Global thresholding

10.1- Fundamentals

10.2- Point, Line and Edge Detection

10.3- Thresholding

10.4- Region-Based Segmentation 10.5 - Segmentation Using Morphological watersheds

10.6- The Use of Motion in Segmentation

( J.Shanbehzadeh M.Yekke Zare )

Page 27: DIGITAL IMAGE PROCESSING

27

Thresholding

Using Edges to improve Global thresholding

10.1- Fundamentals

10.2- Point, Line and Edge Detection

10.3- Thresholding

10.4- Region-Based Segmentation 10.5 - Segmentation Using Morphological watersheds

10.6- The Use of Motion in Segmentation

( J.Shanbehzadeh M.Yekke Zare )

Page 28: DIGITAL IMAGE PROCESSING

28

Thresholding

Using Edges to improve Global thresholding

10.1- Fundamentals

10.2- Point, Line and Edge Detection

10.3- Thresholding

10.4- Region-Based Segmentation 10.5 - Segmentation Using Morphological watersheds

10.6- The Use of Motion in Segmentation

( J.Shanbehzadeh M.Yekke Zare )

Page 29: DIGITAL IMAGE PROCESSING

Thresholding

Foundation

Basic Global Thresholding

Optimum Global Thresholding Using Otsu’s Method

Using Image Smoothing to improve Global Thresholding

Using Edges to improve Global thresholding

Multiple Thresholds

Variable Thresholding

Multiple Thresholds

10.1- Fundamentals

10.2- Point, Line and Edge Detection

10.3- Thresholding

10.4- Region-Based Segmentation 10.5 - Segmentation Using Morphological watersheds

10.6- The Use of Motion in Segmentation

Multivariable Thresholding

( J.Shanbehzadeh M.Yekke Zare )

Page 30: DIGITAL IMAGE PROCESSING

30

Thresholding

Multiple Thresholds

• Otsu’s method can be extended to a

multiple multiple thresholding method thresholding method.• Between-class variance can be

reformulated as

10.1- Fundamentals

10.2- Point, Line and Edge Detection

10.3- Thresholding

10.4- Region-Based Segmentation 10.5 - Segmentation Using Morphological watersheds

10.6- The Use of Motion in Segmentation

( J.Shanbehzadeh M.Yekke Zare )

Page 31: DIGITAL IMAGE PROCESSING

31

Thresholding

Multiple Thresholds

The K classes are separated by K-1 thresholds and these optimal thresholds can be solved by maximizing

For example (two thresholds)

10.1- Fundamentals

10.2- Point, Line and Edge Detection

10.3- Thresholding

10.4- Region-Based Segmentation 10.5 - Segmentation Using Morphological watersheds

10.6- The Use of Motion in Segmentation

( J.Shanbehzadeh M.Yekke Zare )

Page 32: DIGITAL IMAGE PROCESSING

32

Thresholding

Multiple Thresholds

The following relationships hold:

The optimum thresholds can be found by :

The image is then segmented by

10.1- Fundamentals

10.2- Point, Line and Edge Detection

10.3- Thresholding

10.4- Region-Based Segmentation 10.5 - Segmentation Using Morphological watersheds

10.6- The Use of Motion in Segmentation

( J.Shanbehzadeh M.Yekke Zare )

Page 33: DIGITAL IMAGE PROCESSING

33

Thresholding

Multiple Thresholds

10.1- Fundamentals

10.2- Point, Line and Edge Detection

10.3- Thresholding

10.4- Region-Based Segmentation 10.5 - Segmentation Using Morphological watersheds

10.6- The Use of Motion in Segmentation

( J.Shanbehzadeh M.Yekke Zare )

Page 34: DIGITAL IMAGE PROCESSING

Thresholding

Foundation

Basic Global Thresholding

Optimum Global Thresholding Using Otsu’s Method

Using Image Smoothing to improve Global Thresholding

Using Edges to improve Global thresholding

Multiple Thresholds

Variable ThresholdingVariable Thresholding

10.1- Fundamentals

10.2- Point, Line and Edge Detection

10.3- Thresholding

10.4- Region-Based Segmentation 10.5 - Segmentation Using Morphological watersheds

10.6- The Use of Motion in Segmentation

Multivariable Thresholding

( J.Shanbehzadeh M.Yekke Zare )