Image Segmentation! Thresholding Watershed Seminar Computa9onal Intelligence
Outline! Thresholding What is thresholding? How can we find a threshold value? Variable thresholding Local thresholding 2
Outline! Watersheds Basic concept/idea Drawback 3
What is Thresholding?! Par99on image direct into regions The simplest approach to segment an image g( x, y) = 1 0 if if f f ( x, ( x, y) y) > T T 4
Basic concept: Thresholding! Based on the histogram of an image we use a threshold to par99one the image histogram 5
Thresholding! 6
es9mate How to finde the threshold?! Automa9c Thresholding 7
How to calculate the threshold?! The basic global threshold T, is calculated as follows: 1. Select an ini9al es9mate for T ( e.g. the average grey level in the image) 2. Segment the image using T to produce two groups of pixels: G 1 consis9ng of pixels with grey levels >T and G 2 consis9ng pixels with grey levels T 3. Compute the average grey levels of pixels in G 1 to get μ 1 and G 2 to get μ 2 8
How to calculate the threshold?! 4. Compute a new threshold value µ + µ 1 T = 2 2 5. Repeat steps 2 4 un9l the difference in T in successive itera9ons is less than a predefined limit T Works very well for finding thresholds when the histogram is suitable 9
Thresholding! 10
Otsu s method! A measure of region homogeneity is variance (regions with high homogeneity will have low variance) We select the threshold by minimizing the within-class variance of the two groups of pixels separated by the thresholding operator It does not depend on modeling the probability density functions, however, it assumes a bimodal distribution of graylevel values 11
Example! Since the total variance σ does not depend on T, the T minimizing σ W 2 will be the T maximizing σ B 2 σ B 2 12
Otsu s method! Since the total variance σ does not depend on T, the T minimizing σ W 2 will be the T maximizing σ B 2 We start from the beginning of the histogram and test each gray-level value for the possibility of being the threshold T that maximizes σ B 2 13
Drawbacks of Otsu s method! The method assumes that the histogram of the image is bimodal (two classes) The method don t work when the two classes are very unequal In this case, σ B 2 may have two maxima. The correct maximum is not necessary the global one. The selected threshold should correspond to a valley of the histogram The method does not work well with variable illumination. 14
Preprocessing! Preprocessing (f.e. smoothing) the image to remove noise or other non- uniformi9es can improve the performance of the thresholding 15
Image smoothing! Try to get rid of lots of the finer detail by smoothing the orginal picture Original Image Smoothed Image Thresholded Image 16
Single Value Thresholding and Illumination! 17
Variable Thresholding! An approach to handling the situa9ons in which single value thresholding will not work is to divide an image into small images and threshold these individually 18
Variable Thresholding! It might lead to subimages with simpler histogram 19
Multiple Thresholds! Single value thresholding only works for bimodal histograms. Images with other kinds of histograms need more than a single threshold But it is less reliable than a single variable threshold. This is because it oben difficult to establish mul9ple thresholds to effec9vely isolate the region of interest 20
Local Thresholding! Source: hdp://homepages.inf.ed.ac.uk/ rbf/hipr2/adpthrsh.htm 21
Local Thresholding! select an individual threshold for each pixes based on the range of the intensity values in it s local neighborhood T = xy a*σ + b*µ xy xy 22
Drawbacks! Threshold selec9on is not always easy Noise, illumina9on, reflectance.. Based on a simple assamp9on The success of this technique very strongly depends on how well the histogram can be saperated 23
Morphological Watersheds! Embodies many of the concept of the other segmenta9on approaches and oben produce more stable segmenta9on Based on the visualizning of an image in 3 dimens9on (spatal cordinate versus intensity) the principal concept is to find watersheds lines 24
The height of the mountains is proportional to the grey scale value of the original image A hole is punched in each regional minimum The topography is flooded from below gradually Basic Steps! 25
A dam is build to prevent the water to swap over Only the tops of the dam are visble These dam correspond to the divide lines of the watersheds Basic Steps! 26
Oversegmentation! a: Orginal b: Gradient image of image a c: Watershed lines (oversegmenta9on) è Each connected region contains one local minimum in the corresponding gradient image d: Watershed lines obtained from smoothed image b 27
Markers! Another Part of the problem led to the oversegmented result is the large number of poten9al minima Use marker, star9ng point for flooding to prevent oversgmen9on 28
Summary! Produces sufficient results Oversegmenta9on is a problem even with marker But can be used as a good approach for pre- segmenta9on 29