You are on page 1of 4

7x4 IEEE TRANSACTIONS ON IMAGE PROCESSING, VOL. 5 , NO.

5, MAY 1996

Automatic Gradient Threshold Gradient Squared Histogram


0.012
Determination for Edge Detection

Peter V. Henstock and David M. Chelberg

Abstract-We describe a method to automatically find gradient thresh-


olds to separate edge from nonedge pixels. A statistical model that is
the weighted sum of two gamma densities corresponding to edge and
nonedge pixels is used to identify a threshold. Results closely match
human perceptual thresholds even under low signal-to-noise ratio (SNR)
levels.

I. INTRODUCTION
This paper describes a model-based method for accurately and
automatically determining a threshold that separates edge pixels from
nonedge pixels for intensity images. Since the general definition of
edges as sharp intensity changes over a small area of an image
does not lend itself to a specific mathematical formula, many edge-
detection algorithms have been used [I]. This paper focuses on the
enhancemendthresholding method of edge detection, since it is the
most common in practice [2], [3]. Convolving an operator with the
image yields a gradient value that is proportional to the degree of
contrast under the operator. The determination of a threshold, which
decides between edge and nonedge pixels in the image, is very
difficult since it may depend upon the application, the source of the
image, and the subjective perception of the viewer. 0.012-1
The threshold decision for a gradient histogram is similar to the
automatic segmentation problem where grey scale or color can be
used to classify pixels. Such methods generally place the threshold
at the minimum value between two peaks of the histogram (Fig.
1), relying on the modality, shape, or moments of the classes in
the histogram [4], [SI. However, this is not effective for gradient
histograms, as they typically do not have two distinct peaks (Fig. 2).
Past approaches in edge evaluation suggest selecting a threshold that
optimizes various edge attributes such as continuity, edge location,
and classification error [l], [6], [7], but these are not well suited for a
wide range of images. Techniques such as the p-tile [SI, which assume
a fixed percentage of edge pixels a priori, produce only a rough
estimate, since the percentage strongly depends upon the image and
noise present.
"0 100 200 300 400 500 600 700 800
Gradient Squared
11. THEFIVE-PARAMETER
EDGEMODEL
Our approach employs a statistical classification based upon a Fig. 2. Typical histogram for edge thresholding with the estimated densities
five-parameter model that fits the sum of edge and nonedge density of the nonedge and edge pixels.
functions to the original histogram. Assuming a normal distribution
of intensity contrasts for edges and nonedges in the intensity image, to the initial histogram is the sum of a gamma density representing
the edge operators produce a gradient squared value that could be the edge pixels and a gamma density representing the nonedge pixels
modeled as a noncentral chi-squared distribution. However, due to the and weighted by the edge to nonedge pixel ratio PO, which can be
computation involved with this distribution, we modeled the gradient formally written as f ( x I n o , / & ) p o + f ( z I a l , P ~ ) ( l - p o )(Fig. 2).
values with a gamma distribution. The gamma distribution fits this By accurately estimating the five parameters of this model, we can
assumed model of gradient values well (x' : p < . O l ) , thus validating statistically determine a threshold to distinguish between edges and
the use of this approach. The overall five-parameter model tbat is fit nonedges using a ML (maximum likelihood) or MAP (maximum a
posteriori) criterion 161.
Manuscript received August 31, 1994; revised August 28, 1995. This work
was supported by the NSF under Grant no. IRI-9011421. The associate editor
coordinating the review of this manuscript and approving it for publication 111. DESCRIPTION
OF THE PARAMETER CALCULATIONS
was Prof. William E. Higgins.
The authors are with the School of Electrical Engineering, Purdue Univer- Using our model, there are several different methods of estimating
sity, West Lafayette, IN 47907 USA (e-mail: dmc@ecn.purdue.edu). the five parameters. Global descent methods that try to estimate all
Publisher Item Identifier S 1057-7149(96)03169-7. five parameters simultaneously were found to be too computationally

1057-7149/96$05.00 0 1996 IEEE


IEEE TKANSACTIONS ON IMAGE PROCESSING, VOL. 5 , NO. 5, MAY 1996 785

Fig. 3. Battery of 16 images of varying scenes. Moving left to right starting Fig. 4. Thresholded images using our model
at the top, the images are: Umas House scene; X-ray skull image; Bethl;
Conlact: Crowd; Dilts; Synthetic Dragon Cartoon; Flir Images of a Truck:
Gih; Girl2; Jo; John: Satellite Image of Earth; Madonna quantized to a few Since it is difficult to accurately estimate the parameters for two
grey levels; Text Scan; and Im16. densities simultaneously from their sum, we divide all the points in
tlhe histogram into two nonoverlapping groups. Again using the EM
expensive. Instead, we divided the parameter estimation problem algorithm formulation, we compute a ratio function of the densities
into two algorithm steps, which is similar to the EM (expectation- weighted by po at each point of the histogram, defined as
maximization) algorithm (81, [91 and significantly reduces the search P O x densityO(i)
ratio(i) =
space. po x densityO(i) +
(1 - P O ) x densityl(i)
The first step, which we will refer to as “alpha-beta estimation,” where density0 and density1 are the reconstructions of the gamma
attempts to find the CY and B parameters of both the edge and
densities given the estimates of the Q and )?! parameters from the
nonedge density functions. The second step, “percentage estimation,” most recent estimation. From this ratio function we form two new
computes the p o ratio of edge and nonedge pixels in the image. These
density estimates
two steps are performed alternately until the parameters converge or
no progress is made. densityd(i) = histogram(i) x ratio(;)
1) Initial p,” = 88%
2) Initial alpha-beta estimation (p;) returns a,“,(?; a t . ,!!I:
densityl‘(i) = histogram(2) x (I - ratio(i))
3) Overall estimation loop {
percentage estimation (a,“:&, CY:, a:) updates TI;+’ firom which new 0 and 13 parameters can be more easily estimated.
alpha-beta estimation ( a ; /$, a ; ,
~ a,“,pi+’) We compared five different methods for estimating the 01 and 4
returns ck:+J , p + 1 n.h+l, fiF+l
parameters of each density: the method of moments [lo], maximum
,io > 1
I: = k + 1 ] likelihood (ML) [lo], and a two-parameter Powell descent algorithm
where the I; denotes the iteration number. using the dl-d3 distance measures 1111. As will be discussed later,
Before defining the algorithms, we had to define a “best fit” of the maximum likelihood proved the most effective. The maximum
the model to the data. We used three distance measures that provide likelihood estimates are the parameter values for which the density
a measure of how well the model histogram vector U^ fits the actual functions (density0’ and d e n s i t y 1’) written
data histogram vector y, as follows:
d l : the absolute distance error given by E, I y? - 2, I
d2: the squared error given by C,(:y& -. x ~ ) ~
d3: the area between the curves using a trapezoidal approxima-
achieve a maximum value. The ML estimates can be calculated by
tion.
taking the log of the density function and setting its partial derivatives
While the measures are strongly correlated, they represent different
with respect to Q and ,3 equal to 0, as follows:
accuracies and computation speeds, and vary with the amount of
noise present.

A. Alpha-Beta Estimation and

Given the histogram and the PO parameter, this step estimates


the N and , j parameters for each density (four parameters total).
186 IEEE TRANSACTIONS ON IMAGE PROCESSING, VOL. 5 , NO. 5 , MAY 1996

B. Percentage Estimation
The percentage of nonedge pixels po determines the relative
weights of the two densities that sum to the gradient histogram. Four
different algorithms were compared for the percentage estimation of
nonedges. Three of the algorithms use the golden section descent
algorithm, a 1 -D minimization method based on the bracketing of the
minimum value, with the distance measures d l through d3 [ I l l . The Fig. 5. Images thresholded at 27, 39, 57, and 128 gradient units for subjective
fourth algorithm employs the EM algorithm on a Bernoulli estimate decisions. The computed threshold is the second image.
of the ratio. The latter algorithm, which proved to be the best, can
be described for a histogram of length n as shown at the bottom of
the page.

C. Threshold Determination
Given two overlapping densities, there are several methods of
determining a threshold. We considered the MAP, ML, and fixed
percentage po decision thresholds, which are the most common in Fig. 6. Synthetic images with added white Gaussian zero-mean noise of
practice. Of these three methods, the MAP threshold, which decides variances 1.0, 128.0, 1024.0, and 4096.0.
that an edge is present when d e n s z t y l x (1- P O ) > denszty0 x PO,
proved the most accurate.

IV. EXPERIMENTS
Two different techniques are used to analyze the effectiveness
of our model. In the first experiment, 16 diverse images are pro-
cessed with the different algorithms and the computed thresholds are
compared with the subjective edge threshold decisions made by five Fig. 7. Thresholded synthetic images with added white Gaussian zero-mean
researchers. The second experiment evaluates the robustness of the noise of variances 1.0. 128.0, 1024.0, and 4096.0.
model to different noise levels applied to a synthetic image.

A. Data Preparation
To evaluate the parameters, the images are converted into a
histogram prepared by smoothing with a 3 x 3 Gaussian filter [12],
applying the Sobel operator [13], and forming a normalized histogram
of the gradient units. Although our model can utilize any differential
or gradient-based operator with similar results, only the 3 x 3 Sobel
operator is employed since it is effective in the presence of noise and
is widely used 161.

B. Computed and Subjective Thresholds


The purpose of the subjective analysis is to find out how well
the computed threshold compared with the subjective perceptual
determination of edges. Using the human visual system as the
standard of edge detection [ 141-[18], five subjects with experience in
computer vision were asked to interactively adjust the edge threshold Noise Var = 128.0
to match their idea of a “best” edge for the original image. Using the ._
AA

area of the histogram between the average subjective threshold and


each computed threshold, we found the ML estimate in conjunction
OOY+$-- 40 ?%
;70-=-1;
Gradient Value
180 io
with the Bernoulli EM and MAP threshold to be the most effective Fig. 8. Normalized histograms for the synthetic image under three different
algorithm of those in Section I11 for the 16 images with an average added noise variances.
difference of 0.0618 with variance of 0.0019. Examples of the
thresholded images are shown in Figs. 4 and 5. values increase with the noise level (Fig. 8), the thresholds must
also increase accordingly for the model to work. Fig. 9 shows the
C. Robustness to Noise classification errors based on perfect classification at the c2=1.O.
To test the robustness to noise, we added !V(O.c) noise to a The total classification error is low (< 0.1) until c2 = 512, which
synthetic image with n2 ranging from 1.0 to 4096.0 and calculated corresponds to a SNR for the lowest contrast edges of 3.0, at which
the threshold at each noise level (Figs. 6 and 7). Since the gradient point the Sobel operator becomes less effective as an edge detector.

1 p: E, densityO(j)
pi+’ = histogram(i)
-
n pk E,densityO(j) + (1 - pi) E,densityl(j) ’
IEEE TRANSACTIONS ON IMAGE PROCESSING, VOL. 5, NO. 5 , MAY 1996 787

’r M. Tanaka and T. Katayama, “Edge detection and restoration of noisy


images by the expectations-maximization algorithm,” Signal Processing,
09- vol. 17, pp. 213-226, 1989.
A. P. Dempster, N. M. Laird, and D. B. Rubin, “Maximum likelihood for
08- incomplete data via the EM algorithm, J. Royal Stat. Soc., vol. B-39,
pp. 1-38, 1977.
0.7-
G. Casella and R. L. Berger, Statistical Inference. Pacific grove, CA:
Wadsworth and Brooks/Cole, 1990.
W. H. Press, S . A. Teukolsky, W. T. Vetterling, and B. P. Flannery,
Numerical Recipes in C. Cambridge, UK: Cambridge University Press,
1992.
V. Torre and T. A. Poggio, “On edge detection,” IEEE Trans. Pattern
Anal. Machine Intell., vol. PAMI-8, no. 2, pp. 147-163, March 1986.
0.4 A. Rosenvfels and A. C. Kak, Digital Picture Processing, vol. 2. New
0
I -
c
York: Academic, 1982.
Type ll Error
,,‘ , /
A. Sha‘ashua and S. Ullman, “Structural saliency: the detection of
globally salient structures using a locally connected network,” in Proc.
2nd Int. Con$ Comput. Vision, 1988, pp. 321-327.
A. Rosenfeld, “Pyramid algorithms for efficient vision,” in Vision:
01 Criding and Eficiency, C. Blakemore, Ed. Cambridge, UK: Cambridge
,,/ Type I Error University Press, 1990, pp. 423430.
J. R. Pomerantz and Kubovy, “Theoretical approaches to perceptual
organization: simplicity and likelihood principles,” in Handbook of
Noise Variance Perception and Human Performance, K. R . Boff, L. Kaufman, and J. P.
Fig. 9. Type I, Type 11, and overall misclassification errors for different Thomas, Eds., vol. 2. New York: Wiley, 1986, pp. 36.1-36.46.
noise levels using our model. A. Rosenfeld, “Theoretical techniques: pyramid algorithms for percep-
tual organization,” Behavior Research Methods, Instruments, Comput.,
vol. 18, no. 6, pp. 595-600, 1986.
G. 1:. McLean and M. E. Jemigan, “Hierarchical edge detection,”
V. CONCLUSION Comput. Vision, Graphics, Image Processing, vol. 44, pp. 350-366,
In bottom-up object recognition systems, choosing a threshold 1988.
to accurately find edge pixels in an image at the lowest level can
lead to significant computational savings at higher levels. Since
most automatic thresholding techniques do not apply to the specific
problem of edge detection, heuristic approaches are commonly used
in research. We have developed a model of edges that strongly Optimal Detection and Estimation of Straight Patterns
agrees with the subjective perception of edges consisting of the
weighted sum of two gamma densities to represent edge and nonedge Alessandro Neri
pixels. The model proved effective over a wide range of images and
performed well in the presence of noise with a SNR as low as 3.0.
After testing a number of algorithms to calculate thresholds based Abstrucf- This correspondence illustrates the optimal detector and
on the model, we recommend the ML estimate in conjunction slope estimator of straight patterns. In particular, it is recognized that the
output of the likelihood processor, constituted by the Radon transform
with the Bernoulli EM and MAP threshold for both accuracy and and a whitening filter, provides a sufficient statistic for both problems of
computational speed. Our method can be generalized to operators signal detection as well as orientation and offset estimation.
other than the Sobel, and can be used for local rather than global
thresholds by forming the histogram over selected regions of the
I. INTRODUCTION
image.
The detection and estimation of lines and straight patterns is a
classical task in machine vision and remote sensing applications.
REFERENCES Thanks to their capability of mapping lines into single points, the
Radon transform (RT) and its particular version represented by the
S. Venkatesh and L. J. Kitchen, “Edge evaluation using necessary
Hough transform (HT) [l] became very popular during the past
components,” CVGIP: Graphic. Models Image Processing, vol. 54, pp.
23-30, 1992. decades as effective tools to accomplish this task [2].
B. K. P. Horn, Robot &ion. New York: McGraw-Hill, 1985. More recently, starting from the observation that given an image
D. H. Ballard and C. M. Brown, Computer Vision. Englewood Cliffs, sequence, the space-time image consisting of consecutive frames,
NJ: Prentice-Hall, 1982. put one on top of the other, presents, in correspondence of moving
J. N. Kapur, P. K. Sahoo, and A. K. C. Wong, “A new method for gray-
level picture thresholding using the entropy of the histogram,” Comput. objects, gray value structures inclined along the temporal axis, the
Vision, Graphics, Image Processing, vol. 29, pp. 273-285, 1985. RT of space-time images has been employed for motion detection
P. K. Sahoo, S . Soltani, and A. K. C. Wong, “A survey of thresholding and estimation [ 3 ] . Starting from this principle, in [4], a search radar
techniques,” Comput. Vision, Graphics, Image Prucessing, vol. 41, pp. Hough detector, for simultaneous detection and tracking of targets
233-260, 1988.
I. E. Abdou and W. K. Pratt, “Quantitative design and evaluation of Manuscript received March 15, 1994; revised October 14, 1995. The
enhancementhhresholding edge detectors,” Proc. IEEE, vol. 67, no. 5, associate editor coordinating the review of this paper and approving it for
pp, 753-763, May 1979. publication was Prof. Robert M. Haralick.
L. Kitchen and A. Rosenfeld, “Edge evaluation using local edge The author is with the Electronics Engineering Department, University of
coherence,” IEEE Trans. Syst., Man, Cybern. vol. SMC-1 I, no. 9, pp. Rome 111, 00184 Rome, Italy.
597-605, Sept. 1981. Publisher Item Identifier S 1057-7149(96)03 167-3.

1057-7149/96$05.00 0 1996 IEEE

You might also like