Lecture7 Segmentation
Lecture7 Segmentation
Chapter 10
Image Segmentation
2 5
3 6
1
Edge detection
• The magnitude of the first derivative can be used to
detect an edge
• The sign (zero crossing) of the second derivative can
be used to detect an edge.
• The same idea can be extended into 2-D. 2-D
derivatives should be used.
• The magnitude of the gradient and sign of the
Laplacian are used.
7 10
Edge detection
• Edge: boundary between two regions with relatively
distinct gray levels.
8 11
∇f = mag (∇f ) = (G x
2
+ Gy 2 ) ∇f ≈ Gx + G y
Gradient direction
Gy
α ( x, y ) = tan −1 ( )
Gx
9 12
2
13 16
14 17
Laplacian
• Laplacian in its original form is not used for edge
detection because:
1. It is very sensitive to noise
2. It’s magnitude produces double edges
3. Unable to detect the direction of an edge.
• To solve the first problem, the image is low-pass
filtered before using the Laplacian operator.
15 18
3
Laplacian
∂ f ∂ f
2 2
∇2 f = +
∂x 2 ∂y 2
8
∇ 2 f = 8 z5 − ∑ zi
i =1
∇ 2 f = 4 z5 − ( z2 + z4 + z6 + z8 )
19 22
20 23
21 24
4
Edge linking and Boundary Detection Hough transform
• (amin,amax): expected range of slope
• All the points that are similar are linked forming a
• (bmin,bmax): expected range of intercepts
boundary of pixels.
• A(i,j): the number of points in the cell at coordinates (i,j) in
• Two principle properties used for establishing the ab plane.
similarity of edge pixels in this kind of analysis are:
For every point in the image
1. The strength of the response of the gradient
plane we let the value of a
plane,
operator used to produce the edge pixels equal each of the allowed
2. The direction of the gradient subdivisions and find the
corresponding b from
∇f ( x, y ) − ∇f ( x0 + y0 ) ≤ E b= yi-axi If for ap we get bq
the A(p,q) is incremented.
α ( x, y ) − α ( x0 , y0 ) < A
25 28
Hough transform
• The cell with the largest value shows the parameters
of the line that contains the maximum number of
points.
• Problem with this method: a approaches infinity as
the line gets perpendicular to the x axis.
• Solution: use the representation of the line as:
x cosθ + y sin θ = ρ
26 29
27 30
5
Thresholding
• Single threshold: points with f(x,y)>T belong to object;
other points belong to background.
• Multiple thresholds: points with f(x,y)>T2 belong to
object; points with f(x,y)<T1 belong to bakground.
31 34
32 35
Thresholding Thresholding
33 36
6
Thresholding Basic Global Thresholding
37 40
38 41
39 42
7
Optimal Global Thresholding Region Growing
T
Error 1: E1 (T ) = ∫ p2 ( z )dz
−∞
∞ • Pixel aggregation: starts with a set of seed point and
Error 2: E2 (T ) = ∫ p1 ( z )dz from these grows regions by appending to each seed
T
point those neighboring pixels that have similar
T t l error:
Total E (T ) = P1 E2 (T ) + P2 E1 (T ) properties
i (e.g.,
( gray-level,
l l texture, color).
l )
Result: P1 p1 (T ) = P2 p2 (T )
43 46
Solution: AT 2 + BT + C = 0
A = σ 12 − σ 22
Center Pixel
44 47
b) R i is a connected region.
c) R i ∩ R j = φ
d) P(R i ) = True
A T-2 weighted MR brain image (left) and the segmented
e) P(R i ∪ R j ) = False ventricles (right) using the region-growing method.
45 48
8
Region growing Region Splitting and Merging
• Sub-divide an image into a set of disjoint regions
and then merge and/or split the regions in an attempt
• Problems: to satisfy the condition (P).
1. Selection of initial seeds that properly represent
regions of interest
2 Selection of suitable
2. s itable properties
3. Formulation of a stopping rule.
49 52
50 53
51 54
9
Mathematical Morphology Example of Erode Function
• Mathematical morphology involves a convolution-like
process using various shaped kernels, called structuring
elements
• The structuring elements are mostly symmetric: squares,
rectangles, and circles
• Most common morphological operations are
– Erosion
– Dilation
– Open
– Close
• The operations can be applied iteratively in selected order to
effect a powerful process
Input image Eroded image
55 58
56 59
57 60
10
Example of Dilation Example of Open Operation
61 64
62 65
63 66
11
Example of Close Operation Example of A Snake Algorithm
Input image Closed image Initial contour in green, yellow Final contour converged
is intermediate contour in 25 iterations
67 70
68 71
69 72
12