Download presentation
Presentation is loading. Please wait.
1
IMAGE SEGMENTATION USING THRESHOLDING
Guided by: Dr. J.N Sarvaiya BHAVIN GAMIT(P12EC012) PRATIK DAVE (P12EC022) VIRANG PATEL(P12EC023)
2
Outline Introduction Global Thresholding Object Optimal Thresholding
Optimum Thresholding (Otsu’s Method) Local Thresholding using Moving Averages Applications Conclusion
3
What is Image thresholding ?
Thresholding is a technique for partitioning image directly into region based on intensity value and/or property of these value Because of intuitive property , Simplicity of implementation Computational speed Image thresholding enjoys central place in image segmentation
4
Intensity histogram that can be partitioned
(a) By a single threshold and ( b)by dual threshold
5
Thresholding - Foundation
Suppose that the gray-level histogram corresponds to an image, f(x,y), composed of dark objects in a light background, in such a way that object and background pixels have gray levels grouped into two dominant modes. One obvious way to extract the objects from the background is to select a threshold ‘T’ that separates these modes. Then any point (x,y) for which f(x,y) > T is called an object point, otherwise, the point is called a background point.
6
Foundation (contd.) In such a case the histogram has to be partitioned by multiple thresholds. Multilevel thresholding classifies a point (x,y) as belonging to one object class if T1 < (x,y) <= T2, to the other object class if f(x,y) > T2 and to the background if f(x,y) <= T1.
7
Foundation (contd.) Segmentation is accomplished by scanning the image pixel by pixel and labeling each pixel as object or background, depending on whether the grey level is greater or less than the value of T . Thresholding works well when a grey level histogram of the image groups separates the pixels of the object and the background into two dominant modes. Then a threshold T can be easily chosen between the modes.
8
Basic Global and Local Thresholding
Thresholding may be viewed as an operation that involves tests against a function T of the form: T = T[x , y , p(x , y) , f(x , y)] Where f(x , y) is the gray level , and p(x , y) is some local property. Simple thresholding schemes compare each pixels gray level with a single global threshold. This is referred to as Global Thresholding . If T depends on both f(x , y) and p(x , y) then this is referred to a Local Thresholding .
9
Basic Global Thresholding
Select an initial estimate for T. Segment the image using T. This well produce two groups of pixels: G1 consisting of all pixels with gray level values>T and G2 consisting of pixels with values <T. Compute the average gray level values 1 and 2 for the pixels in regions G1 and G2. Compute a new threshold value: T = ½ [1 + 2 ] Repeat step 2 through 4 until the difference in T in successive iterations is smaller than a predefined parameter , To.
10
Simulation result Fig (b ) a distint valley
11
Object Optimal Thresholding
To minimize the average error in two or more over-lapped pixel groups
12
Object Optimal Thresholding (contd.)
Aim: Select T, that minimizes the average error in decision. PDF of gray level of entire image: p(z) = P1p1(z) + P2p2(z) where, P1 & P2 are pixel probabilities of background & foreground, respectively. p1(z) & p2(z) being their PDFs
13
Object Optimal Thresholding (contd.)
Error probability in classifying background as object : Error probability in classifying object as background : Overall probability of error:
14
Object Optimal Thresholding (contd.)
Threshold value for which the error is minimal: Gaussian PDF is: Optimal threshold:
15
Optimum Thresholding: Otsu’s Method
Based on a very simple idea: Find the threshold that minimizes the weighted within-class variance. This turns out to be the same as maximizing the between-class variance. Operates directly on the gray level histogram [e.g. 256 numbers, P(i)], so it’s fast (once the histogram is computed).
16
Otsu Method: Assumptions
Histogram (and the image) are bimodal. Assumes uniform illumination (implicitly), so the bimodal brightness behavior arises from object appearance differences only.
17
Otsu Method (contd.) The weighted within-class variance is:
Where the class probabilities are estimated as: And the class means are given by:
18
Otsu Method (contd.) The individual class variances are:
Total Variance is: Within-class, from before Between-class
19
Example: 6-level Gray scale Image Result:-
Otsu Method (contd.) Example: 6-level Gray scale Image Result:- Threshold T = 0 T = 1 T = 2 T = 3 T = 4 T = 5 3.1196 1.5268 0.5561 0.4909 0.9779 2.2491 1.5928 2.5635 2.6278 2.1417 0.8705
20
Variable Thresholding On Local Image Property
Compute a threshold at every point (x,y) in the image based on specified local property of neighbourhood of (x,y) . The basic approach to local thresholding using standard deviation and mean of the pixel in a neighbourhood of every point in the image Standard deviation = local contrast Mean= average intensity. Local threshold Txy = a σxy + b mxy The segmented image computed as 1 if f(x,y )>Txy g(x,y) = 0 if f(x,y )≤Txy
21
Local Thresholding using Moving Averages
Special case of local thresholding method. Computing a moving average along scan lines of an image. Scanning carried out line by line in zigzag pattern to reduce illumination bias.
22
Local Thresholding using Moving Averages (contd.)
Let Zk+1 intensity of the point at step k+1 in the scanning sequence. The moving average(mean) at this point is given by =m(k)+1/n(zk+1-zk-n) n= number of points used in computing the average m(1)=z1/n. This algorithm is intialized only once not at every row, because moving average is computed for every point in the image.
23
Local Thresholding using Moving Averages (contd.)
Segmentation is implemented using 1 if f(x,y )>Txy g(x,y) = 0 if f(x,y )≤Txy with Txy=bmxy where b is constant and mxy is the moving average from eq. at point (x,y ) in the input image
24
Local Thresholding using Moving Averages (contd.)
Let n=5 times the average stroke width . In this case, average pixel width = 4, hence n=20 and b= 0.5
25
Local Thresholding using Moving Averages (contd.)
Thresholding based on moving averages works well when the objects of interest are small with respect to the image size. Example- Images of typed or handwritten text.
26
Applications of Thresholding
Analyze and recognize fingerprints During the process of recovering/analyzing/recognizing photographed or scanned letters Reduce amount of information (e.g. for image transfer, or content recognition) Real-time adaptive thresholding (e.g. face detection) Traffic control and wireless mesh networks Motion detection using dynamic thresholding Background subtraction (e.g. real-time subtraction for biometric face detection)
27
Conclusion Global thresholding: Suitable only when object & background class are distinctive. Optimal Thresholding using Otsu’s method: Requires maximizing the between class variance between the object & background class. Otsu’s method fails due to improper illumination on the image. Local thresholding using moving average is suitable for thresholding the hand written text images
28
Thank You
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.