Chapter 10
Chapter 10
Video
Processing
Laboratory
CH10
Image Segmentation
1
Image
Basics of image segmentation Video
Processing
Laboratory
3x3 mask
渦輪葉片 X 光 pointIVPmask
Lab., CSIE@Tunghai University
thresholding 5
Image
Line detection Video
Processing
Laboratory
2. Which orientation?
A thin line: 0 0 0 Hori. 45o Veri. -45o
121 R1=8 R2=2 R3=2 R4=2
000
zoom
• Noise 雜訊
Edge detection
method
Magnitude of 1st
derivatives ≥T
1. Sign determines
Dark or light region
2. Zero-crossing
IVP Lab., CSIE@Tunghai University 10
Image
Methods: 1st derivatives Video
Processing
Laboratory
• 1st derivatives
⎡ ∂f ⎤
⎢ ∂x ⎥
∇f = ⎢ ∂f ⎥
2-D gradient ⎢ ⎥
⎢⎣ ∂y ⎥⎦
0 .5
⎡ ∂f 2 ∂f 2 ⎤
Magnitude = ⎢ ( ) + ( ) ⎥
⎣ ∂x ∂y ⎦
∂f ∂f
≈ +
∂x ∂y
∂f / ∂y
−1
Direction = tan ( ) ∂f ∂f
∂f / ∂x
∂x ∂y
IVP Lab., CSIE@Tunghai University 11
Image
Example: Sobel filter Video
Processing
Laboratory
Original: 1200x1600
Hor.
abs
abs
+
Unwanted
Detailed
Structure !
Noisy
edges Fail to detect
Hor.
abs
abs
+
Edge detection
method 2nd derivative mask
Magnitude of 1st
derivatives ≥T
1. Sign determines
Dark or light region
2. Zero-crossing
IVP Lab., CSIE@Tunghai University 16
Image
Video
Processing
Laboratory
Edge Detection (cont.)
Laplacian-
• The Laplacian of a 2-D function f(x, y) is a second derivative defined
as 2
∂ f ∂ f
2
∇2 f = + 2
∂x 2
∂y
• The spatial mask for Laplacian is
∇ 2 f = 4z5 - (z2 + z4 + z6 + z8).
0 -1 0
-1 4 -1
0 -1 0
Image Segmentation
Image Segmentation
Sobel: horizontal
Sobel: vertical
original
Goal:找出車牌方塊
• Local processing
• Analyze pixels in a small region (3x3 or 5x5)
• Gradient magnitude:
∇ f ( x , y ) − ∇ f ( x0 , y 0 ) ≤E
• Gradient direction:
α ( x , y ) − α ( x0 , y 0 ) ≤ A
• Global processing
• Given n (edge) points in an image
• Find all possible lines by every pairs of points
• For each line, find subsets of points that close to it
Sobel: vertical
Vertical scan
Criterion:
1. Grad. mag. > 25
2. Grad. Direction
difference < 15o
Horizontal scan
Sobel: horizontal
IVP Lab., CSIE@Tunghai University 26
Image
Video
Processing
Laboratory
Global Processing via the Hough
Transform
Image Segmentation
Image Segmentation
Image Segmentation
⎧1 if f ( x, y ) > T
g ( x, y ) = ⎨
⎩0 if f ( x, y ) ≤ T
• Selection of threshold T ?
• Complex environment – illumination
• Multiple thresholds – more than one object
• Global threshold
• Local threshold
Image Segmentation
Image Segmentation
1. Select an initial T
G1 G2
• Average gray level
• Mean of max. and min. gray level
fingerprint
Image Segmentation
Image Segmentation
Eq. 10.3-6
5, P ( R i U R j ) = FALSE for i ≠ j
where P(Ri) is a logical predicate over the points in set R;
Watershed lines
Image Segmentation
Image Segmentation
Image Segmentation
Detecting changes between two image frames f(x, y, ti) and f(x,
y, tj) is to compare the two images pixel by pixel.
⎧1 if f ( x, y , t i ) − f (c, y , t j ) > θ
d ij = ⎨ ( 7 . 5 . 1)
⎩0 otherwise
Accumulative differences
A difference image often contains isolated noise. Although
the number of these entries can be reduced or completely
eliminated by a thresholded connectivity analysis, this
filtering process can also remove small or slow-moving
objects
Implementation
Consider a sequence of image frames f(x,y,t1) , ...,
f(x, y, tn)
Let f(x, y,t1) be the reference image
An accumulative difference image is formed by
comparing this reference image with every subsequent
image in the sequence