Escolar Documentos
Profissional Documentos
Cultura Documentos
Ch t 10
Chapter
Segmentation
Image
g Segmentation
g
Subdividing an image into
different regions based on some
criterion/criteria.
Ch t 10
Chapter
Segmentation
Image
g Derivatives
1. First order generally produces
thick edges
2. Second order has stronger
response to fine detail
3. Second order derivates may
produce double edges (in ramp
and step transition intensities).
4. The sign of the second
derivative indicates whether
the transition from dark to
light or light to dark
f
f ( x 1) f ( x)
x
2 f
f ( x 2) 2 f ( x) f ( x 1)
x 2
Ch t 10
Chapter
Segmentation
x y
2 f
f ( x 2, y ) 2 f ( x, y ) f ( x 1, y )
x 2
2 f
f ( x, y 2) 2 f ( x, y ) f ( x, y 1)
y 2
2 f ( x, y ) f ( x 2, y ) f ( x, y 2) 4 f ( x, y )
f ( x 1, y ) f ( x, y 1)
A point at location (x,y) can be
detected using its response g(x,y)
R(x,y)
R(x y) is the result of applying a filter
1 | R( x, y ) | T at the location x,y
g ( x, y )
0 otherwise
© 1992–2008 R. C. Gonzalez & R. E. Woods
Digital Image Processing, 3rd ed.
Gonzalez & Woods
www.ImageProcessingPlace.com
Ch t 10
Chapter
Segmentation
Line Detection
Lines are detected by
1. Finding the points of the
lines
2. Collect these points into
line.
Ch t 10
Chapter
Segmentation
Line/Edge
g Detection
1. The points along the lines do not
usually fall on an ideal line.
2. The line may not be continuous.
Ch t 10
Chapter
Segmentation
Edge
g Models
The transition from a bright intensity
to dark one, have different patterns.
Ch t 10
Chapter
Segmentation
Edgeg Models
The existence of noise complicate line
detection therefore
1. Image smoothing often contribute
to noise reduction.
2. Detection of edge points- potential
candidates for edge points.
3 Edge
3. d localization-
l li i to select
l points
i
which are actually on the lines.
Ch t 10
Chapter
Segmentation
Image
g Gradient
f
g x x
f grad ( f )
g y f
x
2 2
M ( x, y ) magg (f ) g x g y
gy
( x, y ) tan 1
gx
Ch t 10
Chapter
Segmentation
Robert operation
p
f
gx ( z9 z5 )
x
f
gy ( z8 z 6 )
y
The simplest approximation of partial
dervatives on 3x3 mask
f
gx ( z7 z8 z9 ) ( z1 z 2 z3 )
x
f
gy ( z3 z6 z9 ) ( z1 z 4 z7 )
y
Ch t 10
Chapter
Segmentation
Ch t 10
Chapter
Segmentation
Ch t 10
Chapter
Segmentation
Ch t 10
Chapter
Segmentation
Ch t 10
Chapter
Segmentation
Ch t 10
Chapter
Segmentation
Ch t 10
Chapter
Segmentation
2 G ( x, y ) 2 G ( x , y )
G ( x, y )
2
x 2 y 2
x y x y2
x2 y 2 2 2
2e 2 e 2
2
2
x y
x2 y2 x2 y 2
x2 1 y2 1
4 2 e 4 2 e
2
2 2 2
This expression is often called Laplacian of Gaussian
x2 y2
x y 2
2 2 2
(LoG)
e
2 2
4
© 1992–2008 R. C. Gonzalez & R. E. Woods
Digital Image Processing, 3rd ed.
Gonzalez & Woods
www.ImageProcessingPlace.com
Ch t 10
Chapter
Segmentation
Ch t 10
Chapter
Segmentation
Algorithm
1. Smooth image with a Gaussian
- optimizes the trade-off between noise
filtering and edge localization
2. Compute the Gradient magnitude using
approximations of partial derivatives
3 Thi
3. Thin edges
d by
b applying
l i non-maximai
suppression to the gradient magnitude
4. Detect edges by double thresholding
Ch t 10
Chapter
Segmentation
Gradient
• At each point convolve with
1 1 1 1
Gx Gy
1 1 1 1
• magnitude and orientation of the Gradient are
computed as
M [i, j ] P[i, j ]2 Q[i, j ]2
[i, j ] tan 1 (Q[i, j ], P[i, j ])
• Avoid
A id fl
floating
i point
i arithmetic
i h i forf fast
f computation
i
Canny Edge Detector 19
© 1992–2008 R. C. Gonzalez & R. E. Woods
Digital Image Processing, 3rd ed.
Ch t 10
Chapter
Segmentation
Ch t 10
Chapter
Segmentation
• Thin the broad ridges in M[i,j] into ridges that are only one
pixel
i l wide
id
• Find local maxima in M[i,j] by suppressing all values along
the line of the Gradient that are not peak values of the ridge
0 0 0 0 1 1 1 3
3 0 0 1 2 1 3 1
0 0 2 1 2 1 1 0
false 0 1 3 2 1 1 0 0
edges 0 3 2 1 0 0 1 3
2 3 2 0 0 1 0 1 gaps
2 3 2 0 1 0 2 1
Gradient Orientation
Gonzalez & Woods
www.ImageProcessingPlace.com
Ch t 10
Chapter
Segmentation
Ch t 10
Chapter
Segmentation
0 0 0 0 1 1 1 3 local
0 0 0 1 2 1 3 1 maxima
0 0 2 1 2 1 1 0
removed
0 1 3 2 1 1 0 0
0 3 2 1 0 0 1 0 depends
on condition
2 3 2 0 0 1 0 1
2 3 2 0 1 0 2 1
0 0 0 0Segmentation
0 0
Ch t 10
Chapter
0 3
0 0 0 0 2 1 3 0
0 0 2 1 2 0 0 0
0 0 3 0 0 0 0 0 false edges
g
0 3 2 0 0 0 0 0
0 3 0 0 0 1 0 1
0 3 0 0 1 0 2 0
• The suppressed magnitude image will contain many
false edges caused by noise or fine texture
Canny Edge Detector 24
© 1992–2008 R. C. Gonzalez & R. E. Woods
Digital Image Processing, 3rd ed.
Thresholding
g
Gonzalez & Woods
www.ImageProcessingPlace.com
Ch t 10
Chapter
Segmentation
Double Thresholding
g
Gonzalez & Woods
www.ImageProcessingPlace.com
Ch t 10
Chapter
Segmentation
Line Detection
Gonzalez & Woods
www.ImageProcessingPlace.com
Ch t 10
Chapter
Segmentation
Ch t 10
Chapter
Segmentation
Ch t 10
Chapter
Segmentation
Ch t 10
Chapter
Segmentation
Ch t 10
Chapter
Segmentation
Ch t 10
Chapter
Segmentation
Ch t 10
Chapter
Segmentation
Ch t 10
Chapter
Segmentation
Ch t 10
Chapter
Segmentation
Ch t 10
Chapter
Segmentation
Ch t 10
Chapter
Segmentation
Ch t 10
Chapter
Segmentation
Ch t 10
Chapter
Segmentation
Thresholding
1. Select initial estimate
2. Segment the images using T into two
groups G1 and G2
3. Compute the averages of the two
groups m1 and m2.
4. Computer a new threshold as
T = (m1+m2)/2
5. Repeat 2..4 until the difference
between two successive thresholds is
less than t.
Ch t 10
Chapter
Segmentation
Ch t 10
Chapter
Segmentation
Ch t 10
Chapter
Segmentation
Ch t 10
Chapter
Segmentation
Optimal Thresholding
L 1
p
i 0
i 1
Ch t 10
Chapter
Segmentation
Optimal Thresholding
The mean intensity of the second group is
L 1 L 1
1 L 1
m2 (k ) iP (i C2 ) iP(C2 i ) / P(i C2 ) iP (i )
i k 1 i k 1 P2 (k ) i k 1
The accumulative mean up to k The average intensity of the entire
level is k
g is:
image L 1
m(kk)) ip
i i mG (k ) ipi
i 0 i 0
L 1
mG P1m1 P2 m2 (i m) 2 pi
2
G
i 0
2
mG P1 (k ) m(k )
2
P1 (k )[1 P1 (k )]
B
Ch t 10
Chapter
Segmentation
Optimal Thresholding
We can measure goodness of the threshold at level k is
B2
2
G
L 1
Where (i mG ) 2 pi
2
G
i 0
and (mG P1 m) 2
P1 (m1 mG ) P2 (m2 mG ) P1 P2 (m1 m2 )
2 2 2 2
P1 (1 P2 )
B
(k )
B2 ((kk )
Where 2
(k )
mG P1 (k ) m(k )
2
G2 B
P1 (k )[1 P1 (k )]
The optimum threshold k* is
B2 (k * ) max ( B2 (k ))
0 k L 1
Ch t 10
Chapter
Segmentation
Ch t 10
Chapter
Segmentation
Ch t 10
Chapter
Segmentation
Ch t 10
Chapter
Segmentation
Ch t 10
Chapter
Segmentation
Ch t 10
Chapter
Segmentation
Ch t 10
Chapter
Segmentation
Ch t 10
Chapter
Segmentation
Ch t 10
Chapter
Segmentation
Ch t 10
Chapter
Segmentation
Ch t 10
Chapter
Segmentation
Ch t 10
Chapter
Segmentation
Ch t 10
Chapter
Segmentation
Ch t 10
Chapter
Segmentation
Ch t 10
Chapter
Segmentation
Ch t 10
Chapter
Segmentation
Ch t 10
Chapter
Segmentation
Ch t 10
Chapter
Segmentation
Ch t 10
Chapter
Segmentation
Ch t 10
Chapter
Segmentation
Ch t 10
Chapter
Segmentation
Ch t 10
Chapter
Segmentation
Ch t 10
Chapter
Segmentation
Ch t 10
Chapter
Segmentation
Ch t 10
Chapter
Segmentation
Ch t 10
Chapter
Segmentation
Ch t 10
Chapter
Segmentation
Ch t 10
Chapter
Segmentation