What is Image Segmentation? Image Segmentation Methods Thresholding Boundary-based
CS654: Digital Image Analysis Lecture 26: Image segmentation.
-
Upload
asher-garrett -
Category
Documents
-
view
244 -
download
0
Transcript of CS654: Digital Image Analysis Lecture 26: Image segmentation.
CS654: Digital Image Analysis
Lecture 26: Image segmentation
Recap of Lecture 25
• Line detection
• Least square, RANSAC
• Hough space/ parametric space
• Voting
• Circle detection
• GHT
Outline of Lecture 26
• Thresholding
• Otsu’s method
• Region based segmentation
• Region growing
• Split and Merge
Introduction
• Detected boundaries between regions
• Pixel distribution was not exploited
• Can the regions be segmented directly?
• How to exploit the top-down/ bottom-up cues?
• Threshold
• Region-based segmentation
Thresholding
𝑔 (𝑥 , 𝑦 )={1 𝐼𝑓 𝑓 (𝑥 , 𝑦 )>𝑇0 𝐼𝑓 𝑓 (𝑥 , 𝑦 )≤𝑇 𝑔 (𝑥 , 𝑦 )={ 𝒂 ; 𝐼𝑓 𝑓 (𝑥 , 𝑦 )>𝑇2
𝒃 ; 𝐼𝑓 𝑇1< 𝑓 (𝑥 , 𝑦 )≤𝑇 2
𝒄 ; 𝐼𝑓 𝑓 (𝑥 , 𝑦 )≤𝑇 1
Global thresholding, local thresholding, adaptive thresholding
Multiple thresholding
Key factors
• Separation between peaks
• The noise content in the
image
• The relative size of the object
and the background
• Uniformity of the illumination
source
• Uniformity of the reflectance
property of the imageAutomatic threshold selection
Iterative threshold selection
1. Select an initial estimate of the threshold . A good initial value is the average intensity of the image
2. Calculate the mean grey values and of the partitions,
3. Partition the image into two groups, , using the threshold
4. Select a new threshold:
5. Repeat steps 2-4 until the mean values and in successive iterations do not change.
𝑇=12
(𝜇1+𝜇2 )
Optimal thresholding
Definition: Methods based on approximation of the histogram of an image using a weighted sum of two or more probability densities with normal distribution.
Example
Input image Histogram Segmented image
Otsu’s Image Segmentation Algorithm
• Find the threshold that minimizes the weighted within-class variance.
• Equivalent to: maximizing the between-class variance.
• Operates directly on the gray level histogram [e.g. 256 numbers, P(i)]
• It is fast (once the histogram is computed).
Otsu: Assumptions
• Histogram (and the image) are bimodal.
• No use of spatial coherence, nor any other notion of object structure.
• Assumes stationary statistics, but can be modified to be locally adaptive
• Assumes uniform illumination (implicitly), so the bimodal brightness behavior arises from object appearance differences only.
The weighted within-class variance is:
w2 (t) q1(t)1
2 (t) q2 (t) 22(t)
Where the class probabilities are estimated as:
q1(t) P(i)i1
t
L
ti
iPtq1
2 )()(
t
i
iiPtq
t11
1 )()(
1)(
L
ti
iiPtq
t12
2 )()(
1)(
And the class means are given by:
Otsu’s method: Formulation
Finally, the individual class variances are:
12(t) [i 1(t)]
2 P(i)
q1(t)i1
t
L
ti tq
iPtit
1 2
22
22 )(
)()]([)(
Run through the full range of t values and pick the value that minimizes
Is this algorithm first enough?
w2 (t)
Otsu’s method: Formulation
w2 (t) q1(t)1
2 (t) q2 (t) 22(t)
Between/ Within/ Total Variance
• The total variance does not depend on threshold (obviously).
• For any given threshold, the total variance is the weighted sum of the within-class variances
• The between class variance, which is the sum of weighted squared distances between the class means and the global mean.
The total variance can be expressed as
2 w2 (t) q1(t)[1 q1 (t)][1(t) 2 (t)]
2
Within-class, from before Between-class,
Minimizing the within-class variance is the same as maximizing the between-class variance.
compute the quantities in recursively as we run through the range of t values.
Total variance
B2 (t)
B2 (t)
Recursive algorithm
q1(t 1)q1(t) P(t 1)
1(t 1) q1(t)1 (t) (t 1)P(t 1)
q1(t 1)
q1(1) P(1) 1(0) 0;
2(t 1) q1(t 1)1(t 1)
1 q1(t 1)
Initialization...
Recursion...
Example
Input image Histogram
Global thresholding
Otsu’s method
Example (in presence of noise)
Input image Histogram Global threshold
Smoothened image Histogram Otsu’s method
Image partitioningInput image Histogram Global threshold
Global Otsu’s Method Image partitioning Local Otsu’s method
Thresholding (non-uniform background)
Input image Global thresholding using Otsu’s method
Local thresholding with moving average
Region based segmentation
• Goal: find coherent (homogeneous) regions in the image
• Coherent regions contain pixel which share some similar property
• Advantages: Better for noisy images
• Disadvantages: Oversegmented (too many regions), Undersegmented (too few regions)
• Can’t find objects that span multiple disconnected regions
Types of segmentations
Oversegmentation Undersegmentation
Multiple Segmentations
Input
Region Segmentation: Criteria
A segmentation is a partition of an imageinto a set of regions satisfying:
1. Si = S Partition covers the whole image.
2. Si Sj = , i j No regions intersect.
3. Si, P(Si) = true
4. P(Si Sj) = false, i j, Si adjacent SjHomogeneity predicate is satisfied by each region.
Union of adjacent regions does not satisfy it.
Define and implement the similarity predicate.
Methods of Region Segmentation
• Region growing
• Split and merge
• Clustering
Region Growing
• It start with one pixel of a potential region
• Try to grow it by adding adjacent pixels till the pixels being compared are too dissimilar
• The first pixel selected can be • The first unlabelled pixel in the image • A set of seed pixels can be chosen from the image.
• Usually a statistical test is used to decide which pixels can be added to a region
Example
Input image
Outputimage
Histogram Initial Seed image
Final seeds
Threshold 1 Threshold 2 Region growing
Split and Merge
• Split into four disjoint coordinates any region for which =false
• When no further splitting is possible, merge adjacent region for which = true
• Stop when no further merging is possible
Example
R1 R2
R4R3
R21 R22
R23 R24
R31 R32
R33 R34
R1
R4
Input image
Split Split Merge
Quadtree representation
R
R1 R2 R3 R4
R21 R22 R23 R24 R31 R32 R33 R34
R21 R22
R23 R24
R31 R32
R33 R34
R1
R4
Clustering
• Task of grouping a set of objects
• Objects in the same group (called a cluster) are more similar (in some sense or another) to each other
• Object of one cluster is different from an object of the another cluster
• Connectivity model, centroid model, distribution model, density model, graph based model, hard clustering, soft-clustering, …
Feature Space
Source: K. Grauman
Centroid model
• Computational time is short
• User have to decide the number of clusters before starting classifying data
• The concept of centroid
• One of the famous method: K-means Method
Partitional Clustering
• K-mean algorithm :
Decide the number of the final classified result with N.
Numbers of cluster: N
we now assume N=3
Partitional Clustering
• K-mean algorithm :
Randomly choose N point for the centroids of cluster.
(N=3)
Numbers of cluster: N
Partitional Clustering
• K-mean algorithm :
Find the nearest point for every centroid of cluster. Classify the point into the cluster.
Notice the definition of th nearest!
Partitional Clustering
• K-mean algorithm :
Calculate the new centroid of every cluster.
Notice the definition of the centroid!
Partitional Clustering
• K-mean algorithm :
Repeat step1~ step4 until all the point are classified.
Partitional Clustering
• K-mean algorithm :
Repeat step1~ step4 until all the point are classified.
Partitional Clustering
• K-mean algorithm :
Repeat step1~ step4 until all the point are classified.
Partitional Clustering
• K-mean algorithm :
Repeat step1~ step4 until all the point are classified.
Partitional Clustering
• K-mean algorithm :
Repeat step1~ step4 until all the point are classified.
Partitional Clustering
• K-mean algorithm :
Data clustering completed
For N=3
Example
Image Clusters on intensity Clusters on color
Slides by D.A. Forsyth
ExampleInput image Segmentation using K-means
Thank youNext Lecture: Image segmentation