Professional Documents
Culture Documents
• Geometric events
– surface orientation (boundary)
discontinuities
– depth discontinuities
– color and texture discontinuities
• Non-geometric events
– illumination changes
– shadows
– inter-reflections
Edge Descriptors
Edge direction: perpendicular to the direction
of maximum intensity change (i.e., edge normal)
Edge strength: related to the local image
contrast along the normal.
Edge position: the image position at which the
edge is located.
Two edge pixels are linked up based upon two
criteria
2nd derivative
The first derivate of an image can be computed using
the gradient:
1 G y
Direction of the gradient vector ( x, y ) tan
Gx
f f
| || |
x y
18
An edge pixel at (x',y') is similar in magnitude
to the pixel at (x,y) if
f ( x, y) f ( x, y) E
( x, y) ( x, y) A
Approximating Gradient
(x+1/2,y)
good approximation
(x,y+1/2)
at (x+1/2,y) *
*
good approximation
at (x,y+1/2)
Approximating Gradient
0 1 1 0
1 0 0 1
g1 g2
22
Common Operators
2. Prewitt operator 3. Sobel operator
1 0 1 1 0 1
1 0 1 2 0 2
vertical
1 0 1 1 0 1
1 1 1 1 2 1
horizontal 0 0 0 0 0 0
1 1 1 1 2 1
23
Examples
Prewitt operator
24
Effect of Thresholding Parameters
Compass operator
27
Edge Detection Steps Using Gradient
29
Example
Magnitude
After thresholding
Practical Issues
• Noise suppression-localization tradeoff.
– Smoothing depends on mask size (e.g.,
depends on σ for Gaussian filters).
– Larger mask sizes reduce noise, but
worsen localization (i.e., add uncertainty to
the location of the edge) and vice versa.
smaller mask larger mask
Effect of Smoothing on
Derivates
• Choice of threshold.
gradient magnitude
• Good localization
– Detected edges must be as close as possible to the
true edges.
• Single response
– Minimize the number of local maxima around the true
edge.
Canny edge detector
• Canny has shown that the first derivative of the
Gaussian closely approximates the operator that
optimizes the product of signal-to-noise ratio and
localization.
(i.e., analysis based on "step-edges" corrupted by "Gaussian noise“)
Hough transform
Steps of Canny edge detector
Steps of Canny edge detector
(cont’d)
(and direction)
Canny Edge Detector
Non-maximum suppression
finds peaks in the image gradient
Edge map
44
Canny Edge Detector Example
(i,j)
Hysteresis thresholding
• Standard thresholding:
th
tl th
tl
Use edge
“direction” for
linking edges
Hysteresis Thresholding/Edge Linking
(cont’d)
detect zero-crossings
Properties of Laplacian
• It is an isotropic operator.
• It is cheaper to implement than the
gradient (i.e., one mask only).
• It does not provide information about edge
direction.
• It is more sensitive to noise (i.e.,
differentiates twice).
Laplacian of Gaussian (LoG)
(Marr-Hildreth operator)
• To reduce the noise effect, the image is first smoothed.
σ controls smoothing
filtering zero-crossings
Decomposition of LoG
• It can be shown than LoG can be
written as follows:
Steps
Difference of Gaussians (DoG)
• The Laplacian of Gaussian can be approximated by
the difference between two Gaussian functions:
approximation
actual LoG
Difference of Gaussians
(DoG) (cont’d)
step edge
ramp edge
Gradient vs LoG (cont’d)
f ( x , y ; s ) f ( x , y ;0 ) g ( x , y ; s )
coarse-scale fine-scale Gaussian kernel
image image with width of s
1 x2 y2
g ( x, y; s ) exp( )
2s 2s
64
Scale-Space Edge Detection Examples
fine coarse
65
Image Segmentation based on
property of similarity
f1 f3
f4
f2
f x. y T : background
No. of Pixels Object Background
0 255
T Gray Values
Dark Bright
Object Background
No. of Pixels
1 if f x, y T
g x, y f(x,y) = intensity at (x,y)
0 if f x, y T
P(x,y) = some property at (x,y)
Threshold
Types
Dynamic threshold
T is a function
of [x,y, P(x,y) f(x,y)].
In a controlled environment ( proper lighting condition)
Global thresholding is successful.
Image
T22 T23
T21
Adaptive thresholding - Local thresholding
An alternative approach to find the local threshold is to statistically
examine the intensity values of the local neighborhood of each
pixel. The statistic which is most appropriate depends largely on
the input image.
2000.00
1500.00
1000.00
500.00
0.00 i
0.00 50.00 100.00 150.00 200.00 250.00
85
T
Optimal thresholding
86
Optimal Thresholding
• p1(z): pdf of dark region.
• p2(z): pdf of bright region.
pz P1 p1 z P2 p2 z
2000.00
Background
1500.00
P2(z)
• P1 + P2 = 1 Object
1000.00
500.00
P1(z)
0.00 i
0.00 50.00 100.00 150.00 200.00 250.00
T
Optimal Thresholding
• Classifying object as background
E2 T p1 z dz
• Overall probability of error is T
ET P2 E1 T P1 E2 T
• Threshold value for minimization of error is:
E T
0
T
• so, P1 p1 T P2 p2 T
P1 z 1 2 P2 z 2 2
Pz exp exp
2 1 2 1 2 2 2 2
2 2
• General solution is: AT 2 BT C 0
A 1 2
2 2
where
B 2 1 2 2 1
2 2
2 P1
C 1 2 2 1 2 1 2 ln
2 2 2 2 2 2
1 P2
• If variances are same
1 2 2 P2
1 2 2
2 2
T ln
2 1 2 P1
• If P1=P2 (probabilities of two levels are equal)
1 2
T
2
Histogram : Approximation of actual pdf
p(z) depends upon p1(z), p2(z), μ1, μ2, σ1, σ2.
P(i ) h( i ) / N
• where h(i) is the histogram of an N pixel image
94
• The mean and variance of each group are
as follows :
T
o ( T ) iP(i ) / po ( T )
i0
255
b ( T ) iP( i ) / pb ( T )
i T 1
( T ) i o ( T ) P(i ) / po ( T )
T 2
2
o
i0
( T ) i b ( T ) P( i ) / pb ( T )
255 2
2
b
i T 1
95
• The within group variance is defined as :
W2 ( T ) 2o ( T ) po ( T ) b2 ( T ) pb ( T )
96
Greylevel thresholding
h(i)
Topt
2500.00
2000.00
Histogram
1500.00
Within group variance
1000.00
500.00
0.00 i
0.00 50.00 100.00 150.00 200.00 250.00
97
Greylevel thresholding
98
Greylevel thresholding
99
• High level of pixel miss-classification
noticeable
100
Greylevel thresholding
p(x)
0.02
Background
0.01
Object
x
0.00
o b
T
101
Greylevel thresholding
p(x)
0.02
Background
0.01
Object
x
0.00
o b
T
102
• Easy to see that, in both cases, for any
value of the threshold, object pixels will
be miss-classified as background and
vice versa
103
Greylevel clustering
• Consider an idealized
object/background histogram
Background
Object
c1 c2 104
Greylevel clustering
105
Greylevel clustering
g (1), g ( 2 )...... g ( N )
2 2 2 2
107
Greylevel clustering
1 N1
c1 g1 ( i )
N 1 i 1
N2
1
c2
N2
g
i 1
2 (i )
108
Greylevel clustering
• Re-define the new groupings
g1 ( k ) c1 g1 ( k ) c2 k 1.. N 1
g2 ( k ) c2 g 2 ( k ) c1 k 1.. N 2
109
Greylevel clustering
Repeat
c1= mean of pixels assigned to object label
c2= mean of pixels assigned to background label
g1 ( i ) c1 g2 ( i ) c2
1 N1 ( r ) ( r 1 ) 2 1 N2
( r 1 ) 2
E(r ) (r )
N1 i 1 N 2 i 1
– E(r) >0
112
Greylevel clustering
1 N1 ( r )
c1( r ) g1 ( i )
N1 i 1
N1
1
c2( r )
N2
2 (i)
g (r )
i 1
N1 i 1 N 2 i 1
113
Greylevel clustering
114
Greylevel clustering
115
Greylevel clustering
g2
g1
c1 c2
116
Let there is a small object against a vast background.
Gray labels
Three regions:
R1 R2
R3
R4
R5
Properties
5. P( Ri R j ) False for i ≠ j
Region
segmentation
• average intensity
• variance
• color
• texture
Region Merging
• Region merging operations eliminate false
boundaries and spurious regions by merging
adjacent regions that belong to the same
object.
• Merging schemes begin with a partition
satisfying condition (4) (e.g., regions
produced using thresholding).
where:
W is the length of the weak part of the
boundary
S = min(S1, S2) is the minimum of the
perimeter of the two regions.
Region merging by removing weak edges
where:
W is the length of the weak part of the boundary
S is the common boundary between R1 and R2.
Region Splitting
• Region splitting operations add missing
boundaries by splitting regions that contain
parts of different objects.
• Splitting schemes begin with a partition
satisfying condition (5), for example, the
whole image.