Download - Ip12 Segmentation
-
7/31/2019 Ip12 Segmentation
1/38
mage Processing - Lesson 12
Segmentation
Threshold Segmentation
Local thresholding
Edge thresholding
Threshold using averaging
Gradient Detectors
Region Growing
Split & Merge
Shape Matching
Shape Representation
-
7/31/2019 Ip12 Segmentation
2/38
Segmentation
Image Segmentation = divide image into (continuous)regions or sets of pixels.
1) Region Based
2) Boundary Based
3) Edge Based
-
7/31/2019 Ip12 Segmentation
3/38
Thresholding
Global Thresholding = Choose threshold T that
separates object from background.
Background
Object
T
Graylevel
#
ofPixels
Image Histogram
-
7/31/2019 Ip12 Segmentation
4/38
0 100 2000
500
1000
1500
Segmentation using Thresholding
Original Histogram
50 75
Threshold = 50 Threshold = 75
-
7/31/2019 Ip12 Segmentation
5/38
0 100 2000
500
1000
1500
Original Histogram
21
Threshold = 21
-
7/31/2019 Ip12 Segmentation
6/38
Thresholding a Grayscale Image
Original Image Thresholded Image
Threshold too low Threshold too high
-
7/31/2019 Ip12 Segmentation
7/38
FMRI - Example
Original Image Threshold = 80
Threshold = 71 Threshold = 88
-
7/31/2019 Ip12 Segmentation
8/38
Simple thresholding is not always possible:
Graylevel
#
ofPixels
Image Histogram
1) Many objects at different gray levels.
2) Variations in background gray level.
3) Noise in image.
-
7/31/2019 Ip12 Segmentation
9/38
Thresholding Example
Original
0 100 2000
50
100
150
Histogram
Single Global Threshold
0 100 2000
50
100
150
T = 128
-
7/31/2019 Ip12 Segmentation
10/38
Local Thresholding - 4 Thresholds
Divide image in to regions. Perform thresholding
independently in each region.
0 100 2000
50
00
0 100 2000
50
00
0 100 2000
50
100
0 100 2000
50
100
T = 80 T = 128 T = 188 T = 226
-
7/31/2019 Ip12 Segmentation
11/38
Adaptive Thresholding
Every pixel in image is thresholded according to the
histogram of the pixel neighborhood.
0 50 1000
00
00
x-coordinate
Threshold
Level
T =
-
7/31/2019 Ip12 Segmentation
12/38
Adaptive Thresholding - Example
Original
Global Threshold Adaptive Threshold
-
7/31/2019 Ip12 Segmentation
13/38
Threshold Segmentation of Noisy Images
Noise inhibits localization of threshold.
Graylevel
#
ofPixels
Image Histogram
Smooth image and obtain a histogram for which
threshold is easily determined.
Graylevel
#ofPixels
Image Histogram
T
-
7/31/2019 Ip12 Segmentation
14/38
Note: Smooth the image, not the histogram...
Graylevel
#
ofPixels
Image Histogram
Graylevel
#
ofPixels
Image Histogram
-
7/31/2019 Ip12 Segmentation
15/38
Threshold using Average
Gray level
Gray level Histograms
nop
ixe
ls
0 50 100 150 200 2500
5000
10000
-
7/31/2019 Ip12 Segmentation
16/38
Threshold using Average
Gray level
nopi
xels
0 50 100 150 200 2500
50
100
0 50 100 150 200 2500
200
400
Gray level
Gray level Histograms
-
7/31/2019 Ip12 Segmentation
17/38
Edge Based Segmentation
Edge ImageOriginal
ObjectBackground
-
7/31/2019 Ip12 Segmentation
18/38
Edge Based Thresholding
Original Edge Pixels Edge Neighbors
0 50 100 150 200 2500
50
100
150
200Edge Neighbors Histogram
-
7/31/2019 Ip12 Segmentation
19/38
Thresholding Based on
Boundary Characteristics
Original Threshold (T=182)l
0 100 2000
1000
2000
3000
Global Histogram
-
7/31/2019 Ip12 Segmentation
20/38
Thresholding Based on
Boundary Characteristics
Original Threshold (T=143)l
0 100 2000
5
10
15
20
Edge Neighborhood Histogram
-
7/31/2019 Ip12 Segmentation
21/38
Region Growing
Define:
S = the set of pixels inside the region.
Q = queue of pixels to be checked.
(x0,y0) = a pixel inside the region.
Initialize: S =
Q = { (x0,y0) }
1) Extract pixel P from queue Q
2) Add P to S.
3) For each neighbor P' ofP:
ifP' is "similar" to P and P' S then
add P' to Q.
4) IfQ = then end, else return to 1.
Algorithm:
S = the extracted pixels of the region.
Define what "similar" means.
Problematic in small gradient regions.
-
7/31/2019 Ip12 Segmentation
22/38
Region Growing - Example
Seed
-
7/31/2019 Ip12 Segmentation
23/38
Region Growing - Examples
Color Segmentation
Texture Segmentation
Color + Texture Segmentation
-
7/31/2019 Ip12 Segmentation
24/38
Watershed Threshold Algorithm
An Image can be viewed as a topographic map
T0
Tn
Threshold
Level
Image location
-
7/31/2019 Ip12 Segmentation
25/38
Watershed Threshold Algorithm
Original T = 149 T = 150
Thre
shold
Level
T0
Tn
Image location
Initialize threshold at T0 that separates objects well.Determine connected components.
Raise threshold, and detect pixels that pass threshold
and belong to more than one connected component.
Do not let objects merge.
Set these pixels as object boundaries.
-
7/31/2019 Ip12 Segmentation
26/38
Watershed Threshold Algorithm
-
7/31/2019 Ip12 Segmentation
27/38
Watershed Threshold Algorithm
Original Watershed Boundaries
Watershed Markers Watershed Boundaries
Watershed Markers may be chosen manually or
local global maximas (as above)
-
7/31/2019 Ip12 Segmentation
28/38
Split & Merge Segmentation
2 Stage Algorithm:
Stage 1: Split
Split image into regions using a Quad Tree
representation.
Stage 2: Merge
Merge "leaves" of the Quad Tree which are
neighboring and "similar".
Original Split Split + Merge
-
7/31/2019 Ip12 Segmentation
29/38
Quad Tree - Representation
Image Quad Tree
1 2 3 4
1 2
3 4
Demo
http://lectures/Ip4_GeomOper/Demos/AlexMorph/morphToky.htmlhttp://lectures/Ip4_GeomOper/Demos/AlexMorph/morphToky.htmlhttp://lectures/Ip4_GeomOper/Demos/AlexMorph/morphToky.html -
7/31/2019 Ip12 Segmentation
30/38
Quad Tree Representation
Original
Thresh = 0.20
Thresh = 0.40
Thresh = 0.55
-
7/31/2019 Ip12 Segmentation
31/38
Split & Merge Example
Stage 1: Split
Stage 2: Merge
-
7/31/2019 Ip12 Segmentation
32/38
Split & Merge Example
-
7/31/2019 Ip12 Segmentation
33/38
Graph-Cut Segmentation
Wij
ji Wij
G = { V , E }
V = verticesE = Edges
V = image pixelsE = pixel similarity
Segmentation = Graph Partitioning
-
7/31/2019 Ip12 Segmentation
34/38
Min-Cut Segmentation
cut
A
B
=BjAi
ijWBAcut,
),(
Segmentation by min-cut:
Find A,B such that cut(A,B) is minimal.
(Wu and Leahy 1993)
-
7/31/2019 Ip12 Segmentation
35/38
Normalized-Cut Segmentation
+=
)(
1
)(
1),(
, BvolAvolWBANcutBjAi
ij
Segmentation by normalized-cut:
Find A,B such that Ncut(A,B) is minimal.
(Shi and Malik 2000)
cut
Min-cut segmentation favors small segments.
=AjAi
ijWAvol,
)(where
-
7/31/2019 Ip12 Segmentation
36/38
Normalized-Cut Segmentation -
Examples
(from Cohen-Or 2005)
-
7/31/2019 Ip12 Segmentation
37/38
Shape Matching / Object Recognition
Model #1 Model #2 Model #3 Model #4
? ?? ?
Which Model matches the Measurement?
Which Model
What is the transformation from Model to Measurement
(translation, rotation, scale,)
-
7/31/2019 Ip12 Segmentation
38/38