Professional Documents
Culture Documents
Edge Detection
Image features represent dominant and distinctive image regions.
They can be used to characterize the shape or appearances of the An edge is defined to be a sequence of pixels that border two
Slide 1 image or the objects in the images. Features include point features, Slide 3 homogeneous regions of different intensities. An edge indicates
linear features, and complex features. Features are widely used by discontinuity in image intensity function. Edge detection amounts
many different computer vision tasks including camera calibration, to locating each edge pixel (also referred to as edgel) and
stereo, object detection, tracking, recognition, and 3D determining its orientation and strength.
reconstruction.
Example
Edges may be generated from different physical sources. But the
resultant edges all exhibit various degrees of discontinuities in
Feature Detection (cont’d) image intensity.
Slide 2 Most common feature detection techniques include various edge Slide 4
detectors, point detectors including the Scale Invariant Feature
Transform (SIFT), and Harris corner detector, and complex feature
detectors like the Hough Transform for line and curve detection.
Physical Edge Sources
• different surface properties
Slide 5 Slide 7
color, reflective properties, texture
• discontinuity in distance and surface orientation
• shadows
Edge Thresholding
Edge Enhancement
Slide 10 Slide 12 Based on the response of each pixel from edge enhancement, decide
Design a filter and convolve it with the image. The result of
which pixel is edge pixel and which is non-edge pixel, yielding a
convolution should be large at edge pixels and low elsewhere.
binary edge map.
Edge Enhancement
r
∂I(c, r) 2 ∂I(c, r) 2
g(c, r) = ( ) +( )
∂c ∂r
Slide 13 Slide 15 ∂I(c,r)
∂r
θ = arctan ∂I(c,r)
∂c
1 1
and the resulting image is then convolved with a first order 1 0 −1
horizontal derivative hx , we have the classical vertical Prewitt s ∗ hx =
2 0 −2
operator, because of associative property of convolution 1 0 −1
Prewitt
1 0 −1
s ∗ hx =
1 0 −1
The vertical Sobel operator can be generated in a similar fashion
1 0 −1
1 2 1
Slide 18 The horizontal Prewitt operator Slide 20
0 0 0
1 1 1 −1 −2 −1
0 0 0
−1 −1 −1
Slide 22 Slide 24 β̂
θ = arctan
α̂
where α̂ and β̂ are estimates of α and β based on a least-squares
fitting, i.e.,
P P
rP cPcI(c, r)
α̂ = 2
r cc
P P
rP cPrI(c, r)
β̂ = 2
r rr
Design a First Order Edge Filter
A good edge kernel should yield accurate edge gradient (both
magnitude and direction) estimation. Assume the gray level in a 3
Slide 25 x 3 neighborhood can be described by a simple linear relationship Slide 27
and 342, Vol. 1).
I(c, r) = αc + βr + γ. Design a 3 × 3 edge detector that maximizes
the accuracy of the estimated image gradient, i.e. find the kernel
coefficients a and b by minimizing the variance of convolution
output.
h = ▽G(c, r)
where G = is a 2D Gaussian as
Slide 34 Slide 36
Summary of First Order Edge Enhancer
The first order image intensity derivative can be used to enhance
the edges in an image. Different versions of first order edge
enhancer (high pass filter) have been developed: Edge Thresholding
• Roberts edge enhancer, a 2x2 filter resulted from rotating the Edge thresholding identifies edge pixels from non-edge pixels based
horizonal and vertical difference operators by 45 degree. image gradients. Edge thresholding consists of two steps:
Slide 37 • Prewitt edge enhancer, a 3x3 filter resulted from convolving the Slide 39 non-maximum suppression and thresholding. Non-maximum
horizonal and vertical difference operators by an averaging suppression selects the potential candidates of edgles by identifying
smoothing pixels that are local maxima in gradient magnitude. The final edge
• Soble edge enhancer, a 3x3 filter resulted from convolving the pixels are selected from the local maxima via a thresholding
horizonal and vertical difference operators by a weighted operation.
averaging smoothing
• Canny edge enhancer or Difference of Gaussian (DoG), a 3x3
filter resulted from convolving the horizonal and vertical
Non-maximum Suppression
To decide whether a pixel A is a local maximum, we need to do
• define local by selecting a neighborhood size
Slide 38 difference operators by a Gaussian smoothing Slide 40
• search in the gradient direction of A within the defined
neighborhood. If the magnitude of A is strictly larger than
gradient magnitudes of other pixels located within the
neighborhood and in the gradient direction of A, then A is
marked as edgel candidate. Repeat for every pixel.
Non-maximum Suppression
135 90 45
A1 A2 A3
A5
A4
Edge Thresholding (cont’d)
B
A3
A
A8 A4 Edge detection with enforced orientation consistency is to examine
Slide 41 Slide 43
A2
A6
A C every pixel labeled as edge pixel. Check each one of its eight
neighbors to see if it has at least one edge-labeled neighbor whose
direction is consistent with its own orientation. If so, the pixel in
A7
A1
A7 A6 A5
C
A8
45 90 135
the output image is labeled as edge pixel. This may iterate.
The result of non-maximum supression should be a binary image
with edge pixel candidates marked as white and the non-edge pixels
marked as black (see Figure 4.5).
I(c, r) = αc + βr + γ + ǫ(c, r)
To use this technique, we must know noise variance σ 2 . We can The place where the first order image derivative of an step edge is
obtain an estimate of σ 2 via maximum is exactly the place where the second derivative of the
step has a zero-crossing. The isotropic generalization of the second
E2 derivative in 2D is the Laplacian. Laplacian of image intensity
Slide 50 σ̂ 2 = P P Slide 52
r c1−3 I(c, r) is
E 2 ∼ χ2P P 1−3 . Assume each pixel is perturbed identically and ∂2 ∂2 ∂2I ∂2I
▽2 I = ( 2
+ 2 )I = 2 + 2
r c
2 ∂c ∂r ∂c ∂r
independently,
PN 2we can obtain a more stable estimate of σ ,
2 σ̂n Note Laplacian operation does not provide strength and orientation
σ̂avg = n=1 , where N represents the N neighborhoods.
N of the edge point.
LoG X Derivative Second Order Edge Filter
2
∂2 I
Numerical approximations of ∂∂cI2 and ∂r 2 can be found in appendix
A. 2. A 3 × 3 Laplacian mask is
Slide 53 Slide 55 0 1 0
1 −4 1
0 1 0
∂2I ∂2I
Alternatively, ∂c2 and ∂r 2 can be obtained analytically with facet
fitting.
LoG Y Derivative Laplacian of a Gaussian (LOG) edge detector. The Gaussian serves
the purpose of smoothing for noise reduction. Let G be a 2D
Gaussian function, I be an image, and because of the associative
property of the Laplacian operator
Slide 54 Slide 56 ▽2 (I ∗ G) = I ∗ ▽2 G
where
∂2 ∂2
▽2 G = ( + )G
∂c2 ∂r2
∂2 ∂2 1 2
1 c +r
2
= ( 2 + 2 )√ e− 2 ( σ 2 )
∂c ∂r 2πσ
Integrated Gradient Edge Detector
Let I(c, r) be image intensity at (c, r) location, the image gradient
1 1 c2 +r2 c2 + r 2
= √ e− 2 ( σ 2 ) ( − 2) at (c, r) is
2πσ 3 σ2
∂I
∂c
To avoid the negative area of the kernel, the radius of LOG kernel ▽I(c, r) =
Slide 57 √ Slide 59 ∂I
must be larger than 2σ. In practice, to avoid truncation, the ∂r
√
width of the kernel is usually larger than W = 3 2σ. For a given direction (sin θ, cos θ), the first order directional
derivative
Let σ = 1, W=5, a LOG kernel can then be constructed using
above equation with c and r range from -2 to 2. Iθ′ = (cos θ, sin θ) ▽ I(c, r)
∂I ∂I
= cos θ + sin θ
∂c ∂r
Corner Detection from Gray Scale Image I: the Harris Corner Detector
Corners are located in the region with large intensity variations in
certain directions.
Let Ic and Ir be image gradients in horizontal and vertical
directions, we can defined a matrix C as Corner Detection from Gray Scale Image II
• in two directions Assume corners are formed by two edges of sufficiently different
Slide 66 P Slide 68 orientations, in a N × N neighborhood, compute the direction of
Ic2
P
Ic Ir each point and then construct a histogram of edgel orientations. A
C = P P 2
Ic Ir Ir pixel point is declared as a corner if two distinctive peaks are
observed in the histogram.
where the sums are taken over a small neighborhood
Compute the eigenvalue of C, λ1 and λ2 . If the minimum of
the two eigen values is larger than a threshold, the the point is
declared as a corner. It is good for detecting corners with
orthogonal edges.
Corner Detection from Gray Scale Image II
Slide 69 Fit the image intensities of a small neighborhood with a local Slide 71
quadratic or cubic facet surface. Look for saddle points by
calculating image Gaussian curvature (the product of two principle
curvatures, see appendix A 5).
Least-squares estimate
θ and θ 2
1
Slide 75
σ2
and σ2
2
Estimate 1
No
A corner
A Statistical Approach
• Problem Statement
Slide 74 x̂n
Given an arc sequence S = { |n = 1, . . . N },
ŷn
statistically determine the arc points along S that are most
likely corner points.
Approach Overview (cont’d) Noise Model
• Slide a window along the input arc sequence S. Given an observed arc sequence S = {(x̂n ŷn )t |n = 1, . . . N }, it is
assumed that (x̂n , ŷn ) result from random perturbations to the
• Estimate θ̂1 and θ̂2 , the orientations of the two arc ideal points (xn , yn ), lying on a line xn cos θ + yn sin θ − ρ = 0,
Slide 76 subsequences located to the right and left of the window center, Slide 78
through the following noise model:
via least-squares line fitting.
xˆn xn cos θ
• Analytically compute σ12 and σ22 , the variances of θ̂1 and θ̂2 . = + ξn ; n = 1, . . . , N
yˆn yn sinθ
• Perform a hypothesis test to statistically test the difference
between θ̂1 and θ̂2 . where ξn are iid as N(0, σ 2 ).
Corner Model
Xcos ^
θ + Ysin ^
θ =^
1 1 ρ
1 m th point
Σ ^ ρ^
θ,1 1
Moving window
Xcos^ ^
θ + Ysin θ2 = ^
Details of the Proposed Approach 2 ρ
2
Σ^
digital arc segment θ 2 ,^ρ
2
Slide 77 • Noise and Corner Models Slide 79
• Covariance Propagation
• Hypothesis Testing
where θ̂12 = |θ̂1 − θ̂2 |, θ12 is the population mean of θ̂12 , and θ0 a
threshold.
Covariance Propagation (cont.)
Define p
+ x2 + y 2 − ρ2 if y cos θ ≥ x sin θ
Covariance Propagation k= p
− x2 + y 2 − ρ2 otherwise
Slide 80 • Problem statement Slide 82 and
Analytically estimate Σ∆Θ , the covariance matrix of N
least-squares estimate Θ̂ = (θ̂ ρ̂)t , in terms of the input 1 X
µk = kn
covariance matrix Σ∆X . N n=1
N
X
σk2 = (kn − µk )2
n=1
Geometric Interpretation of k
Covariance Propagation (cont.)
Y
From Haralick’s covariance propagation theory, define
N
X
F (Θ̂, X̂) = (x̂n cosθ̂ + ŷn sin θ̂ − ρ̂)2 (x,y)
n=1 k
and
Slide 81 Slide 83
2×1 ∂F
g (Θ, X) =
∂Θ
then X
X ∂g(X, Θ) −1 ∂g(X, Θ) t X
= ( ) ( )
∆Θ ∂Θ ∂X ∆X
∂g(X, Θ) ∂g(X, Θ) −1 t
( )[( ) ]
∂X ∂Θ
Corner Detection Example
Slide 84 Slide 86
1 µk
X σk2 2
σk
= σ2 µk µ2k
∆Θ 1
σk2 N + σk2
Hypothesis Testing
where θ0 is an angular threshold and θ12 is the population mean of Performance Evaluation
RV θ̂12 = |θ̂1 − θ̂2 |.
• Evaluation criteria
Slide 85 Let Slide 87
Misdetection rate.
θ̂2
T = 2 12 2 False alarm rate.
σ̂θ1 + σ̂θ2
• Images: Eighty RADIUS Images
Under null hypothesis
T ∼ χ22
Conclusions
• Present a statistical approach for detecting corners on digital
Slide 92 Slide 94
arc sequences.
• Performance evaluation shows the robustness of the proposed
algorithm and its superiority over the existing algorithms.
Conclusions (cont.)
• Contributions include
Slide 93 – Explicitly introduce a noise model and a corner model to Slide 95 Scale Invariant Feature Transform (SIFT) Features
account for the image noise. See attached
– Develop an analytical method for estimating the covariance
matrix of the fitted line parameters.
The Hough Transform
• The Hough Transform (HT) is a popular technique for
detecting straight lines and parameterizable curves on
gray-scale images.
Line and Curves Detection • It was invented by Richard Duda and Peter Hart (RPI
Slide 96 Slide 98
Given an edge image, find line or curve segments present in the alumnus) in 1972
image. • It maps image data from image space to a parameter space,
where curve detection becomes peak detection problem, i.e.,
searching the parameter space for peaks.
• Check the Wikipedia on HT for more information. It includes a
citation of my prior work.
y=ax+b 5
xcos θ + ysinθ = ρ
rho
0
−5
−10
−15
0 50 100 150 200 250 300 350 400
theta
(10,10) 20
15
(20, 20)
rho
5
−5
θ −10
−15
Y −20
0 20 40 60 80 100 120 140 160 180
represents a line. For example, a vertical line my be If lines are parameterized using a and b, then an image point is
represented as (0, 4). represented by as a line in the parameter space (fig. 5.1).
2. Quantize parameters ρ and θ
To keep the parameter space finite, it is often necessary to 4. Search A(θ, ρ) for peaks
Slide 104 quantize the parameter space. By quantization, the parameter Slide 106
The image lines are therefore detected by the peaks of A(ρ, θ).
space is divided into finite grid of cells, the dimensions of each
To detect multiple lines, look for all local maxima of A(θ, ρ).
cell are determined by the quantization intervals. Each cell is
indexed by a pair of quantized (θ, ρ).
HT Coordinate Systems
An Example
• The HT coordinate system coincides with the row-column
coordinate system.
Ranges of ρ and θ
√
0 < ρ < M2 + N2
−90 < θ < 180
Slide 109 or Slide 111
√
-M < ρ < M 2 + N 2
0 < θ < 180
• The HT coordinate system locates at the center of the image
Ranges of ρ and θ
√
M 2 +N 2
0<ρ< 2 Top: An image with lines, Bottom: the display of the accumulator
0 < θ < 360 array.
or
HT for Curves
The HT can be generalized to detect any parameterizable curves
Incorporating Gradient Direction
such as circles and ellipse. For example for circle detection, a circle
If gradient direction at each image point is available, it can be used can be parameterized as
Slide 112 to restrict the range of values of θ that the image point may vote Slide 114
for. Instead of checking for all possible θ s as in the standard HT, (x − x0 )2 + (y − y0 )2 = R2
we only increase the accumulators for those lines whose
orientations are close to the gradient direction of the image point, where the parameters are (x0 , y0 ), and R. We can therefore
therefore significantly reducing the required computations. construct a 3D accumulator A(x0 , y0 , R). For each edge point vary
(x0 , y0 ), compute the corresponding R using the circle equation,
and then update A. In the end, search A for peaks.
cos θ
Another HT Technique for Circle Detection
sin θ
Slide 116 Slide 118 Given (x0 , y0 ), we can then use equation (x − x0 )2 + (y − y0 )2 = R2
θ to determine Rs for each (x0 , y0 ). Note different Rs may be
X
identified for each (x0 , y0 ), indicating concentric circles.
circle at (x, y) is
dx
= − tan θ
dy
From circle equation (x − x0 )2 + (y − y0 )2 = R2 , we have
HT for Ellipse Detection
dx y − y0
=−
dy x − x0 For a nominal ellipse (i.e., major and minor axes align with X and
Slide 117 Slide 119
Equating the above two equations yields Y axes), it can be represented as
y − y0 (x − x0 )2 (y − y0 )2
= tan θ 2
+ =1
x − x0 a b2
(x,y)
b a
τ θ
x = x0 ± q
X b2
(x0,y0 ) 1+ a2 tan2 θ
Slide 120 Slide 122 b
y = y0 ± q
a2
1+ b2 tan2 θ
a
This still, however, involves 4 parameters.
x = x0 + a cos τ
y = y0 + b sin τ
α
β
X
x x0 cos α sin α a cos τ
= + Other Efficient Ellipse Detection using HT
y y0 − sin α cos α b sin τ
One method is to scan the image horizontally and identify any
From the previous discussion, we have possible edge points on each row. For each row, identify the
b centroid of any two selected edge points. The idea is that if the two
Slide 125 tan τ = tan θ Slide 127 points happen to be on an ellipse, then their centroid must be on
a
the vertical center line of the ellipse. So, by voting, we may detect
Since θ = β − α, we therefore have the vertical center line. Similarly, if scan vertically, the horizontal
b centerline can be detected. The ellipse center is the intersection of
tan τ = tan(β − α) the vertical and horizontal center lines. Given the center of the
a
ellipse, other parameters are then determined.
where β is the gradient direction of point (x, y) in X-Y coordinate
frame.
Model Fitting
Generalized HT Given a model and some data, model fitting is concerned with
Slide 128 Slide 130
HT transform can be generalized to detect any shapes, even for estimating model parameters that could best explain the observed
those without analytic (parametric) representation. data. best may be interpreted as smallest sum of distances of all
image points to the model curve.
f (xn , yn , Θ) = Xnt Θ
Let D be a matrix as
Line and Curves Detection
Slide 141 Slide 143
X
1 Given an edge image, find line or curve segments present in the
.
D = X2 .. image.
Xn
This leads to
N
X
f 2 = (xn , yn , Θ) = ||DΘ||2
n=1
Model Fitting
Mathematically, model fitting may be stated as follows:
Issues with Curve Detection Given a vector of points X = (X1 , X2 , . . . , XN ) and model f , find
• Grouping (e.g., the Canny hysteresis thresholding procedure) model parameters Θ by minimizing
Slide 144 Slide 146
• Model fitting N
X
D2 (Xn , Θ)
They can be performed sequentially or simultaneously. n=1
Model Fitting
Distance Measures
Slide 145 Given a model and some data, model fitting is concerned with Slide 147
estimating model parameters that could best explain the observed • Algebraic distance
data. best may be interpreted as smallest sum of distances of all • Geometric (Euclidean) distance
image points to the model curve.
Distance Measures (cont’d)
Distance Measures (cont’d)
The geometric distance measure and the algebraic distance is
The algebraic distance refers to the vertical distance between point related via
Slide 148 (x̂n , ŷn ) and a point (x̂n , ŷn′ ) on the curve, where f (x̂n , ŷn′ ) = 0. On Slide 150
the other hand, the Euclidean distances refers to the distance |f (Xi , Θ)|
d(Xi ) =
|| ▽ f (Xi , Θ)||
between point (x̂n , ŷn ) and a point on the curve that is closest to
(x̂n , ŷn ). where d(Xi ) is the geometric distance and f (Xi ) is the algebraic
distance.