# Lecture 5 Automatic Thresholding. 2 Edge Detection Methods  Separate Background vs. Foreground Gaussian Noise  noisy signal  Most automatic thresholding.

## Presentation on theme: "Lecture 5 Automatic Thresholding. 2 Edge Detection Methods  Separate Background vs. Foreground Gaussian Noise  noisy signal  Most automatic thresholding."— Presentation transcript:

Lecture 5 Automatic Thresholding

2 Edge Detection Methods  Separate Background vs. Foreground Gaussian Noise  noisy signal  Most automatic thresholding algorithms rely on a measurement of “peak” and “valley”

3 Mode Method Algorithm: 1. Find 2 highest local maximum in histogram that are at some minimum distance apart. Suppose these occur at gray values g i,g j 2. Find the lowest point g k between g i,g j 3. Peakiness P = min(H(g i ),H(g j ))/H(g k ) How big is peak? 4. Look at each P l (g i,g j,g k ) l = 1,2,3,…., M. Choose P l that is Maximum Theshold = g k - valley

4 Mode Method Many Objects m objects, m+1 peaks 2 objects, 3 peaks

5 P-Tile Method For example: area the mouse occupies is fixed = 20% 100

6 P-Tile Method Add the heights until get 20% Area = 100 x 100 pixel 2 = 10000 pixel 2 20% = 2000 pixels Only in industry, controlled environment

7 Iterative Threshold Selection Algorithm 3.2: 1. Select an initial estimate of threshold T T = Av. Image Intensity 2. Use T to partition image into R 1, R 2 3. Calculate mean I :     for R 1, R 2 4. New T = 1/2 (     ) 5. Repeat 2-4 until     do not change

8 An example of an image with uneven illumination which is not amenable to regular thresholding Original Image Histogram if OriginalSimulated uneven illumination Box with uneven illuminationHistogram of box with uneven illumination Box thresholded at approximate Valley of histogram, T=72

9 Adaptive Thresholding Separate image into smaller regions & threshold each region independently

10 Based on Second Difference Separate image into smaller regions & threshold each region independently Original image 3-D plot of originalHistogram of Original Thresholded origial, T=85 Approximated planar function Thresholded origial, T=165 Plot of Different between Original and fitted plane Normalized imageHistrogram of normalized image Threshold result, T=110

11 Thinning

12 Thinning - Requirement 1. Connected regions must remain connected “no-break” should not be

13 Thinning - Requirement 2. Minimally 8-connected - “line” 3. Endline location maintained should not be

14 Thinning - Requirement 4. Result should approximate media lines skeleton 5. Extraneous Branches - minimum

15 Medial Axis Transform Example of the medial axis transform

16 Medial Axis Transform Example of the medial axis transform on a noisy image

17 Expanding and Shrinking

18 Expanding and Shrinking Preprocessing - whatever you do to get rid of noise

19 Last year quiz  To find equation of line- use all data & best fit AB = C B = [A T A] -1 A T C A T A B = A T C y i = mx i + b

20 Last year quiz I(x,y) = c 1 x 2 + c 2 x + c 3 xy + c 4 y + c 5 y 2 + c 6 AC = I C = [A T A] -1 A T I A T A C = A T I (x,y) (0,0) (-1,-1) (-1,0) (-1,1) (-1,0) (1,-1) (x+1,y) - (1,0) (1,-1) Given I(x,y) - 9 values I(0,0) = C 6 I(1,0) = C 1 +C 2 +C 6

21 Rubber Sheet Inspection

22

23 Paper Inspection

24 min error regression -sensitive to noise

25 Hough Technique for Line Detection y = m 2 x + b 2 y = m 1 x + b 1 y i = mx i + b known unknown

26 Hough Technique for Line Detection b = -10 … 10 m = -2 … 2 y = mx + b 1 = 1m + b 2 = 2m + b 3 = 3m + b 4 = 4m + b Given x i,y i Voting Algorithm b m

Download ppt "Lecture 5 Automatic Thresholding. 2 Edge Detection Methods  Separate Background vs. Foreground Gaussian Noise  noisy signal  Most automatic thresholding."

Similar presentations