Sei sulla pagina 1di 48

Image Segmentation

Image Segmentation
 Group similar components (such as, pixels in an
image, image frames in a video)
 Applications: Finding tumors, veins, etc. in medical
images, finding targets in satellite/aerial images,
finding people in surveillance images, summarizing
video, etc.

1/5/2020 Image Segmentation 2


Image Segmentation
 Segmentation algorithms are based on one of two basic
properties of gray-scale values:
 Discontinuity
 Partition an image based on abrupt changes in gray-scale levels.

 Detection of isolated points, lines, and edges in an image.

 Similarity
 Thresholding, region growing, and region splitting/merging.

1/5/2020 Image Segmentation 3


Thresholding
 Segmentation into two classes/groups
 Foreground (Objects)
 Background

1/5/2020 Image Segmentation 4


Thresholding

1 if f ( x, y )  T
g ( x, y )  
0 if f ( x, y )  T

Objects & Background

 Global Thresholding
 Local/Adaptive Thresholding
1/5/2020 Image Segmentation 5
Global Thresholding
 Single threshold value for entire image
 Fixed ?
 Automatic
 Intensity histogram

1/5/2020 Image Segmentation 6


Global Thresholding
 Single threshold value for entire image
 Fixed ?
 Automatic
 Intensity histogram

1/5/2020 Image Segmentation 7


Global Thresholding
 Estimate an initial T

 Segment Image using T: Two groups of pixels G1 and G2

 Compute average gray values m1 and m2 of two groups

 Compute new threshold value T=1/2(m1+m2)

 Repeat steps 2 to 4 until: abs(Ti – Ti-1)<epsilon

1/5/2020 Image Segmentation 8


Global Thresholding

Multilevel thresholding

1/5/2020 Image Segmentation 9


Thresholding
 Non-uniform illumination:

1/5/2020 Image Segmentation 10


Global Thresholding

1/5/2020 Image Segmentation 11


Adaptive Thresholding

1/5/2020 Image Segmentation 12


Adaptive Thresholding
 Threshold: function of neighboring pixels

T  mean
T  median
max  min
T
2

1/5/2020 Image Segmentation 13


Adaptive Thresholding

Original Image Global Thresholding


1/5/2020 Image Segmentation 14
Adaptive Thresholding

T=mean, neighborhood=7x7 T=mean-Const., neighborhood=7x7


1/5/2020 Image Segmentation 15
Region-Based Segmentation
 Divide the image into regions
 R1,R2,…,RN
 Following properties must hold:

(For adjacent regions)

1/5/2020 Image Segmentation 16


Region-Based Segmentation
 Region Growing
 Region growing: groups pixels or subregions into larger
regions.
 Pixel aggregation: starts with a set of “seed” points and from
these grows regions by appending to each seed points those
neighboring pixels that have similar properties (such as gray
level).

1. Choose the seed pixel(s).


2. Check the neighboring pixels and add them to the region if they are
similar to the seed
3. Repeat step 2 for each of the newly added pixels; stop if no more
pixels can be added

Predicate: for example abs(zj - seed) < Epsilon

1/5/2020 Image Segmentation 17


Region-Based Segmentation
 Example

1/5/2020 Image Segmentation 18


Region-Based Segmentation
 Region Splitting
 Region Growing: Starts from a set of seed points.
 Region Splitting: Starts with the whole image as a single
region and subdivide the regions that do not satisfy a
condition.
 Image = One Region R
 Select a predicate P (gray values etc.)
 Successively divide each region into smaller and smaller
quadrant regions so that:

P( Ri )  true

1/5/2020 Image Segmentation 19


Region-Based Segmentation
 Region Splitting

Problem? Adjacent regions could be same


Solution? Allow Merge

1/5/2020 Image Segmentation 20


Region-Based Segmentation
 Region Merging
 Region merging is the opposite of region splitting.
 Merge adjacent regions Ri and Rj for which:

P( Ri  R j )  True
 Region Splitting/Merging
 Stop when no further split or merge is possible

1/5/2020 Image Segmentation 21


Region-Based Segmentation
 Example

1. Split into four disjointed quadrants any region Ri where P(Ri)=False

2. Merge any adjacent regions Rj and Rk for which P(Rj U Rk)=True

3. Stop when no further merging or splitting is possible

1/5/2020 Image Segmentation


22
K-Means Clustering
1. Chose the number (K) of clusters and randomly select the
centroids of each cluster.
2. For each data point:
 Calculate the distance from the data point to each cluster.
 Assign the data point to the closest cluster.
3. Recompute the centroid of each cluster.
4. Repeat steps 2 and 3 until there is no further change in
the assignment of data points (or in the centroids).

1/5/2020 Image Segmentation 23


Recognition

 Identification of a pattern as a member of


a category
 Classification (Supervised: known
categories)
 Clustering (Unsupervised: learning
categories)

24
Classification

25
Classification

 You had some training example


or ‘training data’
 The examples were ‘labeled’
 You used those examples to
make the kid ‘learn’ the
difference between an apple
and an orange

26
Classification

27
Clustering
 There are two types of fruit in the basket,
separate them into two ‘groups’

28
Clustering

 The data was not ‘labeled’ you did


not tell Nicolas which are apples
which are oranges

 May be the kid used the idea that


things in the same group should be
similar to one another as compared
to things in the other group

 Groups - Clusters

29
Classification vs. Clustering

Category “A”

Category “B”

Clustering
Classification

30
Pattern Class

 A collection of similar (not necessarily identical)


objects
 Intra-class variability
 Inter-class similarity

31
Pattern Class
Intra-class variability

The letter “T” in different typefaces

Same face under different expression, pose, illumination


32
Pattern Class

Inter-class similarity

Characters that look similar

Identical twins

33
K-Means Clustering

1/5/2020 Image Segmentation 34


K-Means Clustering

1/5/2020 Image Segmentation 35


K-Means Clustering

1/5/2020 Image Segmentation 36


K-Means Clustering

1/5/2020 Image Segmentation 37


K-Means Clustering

1/5/2020 Image Segmentation 38


K-Means Clustering

1/5/2020 Image Segmentation 39


K-Means Clustering

1/5/2020 Image Segmentation 40


K-Means Clustering

1/5/2020 Image Segmentation 41


K-Means Clustering

1/5/2020 Image Segmentation 42


Clustering
 Example

1/5/2020 Image Segmentation 43


Clustering
 Example

1/5/2020 Image Segmentation 44


Clustering
 Example

1/5/2020 Image Segmentation 45


Clustering
 Example

1/5/2020 Image Segmentation 46


Clustering
 Example

D. Comaniciu and P.
Meer, Robust Analysis
of Feature Spaces:
Color Image
Segmentation, 1997.

1/5/2020 Image Segmentation 47


K-Means Clustering
 Example

Original K=5 K=11

1/5/2020 Image Segmentation 48

Potrebbero piacerti anche