Of Enhancement/Thresholding: Quantitative Design and Evaluation Edge Detectors
Of Enhancement/Thresholding: Quantitative Design and Evaluation Edge Detectors
Of Enhancement/Thresholding: Quantitative Design and Evaluation Edge Detectors
II. ENHANCEMENT/THRESHOLDING
LUMINANCE
EDGEDETECTORS where @ denotes two-dimensional spatial convolution. Next,
at each pixel, the gradient functions are combined by a linear
For the purpose of edge detector design and analysis, it is or nonlinear point operator 0 (.) to create an edge enhanced
convenient to defiie an idealized luminance edge, illustrated
may
in Fig. 1, as a planar ramp discontinuity. The ideal edge can
be described by its Cartesian pixel coordinate ( j , k), orientation
Typical forms of the point operator include the root mean
ManuscriptreceivedAugust 25,1978; November 28,1978. This square (rms), magnitude, and maximum. The enhanced array
work w88 supported by the Advanced Research Projects Agency of the
Department of Defense and was monitored by the Wright-Patterson Air A ( j , k) provides a measure of the edge discontinuity at the
Force Base under Contract F-33615-76-C-1203. center of the gradient mask. An edge decision is formed on
I. E. Abdou was withthe ImageProcessingInstitute,University of
SouthernCalifornia, Los Angela, C k He is now with IBM Research the basis of theamplitude of A ( j , k) with respect to a threshold
Laboratory, San J o s e . C k ( r ) . If
W. K. Ratt is withthe ImageProcessingInstitute,University of
Southern California, Los Angela, CA 90007.
I I -I 3 3 -5
I -2 -I 3 0 -5
I I -I 3 3 -5
i ) Canpass ii) Kirsch
gradient
I 0 -I I 0 -I
I 0 -I 2 0 -2
I 0 -1 I 0 -I
iii)3-level iv) 5-level
(a)
I -I -I 3 -5-5
I -2 -I 3 0 -5
Bs I l l 3 3 3
i) Compass ii) Kirsch
gradient
0 -I -I 0 -1 -2
I 0 -I I 0 -I
1 1 0 2 1 0
iii) 3- level iv)5-level
(c)
Fig. 3. Templatematchingoperators. (a) Compassdirections. @)
Mask H,. (c) Mask Hz.
A . Differential Operators
The differential operators perform discrete differentiation of and for 3 X 3 Operators
an image array to produce a gradient field. This group includes
the Roberts (21, Prewitt [3], and Sobel (4, p. 271 I operators.
The Roberts operatoris a 2 X 2 pixel mask in which'
- -
d ( j , k) = tan-'
E::
-
:3.
0 -1
B. Template Matching Operators
=[1 01
The template matching operators are a set of masks represent-
= [-1 0
0 11.
The Prewittand Sobel operators are 3 X 3 pixel operators where
ing discrete approximations to ideal edges of various orienta-
tion. Fig. 3 givesseveralexamples for two of eight possible
compass orientations. These operatorsinclude the compass
gradient introduced by Prewitt [ 31, the Kirsch [ 5 ] , and the
Hi = [.
1 0 -1
1 0 -1
0 -c] (54
3-and5-level template masks. The latter two operators are
related tothe Prewitt and Sobel differential operators,
respectively. With these operators, the enhancement is formed
as the maximum of the gradient arrays. Thus
A ( j , k) = m v E k)JI* (8)
(5b)
The edge orientation O ( j , k) corresponds to thecompass direc-
tion of the largest gradient. For the3-level and 5-level operators,
With the Prewitt operator, c = 1 and with the Sobel operator,
the outputs GiG, k) of the fust four masks suffice t o specify
c = 2. These operators usually utilize an rms point nonlinearity
the eight possible edge orientations.
to produce an edge enhanced array
C. Discussion
A ( j , k ) = ( [ G l ( i , k ) I ' + [Gz(j,k)l')*- (64
The specific edge detectors introduced above are widely used
'Note that the masks are rotated by 1 SOo to compensate for the 180' types ofsmallmask detectors. Many other enhancement/
rotation inherent to the convolution operation. thresholding edge detectors employing different, often larger,
ABDOU AND PRATT: ENHANCEMENT/THRESHOLDING EDGE DETECTORS 155
@) (c)
Fig. 4 . Edge models for edge orientation sensitivity analysis:
(1 -tan @I1 (12 = (3 tan @ - 1)'
a1 =
8 tan @ 8tan@
(a) 2 X 2 yodel. (b) 3 X 3 model, 0 < @ < tan-' (1/3) (c) 3 X 3
model, ten- (1/3) < @ < n/4
Sobel mag. -0
0
L-
Sobel sq.root
Template matching
Prewitt sq.rooi
Roberts sq. root
Robwts mag,
P
:.=[
0
0.0
, , , wr ,
0.0 .N) A0 .60 .80 1.0
actual edge orientation, 0. rod. actual edge arientation,+,rad
Fig. 5. Edge gradient amplitude response as a function of actual edge Ag. 6. Detected edge orientation as a function of actual edge orienta-
orientation for 2 X 2 and 3 X 3 operators. tion for 2 X 2 and 3 X 3 operators.
mask functions have been proposed. Analysis and comparison Simple geometric calculations canbe performed to deter-
of these mask functions is deferred to Section VII. The inter- mine the edge gradient and detected edge orientation response
vening sections describe design and evaluation methods using as a function of actual edge orientation for the edge models of
the edge detectors introduced in this section as examples. Fig. 4 [61. Results of these calculations are presented in Figs.
5 and 6 . In Fig. 5 , the edge gradient response is normalized to
III. EDGEDETECTORSENSITIVITYANALYSIS unity for a vertical edge. 'The curves indicate that the Prewitt
Desirable properties of any edge detector are an amplitude and Sobel square root differential operators and the template
response invariance to edge orientation and a lack of bias in matching operators all possess an amplitude response relatively
orientation measurement. Edge detector sensitivity is con- invariant to actual edge orientation. TheSobeloperator
sidered here for ideal, noise-free edges. The effect of noise is provides the most linear response between actual and detected
covered in thefollowing sections. edge orientation.
Fig. 4 contains models of ideal step edges passing through Another desirable edge detector property is a rapidly declin-
enhancement masks. Pixel amplitudes under the mask vary as ing edge gradient response as the detector mask moves away
a function of edge orientation as a result of the inherent averag- from a central edge. Fig. 7 contains edge models of vertical
ing associated with discretization of the sampled image array. and diagonal edges displaced from the mask center. Geometric
756 PROCEEDINGS OF THE IEEE, VOL. 67, NO. 5 , MAY 1979
I I+ horizontal
displacement
Fig. 9. Typical
conditional
probability
density functions of edge
enhancement.
PD = P(A 2 t ledge) =I t
m
p(Aledge) dA (9)
TABLE I TABLE I1
MEANVECTOR AND COVARIANCEMATRIXOF DIFFERENTIAL M E A N VECTOR AND COVARIANCE MATRIX OF TEMPLATE
MATCHING
OPERATORS
GRADIENT OPERATORS FOR A VERTICALEDGE
Operator qg Kg
%
Vertical Diagonal 3
- ' 6 4 0 - 4 4 - 4 04-
e No-Edge
Operator Edge Kg
2 4 6 4 0 - 4 4 - 4 0
0 0 -
-2 4
h
-3 -6
-2 -4
0 0 .
Prewitt
- 2, -4
4l
3
common case of additive, independent, white Gaussian noise 0 0
will be given as an example of the design technique. -3 -8
Let f be a Q X 1 vector of pixel amplitudes lying under an 5-Level h
-4 -12
edge detector mask ( Q = 9 for a 3 X 3 mask). Vector f is
assumed to be composed of samples of an ideal edge region s -3 -8 .
plus a Gaussian noise component n of zero mean and common 0 0
variance uz . Thus 3
f =s+n. (13)
The probability density off can be written in general form as
P c f ) = Q ( f , s f , Kr>
h 02
LGN(j, k) J
be the vector formed by each of the N gradient operators. represent general terms of the mean and covariance matrices of
Then, g , respectively. In (17), Mthe k ( j ) denotesscanned
column
j t h term of the k th convolution mask. To complete the analysis,
Pk)= 9k,?g, K g ) (' 6, it is necessary to examine specific edge detectors.
Tables
where covariance
matrices
I and
and
I1vectors
list mean of
the two-componentRoberts,Sobel,and Prewitt differential
*gW =
j=1
MkW E (17a)
ponent
operators for vertical and diagonal edges and the eightcom-
template matching operators
conditional densities pand ( A ledge)
afor vertical edge. The
p(A1noedge) and the
Q corresponding detection probabilities havebeenderived [6]
Kg(k, I ) = 0' M k ( j ) Ml(i) (17b)
for
the
differential
operators. In the case of
the template
j=1 matching operators, the conditional densities are difficult to
PROCEEDINGS OF THE IEEE, VOL. 67, NO. 5, MAY 1979
0.6
0.2
0.0
0.0
-
0.2
I
0.4 0.6
I
0.8
I
1.0
0.21
0.oL
0.0 0.2 0.4 0.6 0.a 1.0
PF
(b)
10
. - 1.0
PO
0.8 - 0.8
0.6 -
0.6
0.4 - Robertsvertical
0.4
0.2
state explicitly, but the error probabilities can be determined complex edge models such as non-Gaussian signaldependent
numerically. noise. Thepattern classificationdesign procedure described
The detection performance of edge detectors can be readily in this section avoids these difficulties.
compared by a parametric plot of the correct detection prob- Edge detection can be viewed as a classical pattern recogui-
ability Po versus false detection probability PF in terms of the tion or classification problem. A pattern consisting of the
detection threshold ( t ) . Fig. 10 presents such plots for square pixels encompassed by an edge detection operatoris classified
root differential operators and templatematchingoperators as a region containing an edge or noedge on the basis of an
for verticalanddiagonaledgesand a signal-to-noiseratio’ extracted region feature, the amplitude A ( j , k) of the edge en-
(SNR) of 1.0 and 10.0. From these curves, it is apparent that hancement. Classification can be accomplished by the linear
the Sobel and Prewitt3 X 3 operators are superior to the discriminant function method [ 81 in which the edge hypothesis
Roberts 2 X 2 operators. The Prewitt operator is better than is selected if
the Sobel operator for avertical edge. But, for a diagonal edge,
w*x>o
the Sobel operator is superior. In the case of template match-
ing operators, the 3-level and 5-level operators exhibit almost and rejected if
identical performancesuperior to the Kirschandcompass
gradient operators. Finally, the Sobel and Prewitt differential
WTX <0 (18b)
operators perform slightly better than the 3-level and 5-level where w( 1) and w(2) are weighting factors of the weight vector
template matchingoperators. w = [w( l), w(2)l and x = [ A , 11‘. The weight factors are
related to the decision threshold by
v. PATTERN CLASSIFICATION DESIGNPROCEDURE
There are two difficulties with the statistical design proce-
dure described in the previous section: reliability of the Components of w can be determined by a training procedure
stochastic edge model and analytic problems associated with using a set of prototype pixel regions containing edges or no-
edges. Let } {xml , x m 2 , * * , x z ~ )
{XI, x’, * * * ,x ~ and -
‘Signal-to-noise ratio is defined as SNR = (h/u)* where h is the edge represent sets of M edge and M noedge prototypes,respectively.
contrast and u is the noise standard deviation. Then,equations(18a) and (18b) canbe reformulated as a
ABDOU AND PRATT: ENHANCEMENT/THRESHOLDING
DETECTORSEDGE 159
TABLE I11
THRESHOLD
LEVELAND ERRORPROBABILITIES FOR Ho-KASHYAP DESIGN
PROCEDURE
Vertical Edge, SNR = 1 Vertical Edge, SNR = 10 Diagonal Edge, SNR = 1 Disgonal Edge, SNR = 10
Roberts
SquareRoot 1.36 52.0 37.6 55.89 39.87 0.67 91.2 11.6 89.16 10.47 1.74 55.60 46.80 55.10 46.88 0.78 74.80 20.80 77.79 22.11
Roberts
Magnitude 1.22 52.0 38.4 55.16 39.30 0.62 90.8 7.6 89.20 9.85 2.24 54.40 46.40 ' 53.85 45.70 0.97 75.60 19.60 76.81 23.30
Sobel
SquareRoot 1.18 60.8 41.2 60.01 39.54 0.66 92.0 92.34
9.6 5.69 1.14 63.20 39.20 60.40 37.63 0.63 90.80 94.65
9.20 5.28
I I 1 I
~~
I
Rewitt
Square Root
Compass
I 1.16 59.5
36.6 60.80 38.40 0.66 93.0 3r8 91.20 4.80 1.19 61.20 39.60 59.27 38.71 0.64 90.00 8.40 93.07 6.421
Gradient 1.52 57.6 45.2 61.27 46.56 0.73 85.2 12.8 88.58 13.55 1.51 57.60 46.80 61.80 47.20 0.71 80.80 14.00 90.00 15.30
I Kirsch I 1.43 56.0 38.4 53.08 34.08 I 0.69 89.2
_ _ _
9.2
_ _
89.78
~ ~~ ~ ~
5.76
~
I 1.45~~~~~
54.40 36.00
~~
52.40 32.40
_____ ~~
1 0.79 ~
82.80 3.60 82.50 2.301
3-Level 1.16 60.8 38.4 59.02 36.92 0.65 6.4
89.6 92.64 1.16
3.79 59.20 38.40 58.70 36.50 0.61 89.60 8.40 94.60 5.60
5-Level I 1.24 58.0 37.6 58.12 36.09 I 0.66 90.8 6.8 92.45 4.90 1 1.22 60.40 39.20 59.30 37.40 I 0.65 90.00 8.40 93.10 5.40
where
1 i I N=even
integer
100 - 100 -
60 - 80 -
'C6 0
at
-
Compass gradient
0 1 I I I I I I I I I I I I I I I I I 0 I 1 I I I I I l l 1 I I I I 1 1 1 1
1.0 2.0 5.0 10.0 20.0 500 100.0 1.0 2 .o 5.0 10.0 20.0 50.0 100.6
signal-to-noiseratio signal-to-noiseratio
(a) (b)
compass gradient
I I I I 1 l 1 1 1 0 I I I I I I
I I I II I I I I l l
5.0 10.0 20.0 5ao 100.0 10
. 5
.
0 2.0 10.0 20.0 50.0 lOQ0
signal-to-noise ratio signal-to-noise ratio
(C) (dl
Rg. 13. Rguff of merit as a function of signal-to-noise ratio for 2 X 2 and 3 X 3 operators. (a) Differential operators, vertical edge. (b) Tem-
plate operators, vertical edge. (c) Differential o p e r a t a , diagonal edge. (d) Template operators, diagonal edge.
F= l ? 1
(23)
max (11,ZA} i= 1 + ad2 ( i )
where ZI and IA are the number of ideal and actual edge points,
d ( i ) is the pixel miss distance of the ithedge detected, and a is 10
. 2.0 90 no 20.0 50.0 loo0
a scaling constant chosen to be a = to provide a relative
signal-to-noise ratio
penalty betweensmeared edges andisolated, but offset, edges.
This technique can be extended to diagonal edgesas indicated Fig. 14. Figure of merit comparison between differenQal and template
in Fig. 12. Edge pixels are only counted in a centrally located matching operators.
762 PROCEEDINGS OF THE IEEE. VOL. 67, NO. 5, MAY 1979
w. EXTENDEDM A S K OPERATORS