CS654: Digital Image Analysis Lecture 15: Image Transforms with Real Basis Functions.
CS654: Digital Image Analysis Lecture 26: Image segmentation.
-
Upload
asher-garrett -
Category
Documents
-
view
245 -
download
0
Transcript of CS654: Digital Image Analysis Lecture 26: Image segmentation.
![Page 1: CS654: Digital Image Analysis Lecture 26: Image segmentation.](https://reader038.fdocuments.net/reader038/viewer/2022102517/56649f2c5503460f94c471e9/html5/thumbnails/1.jpg)
CS654: Digital Image Analysis
Lecture 26: Image segmentation
![Page 2: CS654: Digital Image Analysis Lecture 26: Image segmentation.](https://reader038.fdocuments.net/reader038/viewer/2022102517/56649f2c5503460f94c471e9/html5/thumbnails/2.jpg)
Recap of Lecture 25
• Line detection
• Least square, RANSAC
• Hough space/ parametric space
• Voting
• Circle detection
• GHT
![Page 3: CS654: Digital Image Analysis Lecture 26: Image segmentation.](https://reader038.fdocuments.net/reader038/viewer/2022102517/56649f2c5503460f94c471e9/html5/thumbnails/3.jpg)
Outline of Lecture 26
• Thresholding
• Otsu’s method
• Region based segmentation
• Region growing
• Split and Merge
![Page 4: CS654: Digital Image Analysis Lecture 26: Image segmentation.](https://reader038.fdocuments.net/reader038/viewer/2022102517/56649f2c5503460f94c471e9/html5/thumbnails/4.jpg)
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
![Page 5: CS654: Digital Image Analysis Lecture 26: Image segmentation.](https://reader038.fdocuments.net/reader038/viewer/2022102517/56649f2c5503460f94c471e9/html5/thumbnails/5.jpg)
Thresholding
𝑔 (𝑥 , 𝑦 )={1 𝐼𝑓 𝑓 (𝑥 , 𝑦 )>𝑇0 𝐼𝑓 𝑓 (𝑥 , 𝑦 )≤𝑇 𝑔 (𝑥 , 𝑦 )={ 𝒂 ; 𝐼𝑓 𝑓 (𝑥 , 𝑦 )>𝑇2
𝒃 ; 𝐼𝑓 𝑇1< 𝑓 (𝑥 , 𝑦 )≤𝑇 2
𝒄 ; 𝐼𝑓 𝑓 (𝑥 , 𝑦 )≤𝑇 1
Global thresholding, local thresholding, adaptive thresholding
Multiple thresholding
![Page 6: CS654: Digital Image Analysis Lecture 26: Image segmentation.](https://reader038.fdocuments.net/reader038/viewer/2022102517/56649f2c5503460f94c471e9/html5/thumbnails/6.jpg)
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
![Page 7: CS654: Digital Image Analysis Lecture 26: Image segmentation.](https://reader038.fdocuments.net/reader038/viewer/2022102517/56649f2c5503460f94c471e9/html5/thumbnails/7.jpg)
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 )
![Page 8: CS654: Digital Image Analysis Lecture 26: Image segmentation.](https://reader038.fdocuments.net/reader038/viewer/2022102517/56649f2c5503460f94c471e9/html5/thumbnails/8.jpg)
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.
![Page 9: CS654: Digital Image Analysis Lecture 26: Image segmentation.](https://reader038.fdocuments.net/reader038/viewer/2022102517/56649f2c5503460f94c471e9/html5/thumbnails/9.jpg)
Example
Input image Histogram Segmented image
![Page 10: CS654: Digital Image Analysis Lecture 26: Image segmentation.](https://reader038.fdocuments.net/reader038/viewer/2022102517/56649f2c5503460f94c471e9/html5/thumbnails/10.jpg)
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).
![Page 11: CS654: Digital Image Analysis Lecture 26: Image segmentation.](https://reader038.fdocuments.net/reader038/viewer/2022102517/56649f2c5503460f94c471e9/html5/thumbnails/11.jpg)
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.
![Page 12: CS654: Digital Image Analysis Lecture 26: Image segmentation.](https://reader038.fdocuments.net/reader038/viewer/2022102517/56649f2c5503460f94c471e9/html5/thumbnails/12.jpg)
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
![Page 13: CS654: Digital Image Analysis Lecture 26: Image segmentation.](https://reader038.fdocuments.net/reader038/viewer/2022102517/56649f2c5503460f94c471e9/html5/thumbnails/13.jpg)
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)
![Page 14: CS654: Digital Image Analysis Lecture 26: Image segmentation.](https://reader038.fdocuments.net/reader038/viewer/2022102517/56649f2c5503460f94c471e9/html5/thumbnails/14.jpg)
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.
![Page 15: CS654: Digital Image Analysis Lecture 26: Image segmentation.](https://reader038.fdocuments.net/reader038/viewer/2022102517/56649f2c5503460f94c471e9/html5/thumbnails/15.jpg)
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)
![Page 16: CS654: Digital Image Analysis Lecture 26: Image segmentation.](https://reader038.fdocuments.net/reader038/viewer/2022102517/56649f2c5503460f94c471e9/html5/thumbnails/16.jpg)
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...
![Page 17: CS654: Digital Image Analysis Lecture 26: Image segmentation.](https://reader038.fdocuments.net/reader038/viewer/2022102517/56649f2c5503460f94c471e9/html5/thumbnails/17.jpg)
Example
Input image Histogram
Global thresholding
Otsu’s method
![Page 18: CS654: Digital Image Analysis Lecture 26: Image segmentation.](https://reader038.fdocuments.net/reader038/viewer/2022102517/56649f2c5503460f94c471e9/html5/thumbnails/18.jpg)
Example (in presence of noise)
Input image Histogram Global threshold
Smoothened image Histogram Otsu’s method
![Page 19: CS654: Digital Image Analysis Lecture 26: Image segmentation.](https://reader038.fdocuments.net/reader038/viewer/2022102517/56649f2c5503460f94c471e9/html5/thumbnails/19.jpg)
Image partitioningInput image Histogram Global threshold
Global Otsu’s Method Image partitioning Local Otsu’s method
![Page 20: CS654: Digital Image Analysis Lecture 26: Image segmentation.](https://reader038.fdocuments.net/reader038/viewer/2022102517/56649f2c5503460f94c471e9/html5/thumbnails/20.jpg)
Thresholding (non-uniform background)
Input image Global thresholding using Otsu’s method
Local thresholding with moving average
![Page 21: CS654: Digital Image Analysis Lecture 26: Image segmentation.](https://reader038.fdocuments.net/reader038/viewer/2022102517/56649f2c5503460f94c471e9/html5/thumbnails/21.jpg)
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
![Page 22: CS654: Digital Image Analysis Lecture 26: Image segmentation.](https://reader038.fdocuments.net/reader038/viewer/2022102517/56649f2c5503460f94c471e9/html5/thumbnails/22.jpg)
Types of segmentations
Oversegmentation Undersegmentation
Multiple Segmentations
Input
![Page 23: CS654: Digital Image Analysis Lecture 26: Image segmentation.](https://reader038.fdocuments.net/reader038/viewer/2022102517/56649f2c5503460f94c471e9/html5/thumbnails/23.jpg)
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.
![Page 24: CS654: Digital Image Analysis Lecture 26: Image segmentation.](https://reader038.fdocuments.net/reader038/viewer/2022102517/56649f2c5503460f94c471e9/html5/thumbnails/24.jpg)
Methods of Region Segmentation
• Region growing
• Split and merge
• Clustering
![Page 25: CS654: Digital Image Analysis Lecture 26: Image segmentation.](https://reader038.fdocuments.net/reader038/viewer/2022102517/56649f2c5503460f94c471e9/html5/thumbnails/25.jpg)
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
![Page 26: CS654: Digital Image Analysis Lecture 26: Image segmentation.](https://reader038.fdocuments.net/reader038/viewer/2022102517/56649f2c5503460f94c471e9/html5/thumbnails/26.jpg)
Example
Input image
Outputimage
Histogram Initial Seed image
Final seeds
Threshold 1 Threshold 2 Region growing
![Page 27: CS654: Digital Image Analysis Lecture 26: Image segmentation.](https://reader038.fdocuments.net/reader038/viewer/2022102517/56649f2c5503460f94c471e9/html5/thumbnails/27.jpg)
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
![Page 28: CS654: Digital Image Analysis Lecture 26: Image segmentation.](https://reader038.fdocuments.net/reader038/viewer/2022102517/56649f2c5503460f94c471e9/html5/thumbnails/28.jpg)
Example
R1 R2
R4R3
R21 R22
R23 R24
R31 R32
R33 R34
R1
R4
Input image
Split Split Merge
![Page 29: CS654: Digital Image Analysis Lecture 26: Image segmentation.](https://reader038.fdocuments.net/reader038/viewer/2022102517/56649f2c5503460f94c471e9/html5/thumbnails/29.jpg)
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
![Page 30: CS654: Digital Image Analysis Lecture 26: Image segmentation.](https://reader038.fdocuments.net/reader038/viewer/2022102517/56649f2c5503460f94c471e9/html5/thumbnails/30.jpg)
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, …
![Page 31: CS654: Digital Image Analysis Lecture 26: Image segmentation.](https://reader038.fdocuments.net/reader038/viewer/2022102517/56649f2c5503460f94c471e9/html5/thumbnails/31.jpg)
Feature Space
Source: K. Grauman
![Page 32: CS654: Digital Image Analysis Lecture 26: Image segmentation.](https://reader038.fdocuments.net/reader038/viewer/2022102517/56649f2c5503460f94c471e9/html5/thumbnails/32.jpg)
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
![Page 33: CS654: Digital Image Analysis Lecture 26: Image segmentation.](https://reader038.fdocuments.net/reader038/viewer/2022102517/56649f2c5503460f94c471e9/html5/thumbnails/33.jpg)
Partitional Clustering
• K-mean algorithm :
Decide the number of the final classified result with N.
Numbers of cluster: N
we now assume N=3
![Page 34: CS654: Digital Image Analysis Lecture 26: Image segmentation.](https://reader038.fdocuments.net/reader038/viewer/2022102517/56649f2c5503460f94c471e9/html5/thumbnails/34.jpg)
Partitional Clustering
• K-mean algorithm :
Randomly choose N point for the centroids of cluster.
(N=3)
Numbers of cluster: N
![Page 35: CS654: Digital Image Analysis Lecture 26: Image segmentation.](https://reader038.fdocuments.net/reader038/viewer/2022102517/56649f2c5503460f94c471e9/html5/thumbnails/35.jpg)
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!
![Page 36: CS654: Digital Image Analysis Lecture 26: Image segmentation.](https://reader038.fdocuments.net/reader038/viewer/2022102517/56649f2c5503460f94c471e9/html5/thumbnails/36.jpg)
Partitional Clustering
• K-mean algorithm :
Calculate the new centroid of every cluster.
Notice the definition of the centroid!
![Page 37: CS654: Digital Image Analysis Lecture 26: Image segmentation.](https://reader038.fdocuments.net/reader038/viewer/2022102517/56649f2c5503460f94c471e9/html5/thumbnails/37.jpg)
Partitional Clustering
• K-mean algorithm :
Repeat step1~ step4 until all the point are classified.
![Page 38: CS654: Digital Image Analysis Lecture 26: Image segmentation.](https://reader038.fdocuments.net/reader038/viewer/2022102517/56649f2c5503460f94c471e9/html5/thumbnails/38.jpg)
Partitional Clustering
• K-mean algorithm :
Repeat step1~ step4 until all the point are classified.
![Page 39: CS654: Digital Image Analysis Lecture 26: Image segmentation.](https://reader038.fdocuments.net/reader038/viewer/2022102517/56649f2c5503460f94c471e9/html5/thumbnails/39.jpg)
Partitional Clustering
• K-mean algorithm :
Repeat step1~ step4 until all the point are classified.
![Page 40: CS654: Digital Image Analysis Lecture 26: Image segmentation.](https://reader038.fdocuments.net/reader038/viewer/2022102517/56649f2c5503460f94c471e9/html5/thumbnails/40.jpg)
Partitional Clustering
• K-mean algorithm :
Repeat step1~ step4 until all the point are classified.
![Page 41: CS654: Digital Image Analysis Lecture 26: Image segmentation.](https://reader038.fdocuments.net/reader038/viewer/2022102517/56649f2c5503460f94c471e9/html5/thumbnails/41.jpg)
Partitional Clustering
• K-mean algorithm :
Repeat step1~ step4 until all the point are classified.
![Page 42: CS654: Digital Image Analysis Lecture 26: Image segmentation.](https://reader038.fdocuments.net/reader038/viewer/2022102517/56649f2c5503460f94c471e9/html5/thumbnails/42.jpg)
Partitional Clustering
• K-mean algorithm :
Data clustering completed
For N=3
![Page 43: CS654: Digital Image Analysis Lecture 26: Image segmentation.](https://reader038.fdocuments.net/reader038/viewer/2022102517/56649f2c5503460f94c471e9/html5/thumbnails/43.jpg)
Example
Image Clusters on intensity Clusters on color
Slides by D.A. Forsyth
![Page 44: CS654: Digital Image Analysis Lecture 26: Image segmentation.](https://reader038.fdocuments.net/reader038/viewer/2022102517/56649f2c5503460f94c471e9/html5/thumbnails/44.jpg)
ExampleInput image Segmentation using K-means
![Page 45: CS654: Digital Image Analysis Lecture 26: Image segmentation.](https://reader038.fdocuments.net/reader038/viewer/2022102517/56649f2c5503460f94c471e9/html5/thumbnails/45.jpg)
Thank youNext Lecture: Image segmentation