DIGITAL IMAGE PROCESSING Chapter 10 Image Segmentation Instructor

  • Slides: 34
Download presentation
DIGITAL IMAGE PROCESSING Chapter 10 – Image Segmentation Instructor: Harikanth Pasinibilli mr. harikanth@gmail. com

DIGITAL IMAGE PROCESSING Chapter 10 – Image Segmentation Instructor: Harikanth Pasinibilli mr. harikanth@gmail. com harikanth@gvpcew. ac. in

Road map of chapter 10 10. 1 10. 2 10. 3 10. 4 Point,

Road map of chapter 10 10. 1 10. 2 10. 3 10. 4 Point, Line and Edge Segmentation Using The Image Use Smoothing of Motion Using in Thresholding Region-Based Segmentation Fundamentals Detection Domain Morphological watersheds Segmentation Frequency Filters (P. Harikanth) 10. 5 10. 6 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 (P. Harikanth)

Thresholding (P. Harikanth)

Thresholding 10. 1 - Fundamentals Foundation 10. 2 - Point, Line and Edge Detection

Thresholding 10. 1 - Fundamentals Foundation 10. 2 - Point, Line and Edge Detection Basic Global Thresholding 10. 3 - Thresholding Optimum Global Thresholding Using Otsu’s Method 10. 4 - Region-Based Segmentation 10. 5 - Segmentation Using Morphological watersheds 10. 6 - The Use of Motion in Segmentation Using Image Smoothing to improve Global Thresholding Using Edges to improve Global thresholding Multiple Thresholds Variable Thresholding Multivariable Thresholding (P. Harikanth)

Thresholding 5 Foundation 10. 1 - Fundamentals 10. 2 - Point, Line and Edge

Thresholding 5 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 (P. Harikanth) image with dark background a light object image with dark background and two light objects

Thresholding Foundation- Multilevel thresholding a point (x, y) belongs to 10. 1 - Fundamentals

Thresholding Foundation- Multilevel thresholding a point (x, y) belongs 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 (P. Harikanth) 6 to an object class if T 1 < f(x, y) T 2 to another object class if f(x, y) > T 2 to background if f(x, y) T 1 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

Thresholding Foundation-The Role of Illumination easily use global thresholding object and background are separated

Thresholding Foundation-The Role of Illumination easily use global thresholding object and background are separated f(x, y) = i(x, y) r(x, y) a). computer generated reflectance function b). histogram of reflectance function c). computer generated illumination function (poor) d). product of a). and c). e). histogram of product image difficult to segment (P. Harikanth) 7

Thresholding 10. 1 - Fundamentals Foundation 10. 2 - Point, Line and Edge Detection

Thresholding 10. 1 - Fundamentals Foundation 10. 2 - Point, Line and Edge Detection Basic Global Thresholding 10. 3 - Thresholding Optimum Global Thresholding Using Otsu’s Method 10. 4 - Region-Based Segmentation 10. 5 - Segmentation Using Morphological watersheds 10. 6 - The Use of Motion in Segmentation Using Image Smoothing to improve Global Thresholding Using Edges to improve Global thresholding Multiple Thresholds Variable Thresholding Multivariable Thresholding (P. Harikanth)

Thresholding Basic Global Thresholding 10. 1 - Fundamentals 10. 2 - Point, Line and

Thresholding Basic Global Thresholding 10. 1 - Fundamentals 10. 2 - Point, Line and Edge Detection 1. 2. 10. 3 - Thresholding 10. 4 - Region-Based Segmentation 10. 5 - Segmentation Using Morphological watersheds 10. 6 - The Use of Motion in Segmentation 3. 4. 5. 6. (P. Harikanth) 9 based on visual inspection of histogram Select an initial estimate for T. Segment the image using T. This will produce two groups of pixels: G 1 consisting of all pixels with gray level values > T and G 2 consisting of pixels with gray level values T Compute the average gray level values 1 and 2 for the pixels in regions G 1 and G 2 Compute a new threshold value T = 0. 5 ( 1 + 2) Repeat steps 2 through 4 until the difference in T in successive iterations is smaller than a predefined parameter To.

Thresholding Basic Global Thresholding-Example: Heuristic method note: the clear valley of the histogram and

Thresholding Basic Global Thresholding-Example: Heuristic method note: the clear valley of the histogram and the effective of the segmentation between object and background 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 T 0 = 0 3 iterations with result T = 125 (P. Harikanth) 10

Thresholding 10. 1 - Fundamentals 11 Foundation 10. 2 - Point, Line and Edge

Thresholding 10. 1 - Fundamentals 11 Foundation 10. 2 - Point, Line and Edge Detection Basic Global Thresholding 10. 3 - Thresholding Optimum Global Thresholding Using Otsu’s Method 10. 4 - Region-Based Segmentation 10. 5 - Segmentation Using Morphological watersheds Using Image Smoothing to improve Global Thresholding Using Edges to improve Global thresholding 10. 6 - The Use of Motion in Segmentation Multiple Thresholds Variable Thresholding Multivariable Thresholding (P. Harikanth)

Thresholding Optimum Global Thresholding Using Otsu’s Method 12 Otsu’s Method 10. 1 - Fundamentals

Thresholding Optimum Global Thresholding Using Otsu’s Method 12 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 (P. Harikanth) • Assumptions – It does not depend on modeling the probability density functions. – It does assume a bimodal histogram distribution

Thresholding Optimum Global Thresholding Using Otsu’s Method 10. 1 - Fundamentals 10. 2 -

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 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). 10. 5 - Segmentation Using Morphological watersheds 10. 6 - The Use of Motion in Segmentation (P. Harikanth) • Otsu’s method selects the threshold by minimizing the within-class variance. 13

Thresholding 14 Optimum Global Thresholding Using Otsu’s Method (cont’d) Mean and. Variance 10. 1

Thresholding 14 Optimum Global Thresholding Using Otsu’s Method (cont’d) Mean and. 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 (P. Harikanth) • 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: background T object

Thresholding Optimum Global Thresholding Using Otsu’s Method 10. 1 - Fundamentals 10. 2 -

Thresholding Optimum Global Thresholding Using Otsu’s Method 10. 1 - Fundamentals 10. 2 - Point, Line and Edge Detection 15 • The mean gray-level value of the background and the object pixels will be: 10. 3 - Thresholding 10. 4 - Region-Based Segmentation 10. 5 - Segmentation Using Morphological watersheds 10. 6 - The Use of Motion in Segmentation (P. Harikanth) • The mean gray-level value over the whole image (“grand” mean) is:

Thresholding Optimum Global Thresholding Using Otsu’s Method 10. 1 - Fundamentals 10. 2 -

Thresholding Optimum Global Thresholding Using Otsu’s Method 10. 1 - Fundamentals 10. 2 - Point, Line and Edge Detection The variance of the background and the object pixels will be: 10. 3 - Thresholding 10. 4 - Region-Based Segmentation 10. 5 - Segmentation Using Morphological watersheds 10. 6 - The Use of Motion in Segmentation (P. Harikanth) 16 The variance of the whole image is:

Thresholding Optimum Global Thresholding Using Otsu’s Method 17 Otsu’s Method (cont’d) Within-class and between-class

Thresholding Optimum Global Thresholding Using Otsu’s Method 17 Otsu’s Method (cont’d) Within-class and between-class variance 10. 1 - Fundamentals 10. 2 - Point, Line and Edge Detection 10. 3 - Thresholding It can be shown that the variance of the whole image can be written as follows: 10. 4 - Region-Based Segmentation 10. 5 - Segmentation Using Morphological watersheds 10. 6 - The Use of Motion in Segmentation within-class variance between-class variance (P. Harikanth) should be minimized! should be maximized!

Thresholding Optimum Global Thresholding Using Otsu’s Method 10. 1 - Fundamentals Otsu’s Method (cont’d)

Thresholding Optimum Global Thresholding Using Otsu’s Method 10. 1 - Fundamentals Otsu’s Method (cont’d) Determining the threshold 10. 2 - Point, Line and Edge Detection 10. 3 - Thresholding Since the total variance does not depend on T, the T that minimizes will also maximize Let us rewrite as follows: 10. 4 - Region-Based Segmentation 10. 5 - Segmentation Using Morphological watersheds where 10. 6 - The Use of Motion in Segmentation (P. Harikanth) 18 Find the T value that maximizes

Thresholding Optimum Global Thresholding Using Otsu’s Method 19 Otsu’s Method (cont’d) Determining the threshold

Thresholding Optimum Global Thresholding Using Otsu’s Method 19 Otsu’s Method (cont’d) Determining the threshold 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 (P. Harikanth) • Start from the beginning of the histogram and test each gray- level value for the possibility of being the threshold T that maximizes

Thresholding Optimum Global Thresholding Using Otsu’s Method 20 Otsu’s Method (cont’d) 10. 1 -

Thresholding Optimum Global Thresholding Using Otsu’s Method 20 Otsu’s Method (cont’d) 10. 1 - Fundamentals 10. 2 - Point, Line and Edge Detection Drawbacks of the Otsu’s method � 10. 3 - Thresholding � 10. 4 - Region-Based Segmentation 10. 5 - Segmentation Using Morphological watersheds 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) 10. 6 - The Use of Motion in Segmentation � (P. Harikanth) 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.

Thresholding Optimum Global Thresholding Using Otsu’s Method 10. 1 - Fundamentals 10. 2 -

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 (P. Harikanth) Otsu’s Method (cont’d) 21

Thresholding 10. 1 - Fundamentals Foundation 10. 2 - Point, Line and Edge Detection

Thresholding 10. 1 - Fundamentals Foundation 10. 2 - Point, Line and Edge Detection Basic Global Thresholding 10. 3 - Thresholding Optimum Global Thresholding Using Otsu’s Method 10. 4 - Region-Based Segmentation 10. 5 - Segmentation Using Morphological watersheds 10. 6 - The Use of Motion in Segmentation Using Image Smoothing to improve Global Thresholding Using Edges to improve Global thresholding Multiple Thresholds Variable Thresholding Multivariable Thresholding (P. Harikanth)

Thresholding Using Image Smoothing to improve Global Thresholding 10. 1 - Fundamentals 10. 2

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 (P. Harikanth) 23

Thresholding 10. 1 - Fundamentals Foundation 10. 2 - Point, Line and Edge Detection

Thresholding 10. 1 - Fundamentals Foundation 10. 2 - Point, Line and Edge Detection Basic Global Thresholding 10. 3 - Thresholding Optimum Global Thresholding Using Otsu’s Method 10. 4 - Region-Based Segmentation 10. 5 - Segmentation Using Morphological watersheds Using Image Smoothing to improve Global Thresholding Using Edges to improve Global thresholding 10. 6 - The Use of Motion in Segmentation Multiple Thresholds Variable Thresholding Multivariable Thresholding (P. Harikanth)

Thresholding Using Edges to improve Global thresholding 10. 1 - Fundamentals 10. 2 -

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 (P. Harikanth) 25

Thresholding Using Edges to improve Global thresholding 10. 1 - Fundamentals 10. 2 -

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 (P. Harikanth) 26

Thresholding Using Edges to improve Global thresholding 10. 1 - Fundamentals 10. 2 -

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 (P. Harikanth) 27

Thresholding Using Edges to improve Global thresholding 10. 1 - Fundamentals 10. 2 -

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 (P. Harikanth) 28

Thresholding 10. 1 - Fundamentals Foundation 10. 2 - Point, Line and Edge Detection

Thresholding 10. 1 - Fundamentals Foundation 10. 2 - Point, Line and Edge Detection Basic Global Thresholding 10. 3 - Thresholding Optimum Global Thresholding Using Otsu’s Method 10. 4 - Region-Based Segmentation 10. 5 - Segmentation Using Morphological watersheds 10. 6 - The Use of Motion in Segmentation Using Image Smoothing to improve Global Thresholding Using Edges to improve Global thresholding Multiple Thresholds Multiple Variable Thresholding Multivariable Thresholding (P. Harikanth)

Thresholding Multiple Thresholds 10. 1 - Fundamentals 10. 2 - Point, Line and Edge

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 (P. Harikanth) 30 • Otsu’s method can be extended to a multiple thresholding method between-class variance can be reformulated as

Thresholding Multiple Thresholds 10. 1 - Fundamentals 10. 2 - Point, Line and Edge

Thresholding Multiple Thresholds 10. 1 - Fundamentals 10. 2 - Point, Line and Edge Detection The K classes are separated by K-1 thresholds and these optimal thresholds can be solved by maximizing 10. 3 - Thresholding 10. 4 - Region-Based Segmentation 10. 5 - Segmentation Using Morphological watersheds 10. 6 - The Use of Motion in Segmentation (P. Harikanth) For example (two thresholds) 31

Thresholding Multiple Thresholds 10. 1 - Fundamentals 32 The following relationships hold: 10. 2

Thresholding Multiple Thresholds 10. 1 - Fundamentals 32 The following relationships hold: 10. 2 - Point, Line and Edge Detection 10. 3 - Thresholding The optimum thresholds can be found by : 10. 4 - Region-Based Segmentation 10. 5 - Segmentation Using Morphological watersheds 10. 6 - The Use of Motion in Segmentation (P. Harikanth) The image is then segmented by

Thresholding Multiple Thresholds 10. 1 - Fundamentals 10. 2 - Point, Line and Edge

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 (P. Harikanth) 33

Thresholding 10. 1 - Fundamentals 34 Foundation 10. 2 - Point, Line and Edge

Thresholding 10. 1 - Fundamentals 34 Foundation 10. 2 - Point, Line and Edge Detection Basic Global Thresholding 10. 3 - Thresholding Optimum Global Thresholding Using Otsu’s Method 10. 4 - Region-Based Segmentation 10. 5 - Segmentation Using Morphological watersheds Using Image Smoothing to improve Global Thresholding Using Edges to improve Global thresholding 10. 6 - The Use of Motion in Segmentation Multiple Thresholds Variable Thresholding Multivariable Thresholding (P. Harikanth)