MIP Lecture 10
MIP Lecture 10
X. Image Segmentation
Min H. Cho
Kyung Hee Univ. 1
Medical Image Processing (2008)
X. Image Segmentation
1. Preview
2. Point, Line and Edge Detection
3. Thresholding
4. Region-Based Segmentation
5. Segmentation Using Morphological Watersheds
Min H. Cho
Kyung Hee Univ. 2
Medical Image Processing (2008)
Preview
• Segmentation is to subdivide an image into
its constituent regions or objects.
• Segmentation algorithms generally are
based on one of two basis properties of
intensity values
– Discontinuity : to partition an image based on
abrupt changes in intensity (edges)
– Similarity : to partition an image into regions
that are similar according to a set of predefined
criteria. (thresholding, region growing, region
splitting/merging)
Edge-based
Region-based
Min H. Cho
Kyung Hee Univ. 3
Medical Image Processing (2008)
Detection of Discontinuities
(Point, Line, and Edge)
• Detecting sharp, local changes in
intensities
• Isolated points, lines, and edges.
• First and second-order derivatives
– First-order (gradient operator)
• produce thicker edges
– Second-order (Laplacian operator)
• Stronger response to fine detail
• Double-edge response at ramp and
step transitions
• The sign determines whether a
transition into an edge is from light to
dark or dark to light.
• Laplacian + thresholding
Min H. Cho
Kyung Hee Univ. 4
Medical Image Processing (2008)
Line Detection
• Laplacian à positive and negative lines
- Take absolute values à thick lines
- Use only the positive values
Min H. Cho
Kyung Hee Univ. 5
Medical Image Processing (2008)
Edge Models
• In practice, edges are blurred and noisy. à ramp edge
• Ramp slope ß degree of blurring ß focusing mechanism
(optics, sampling, image acquisition imperfection)
Min H. Cho
Kyung Hee Univ. 6
Medical Image Processing (2008)
Min H. Cho
Kyung Hee Univ. 7
Medical Image Processing (2008)
Gradient Operators
¶f
gx = = f ( x + 1, y ) - f ( x, y )
¶x
¶f
gy = = f ( x, y + 1) - f ( x, y )
¶y
Example
Min H. Cho
Kyung Hee Univ. 8
Medical Image Processing (2008)
Example
Example
- Diagonal Edge Detection
Min H. Cho
Kyung Hee Univ. 9
Medical Image Processing (2008)
Min H. Cho
Kyung Hee Univ. 10
Medical Image Processing (2008)
the coefficients
sum to zero
• Attractive
– Zero crossing produces thinner edges
– Noise reduction
• Drawbacks
– Zero-crossing creates closed loops. (spaghetti effect)
à a positive threshold
Min H. Cho
Kyung Hee Univ. 11
Medical Image Processing (2008)
Example
spaghetti
effect
Example
Sobel
Min H. Cho
Kyung Hee Univ. 12
Medical Image Processing (2008)
Min H. Cho
Kyung Hee Univ. 13
Medical Image Processing (2008)
Nonmaxima Suppression
Step 1) Specify a number of discrete orientations of the edge normal (gradient vector).
– Ex) 4 orientations (0˚,45˚,90˚,-45˚) for a 3x3 region
d3
d3
d2
d1
d4
d3
TH
false
TL
Min H. Cho
Kyung Hee Univ. 14
Medical Image Processing (2008)
Example
Thresholded gradient
Marr-Hildreth Canny
Example
Min H. Cho
Kyung Hee Univ. 15
Medical Image Processing (2008)
Local Processing
• Analyze the characteristics of pixels in a small
neighborhood (say, 3x3, 5x5) about every edge pixel.
• All points that are similar according to a set of
predefined criteria are linked.
• Principal properties used for establishing similarity:
(1) Magnitude of gradient vector, M(x,y)=|∇f(x,y)|
|M(s,t)-M(x,y)|≤E
(2) Direction of gradient vector, α(x,y)
|α(s,t)-α(x,y)|≤A
• Edge pixel (x,y) is linked with (s,t) if both criteria are
satisfied.
Min H. Cho
Kyung Hee Univ. 16
Medical Image Processing (2008)
Simplified Formulation
1. Compute M(x,y) and α(x,y)
2. g(x,y)= 1 if M(x,y)>TM AND |α(x,y)-A|<TA
0 otherwise
A : a specified direction
3. Scan the rows of g(x,y) and fill all gaps in each row
that do not exceed a specified length
4. To detect gaps in any direction, rotate g(x,y) by this
angle and apply step 3.
Example
Min H. Cho
Kyung Hee Univ. 17
Medical Image Processing (2008)
Regional Processing
• When knowledge is available regarding the regional
membership of pixels
• Polygonal curve fitting
Example
1D smoothing for
jaggedness reduction
T=6 T=9 1D averaging 1D averaging
Min H. Cho
Kyung Hee Univ. 18
Medical Image Processing (2008)
Min H. Cho
Kyung Hee Univ. 19
Medical Image Processing (2008)
Algorithm
1) Set all cells of ab-plane to zero
2) For every (xk, yk)
2.1) Let a=every subdivision on the a-axis
2.2) Calculate b=-xka+yk
2.3) Round off b to the nearest allotted value on the b-axis
2.4) Increment accumulator cell (a, b) with 1
ab-plane
• Problem : -∞<a<∞, -∞<b<∞
à solution : (a,b) à (ρ,θ), xcosθ+ysinθ=ρ,
-90˚≤θ≤90˚, -√2D≤ρ≤√2D (D is the image size)
ρθ-plane
Example
R
A B
S Q
Min H. Cho
Kyung Hee Univ. 20
Medical Image Processing (2008)
Min H. Cho
Kyung Hee Univ. 21
Medical Image Processing (2008)
Example
- Extract the two edges of the principal runway
for autonomous navigation of air vehicles
Example
link criteria:
- the pixels belong to
one of the set of pixels
linked according to the
highest count
- no gaps are longer
than 5 pixels
Min H. Cho
Kyung Hee Univ. 22
Medical Image Processing (2008)
Thresholding
• g(x,y)= 1 if f(x,y)>T
0 if f(x,y)≤T
• Global thresholding
• Variable (regional) thresholding, dynamic (adaptive) thresholding
- T depends on f(x,y) and p(x,y) (on gray-level values and its neighbors)
• Multiple thresholding
• Key factors
- the separation between peaks in the histogram
- the noise content
- the relative size of objects and background
- the uniformity of the illumination source
- the uniformity of the reflectance properties
image with dark image with dark
background and background and
a light object two light objects
Min H. Cho
Kyung Hee Univ. 23
Medical Image Processing (2008)
Min H. Cho
Kyung Hee Univ. 24
Medical Image Processing (2008)
Example
Tinit=mG
ΔT=0
3 iterations
with result
T=125
Min H. Cho
Kyung Hee Univ. 25
Medical Image Processing (2008)
Otsu’s Algorithm
L -1
• Normalized histogram pi=ni/MN (å pi = 1)
i =0
k i
Example
Min H. Cho
Kyung Hee Univ. 26
Medical Image Processing (2008)
Min H. Cho
Kyung Hee Univ. 27
Medical Image Processing (2008)
Example
Example
T=42
TE=5% of max
T=55
Min H. Cho
Kyung Hee Univ. 28
Medical Image Processing (2008)
Multiple Thresholds
• Extended Otsu’s method
• (K-1) threshold values for K classes:
K
C1, C2, C3, ..., CK
• Between-class variance s B = å Pk (mk - mG ) 2
2
Pk = å pi
k =1 iÎC k
η=0.954
k1=80 k2=177
Variable Thresholding
Using Image Partioning
Min H. Cho
Kyung Hee Univ. 29
Medical Image Processing (2008)
Variable Thresholding
Based on Local Image Properties
• Local threshold, Txy=aσxy+bmxy in a neighborhood, Sxy centered at (x,y)
or Txy=aσxy+bmG
Variable Thresholding
Based on Moving Averaging
• Moving average along scan lines, mxy
• Txy=bmxy
Min H. Cho
Kyung Hee Univ. 30
Medical Image Processing (2008)
Min H. Cho
Kyung Hee Univ. 31
Medical Image Processing (2008)
254
Q=TRUE if diff ≤T
• Disadvantage:
1. The computation is consuming.
2. Noise or variation of intensity may result in holes or over-segmentation.
3. This method may not distinguish the shading of the real images.
Min H. Cho
Kyung Hee Univ. 32
Medical Image Processing (2008)
Min H. Cho
Kyung Hee Univ. 33
Medical Image Processing (2008)
Example
Segment out of the image the “ring” of less dense matter surrounding the dense center
Morphological Watersheds
• To extract nearly uniform objects from the background.
• A closed contour
• Independent of shape and size
• Efficient and accurate
Flooding and
building dams
Min H. Cho
Kyung Hee Univ. 34
Medical Image Processing (2008)
Dam Construction
Dam construction is based on binary images
Cn-1(M1) Cn-1(M2)
· M2 Two partially flooded catchment
· M1
basins at stage n-1
Min H. Cho
Kyung Hee Univ. 35
Medical Image Processing (2008)
Example
Min H. Cho
Kyung Hee Univ. 36
Medical Image Processing (2008)
Example
In this case, the criterion used is not the intensity values
but the distance transform of the image
Min H. Cho
Kyung Hee Univ. 37