Optimal parameters for edge detection - IEEE Xplore

0 downloads 0 Views 642KB Size Report
rameters of the hybrid edge detector given the height of the minimum edge to be detected and the variance of the noise,. U:. The results were applied to the 2D ...
OPTIMAL PARAMETERS FOR EDGE DETECTION M. Bennamoern, B. Boashash and J. Koo * Signal Processing Research Centre, QUT, P.O. Box 2’43.4, Brisbane, QLD 4001, Australia E-mail: m. bennamoun @qut.edu.au

ABSTRACT We previously suggested a robust edge detector which relaxes the trade off between robustess against noise and accurate localization of the edges [2, 31. This hybrid detector separates the tasks of localization and noise suppression between two sub-detectors. In this paper, we present an extension to this hybrid detector [a] to determine its optimal parameters, independently of the scene. This extension defines a probabilistic cost function using for criteria the probability of missing an edge buried in noise and the probability of detecting false edges. The optimization of this cost function allows the automatic selection of the parameters of the hybrid edge detector given the height of the minimum edge to be detected and the variance of the noise, U:. The results were applied to the 2D case and the performance of the adaptive hybrid detector was compared to other detectors, such as Canny’s [l]and Deriche’s [4].

1.

INTRODUCTION

An edge can be defmed as an abrupt change in the grey level of an image. Edge detection is one of the basic units of many image processing techniques. Most techniques in pattern recognition, robot vision, stereo vision, segmentation, feature extraction, compression, require edge detection as a basic tool. As such, it is important to have edge detectors that not only detect edges accurately but are also robust against noise independently of the scene. It is noticed that, for most edge detectors, a compromise needs to be made between an accurate localization of the edges and a good immunity to noise [l]. In the case of the Laplacian of the Gaussian (LOG) detector [5, 6, 71, if U (width of the Gaussian window) is small the localization of the edges is accurate but the detector stays prone to noise. On the other hand, if U is large, the noise is efficiently removed at the expense of a bad localization of the edges. An operator with a large U will also fail when the discontinuities are spaced too close to each others 121. A way to overcome this problem is by altering the structure of the detector and to be able to automatically select its parameters. Based on work done in [9], we suggested [ 2 , 31 a hybrid edge detector combining a f i s t and a second order differential edge detectors, as briefly described in section 2 [2, 31. The *Now with BHP, Woolongong, New South Wales

0-7803-2559-1/95 $4.00 0 1995 PEEE

strategy was to look for independent indicators extracted from the signal (e.g. zero-crossings, independent measures of the strength of the edges, etc.). The indicator that has the best ability to localize and confirm the existence of an edge is used for this purpose while the others are used to help counteract the effect of noise. Parameter selection for edge detection is a major concern for an automated system. For most edge detectors, the user has to select the parameters of the detector depending on the type of image and the amount of noise it contains. Multiscale techniques have been used for this purpose, but they provide no means of relating the descriptions at different scales to one another, or of deciding which to use and when [5]. Optimal filtering methods have been suggested in [6] using regularization techniques. Other approaches such as the adaptive technique suggested in [8] have also been suggested with their disadvantages, such as their low speed performance. In this paper, the previously suggested hybrid detector [a], is extended to automatically select its parameters using a probabilistic cost function based on the probability of false detection of an edge arid the probability of missing an edge. We start this paper by a brief description of the hybrid edge detector, followed by an extensive description of the adaptive hybrid detector. The results are presented in section 4, and fmally, the conclusions are presented in the last section. 2.

THE HYBRID DETECTOR

As previously indicated, a hybrid detector, comprised of two branches [ 2 , 31, was suggested to separate or relax the trade off between localization and noise reduction. This detector is the combination of the outputs from the first order differential or Gradient of Gaussian (GoG) and the second order differential (LOG) detectors (Figure 1). The method of combination used is a simple AND operation. This detector utilizes the advantages of both the GoG and the LOG detectors. The GoG can be made robust against noise while the LOG, although prone to noise (Figure 2-a), is an accurate localizer, due to the use of zero-crossings. By combining the two sub-detectors together, as shown in Figure 1, the best of both methods of detection is obtained (Figure 2-b)[2]. We can see in Figure 2 that the hybrid detector performs better than both the first order and the second order detectors alone, in terms of localization and noise removal. This is because it takes the best features of both the first and second order detectors.

1482

WO -

-,.so

Figure 1. Block diagram of the hybrid detector and the proposed extension. Z.C represents the zero-crossings and 1.1 represents the magnitude. 3.

THE ADAPTIVE HYBRID DETECTOR

The block diagram of the adaptive hybrid detector is shown in Figure 1. In this section, we will describe and give the results of the analytical derivation of the probabilistic cost function whose optimization gives the optimal combination of U and threshold, T h . The analysis will be done for a step edge u ( t ) of amplitude A,,,, with a white Gaussian noise, n(t), of zero mean and variance ox, added to it. The relevant model edge would thus be defined as:

+ n(t)

s ( t ) = A,,,u(t) where

(1)

if t < 0 ; if t 2 0. The approach taken in developing the cost function is to first seek to maximize the probability of correct detection, i.e. the probability that an edge of minimum height Amin is present when the hybrid detector is used (Figure 1). The probability of correct detection is the probability that the magnitude of the gradient of the smoothed input signal is greater than Th., and that its second derivative has a zerocrossing when the input is s ( t ) (equation 1). The U and Th which maximize this probability are desired. We then seek to minimize the probability of false detection. The above two probabilities are then combined to form a cost function in such a way that its maximization gives the combination of U and T h which optimizes the performance of the hybrid detector. &i,u(t)

3.1.

=

{

mtn

Part 1: Finding the Probability of Detecting an Edge for the Signal Noise Case

+

In the following, a number of assumptions are made to make this analytic analysis possible. They are as follows: (1) The noise is additive white Gaussian noise, with zero mean and a standard deviation U,, and (2) The first, second and third order differentials of the noise component of the signal, are jointly normal. The output of the filtering with the Gaussian operator is:

+ A(t)

s

o

u

o

(4 (b) Figure 2. Using a signal composed of two step edges with additive noise (not shown). (a) The edges detected by the first and second order differential detectors are represented on the top and bottom graph, respectively. Notice the inaccurate localization when using the first order detector and the proneness to noise of the second order detector. (b) the results of the hybrid detector. The probability of detecting an edge for the hybrid detector can be defined as the AND of the two events ,A, and B,. The occurrence of a zero-crossing of the signal i ( t ) is event A , and the signal i ( t )exceeding the threshold T h is event

Bs. Now we seek to use the joint density function to define the equation for the probability of the event A , n B,. Note that our signals of interest are non-stationary. We wish to find the probability that the magnitude of 2 ( t ) exceeds the threshold T h , and the signal.i(t) has a zero-crossing in a small interval To. The signal i ( t ) ,in equation 4, shows that the magnitude of this signal will be at its largest when the function G ( t ) is at its maximum. The highest probability of detecting an edge is then located in an interval TO.The Gaussian function G ( t ) is at its maximum at t = 0 and thus, we choose to centre our interval TOaround the location t = 0. Since we are only interested in the signal S(t) in a small interval.To centred around t = 0, we can assume that the signals 2 ( t ) and i ( t ) are mean stationary in that small. interval TOwith means q = A,,,G(O) and r j = A,,,G(O) respectively. Specifically, we are interested in the probability that the magnitude of the signal g ( t ) , which is stationary in the interval TO,with mean q = A,,,G(O), will exceed.the threshold T h , and the signal i(t),with mean zero ( G ( 0 ) = 0), will have a zero-crossing. Since these probabilities are evaluated in a small interval To, we can assume stationarity of the signals under consideration. For the same reason, we can also assume that the edges are accurately localized. For clarity, let us make a change of notation for the signal i ( t ) to [ ( t ) . The higher order differential i ( t ) is then repand so on. Thus, the signal [ ( t ) and its resented by differentials, in the small interval TOcentred at t = 0, are:

i(t),

where A ( t ) is the filtered noise. Using the distributive properties of convolution, the first order differential of 2 ( t ) is:

S(t) = A,;,G(t)

.

[(t) =

g(t) = g ( t )

(4)

1483

+ A,;,G(O)

fi(t)

+ Am,,G(0)

-2 -

To 2

(5)

(6)

{(t) =

+

i2(3)(t) A m t n G ( 0 )

(7)

where h ( t ) represents the filtered noise, k(t) its differential, and h ( 3 ) ( t )its third order differential with respect to t . It is noted that the down crossing, in an interval dt, of the zero-level by the signal [ ( t )can be defined as follows:

i(t)> 0 > i(t+ d t )

(8)

If we then keep the interval d t small enough, the line segment going from [ ( t ) to [ ( t + d t ) can be considered a straight

To fully meet our requirements for our event of detecting an edge using the hybrid detector, the magnitude of the signal [ ( t )must be above the threshold Th. This is equivalent to the signal [ ( t ) being above the positive threshold Th or being below the negative threshold -Th. We let the two thresholds be represented by two arbitrary levels 261 and u2 where u1 < 262. The region of the joint density function which would correspond t o our probability of a zero-crossing of the signal [ ( t ) and the signal ( ( t ) being below the lower threshold u l can be represented by simply integrating equation 13 with respect to [ ( t )from -co to u1.

i(t).

Then the above inequality can be reline with slope written as follows [2]: 0

< i(t)< - i ( t ) d t

(9)

The inequality above is the same as the one obtained by Rice ([lo], section 3.3). It is simply stating that a t any time t , given a signal with slope i ( t ) , we can be guaranteed of a zero-crossing, if the signal lies between the limits 0 and - i ( t ) d t . Given the joint probability density function of the signals ( ( t ) , and i(t),namely p ( [ , ( , i ) , the region of that joint probability density function corresponding to a down crossing of the zero level is obtained by the following integral [2]:

i(t)

i(t)

A similar integration can be done .to obtain the instantaneous probability that the signal [ ( t ) has a zero-crossing and that the signal [(t) is above the larger threshold 112 by simply integrating equation 13 with respect to ( ( t )from 262 to Co.

i(t)

Ptd = fm

ydt P(t,

ili ) d i d i

where Pld is the instantaneous probability that the signal [lo, 111. After some mathematical manipulations [2], it can be shown that,

[ ( t ) has a down-crossing of the zero-level

Pzd

=dtS_k

It(t)b([io,$)&

< i(t)< 0

(11)

It can also be shown that the instantaneous probability that the signal [ ( t ) will have an up crossing of the zero level a t time t in an interval d t is [a]:

J-m

Because the two events of the signal [ ( t ) being below the level u1 and being above the level 262 are mutually exclusive, the instantaneous probability of the signal [ ( t ) being below u l or above 262 is simply the sum of the instantaneous probabilities of the two above events P,(A, n B,1) and P,(A, n Bu2) from equations 14 and 15 respectively, which can be approximated by [2]:

(10)

The above expression is the.expression of the instantaneous probability that the signal [ ( t )will have a down crossing of the zero level at time t . The same can be done for the up crossing, which in this case results in the inequality [2]:

-i'(t)dt

Ju2

J--00 J - m

The above expression is the probability of detecting an edge using the hybrid detector given the three signals [ ( t )= i ( t ) and = $t) and so on. What remains to be worked out now are the joint density function p([, () and the integrals in equation 16.

i(t)

3.1.1.

i,

The Joint Probability Density Functzon and its Integrataon

The joint probability density function of the signals [ ( t ) ,

Now we can write down the expression for the instantaneous probability that the signal ( ( t )will have a zero-crossing at time t , as the sum of the instantaneous probabilities of the up and the down crossings given in equations 10 and 12, respectively. This can be done because the two events, up crossing and down crossing are mutually exclusive. Hence, the instantaneous probability of a zero-crossing P , ( A , ) a t time t , is simply the sum of P l d and Pzu[a], i.e.,

i(t)= 0 and $ ( t ) ,assumed to be jointly,normal, with means A,,,G(O), dL0,

J-W

1484

Am,,G(0) = 0 and A,,,G(O), respectively, is

$1 g;ven by ['?I:

XO, Xz and by [ll]:

Ad

P ( A , n B,) needs to be minimized. It was implemented using Matlab.

axe the entries of the covariance matrix given A0

A=[:2

0

2

:.I

-Xz

By setting the threshold Th = 0, thus ~1 = 212 = 0, it can be shown [2] that the resulting probability is simply the probability of a zero-crossing in a small interval TO,whose equation is given in ([ll],Equation 10.3.1):

(19)

Replacing the expression of equation 17 in equation 16 and integrating [2], we get an approximate expression of the probability of detecting an edge in a small interval TO centred at t = 0, P ( A , n B,), given by:

P(An) W

where Amin is the minimum height of the edge to be detected, the function G ( t ) is the Gaussian function defined by: 1 -2G ( t ) = -e 2-2 (21)

I

00

.

ID

.

Im

.

le

.

Im

l

.

*a ?a

.

1J&

.

4m

.

4 s

+fi

J

m

U&

(a)

T e r m l is given by [2]:

(b)

Figure 3. (a) The corrupted signal at the top and the detected edges below. (b) The cost function obtained for nn = 30, r] = 0.75 and Amin = 100. When the cost function was maximized, the resulting = 0.5 and T h = 42. \

I

and Term2 is given by [2]:

. . I

171:

is given by [2]:

(24)

where erf is the error function [2]. The probability in equation 20 was implemented using Matlab and the integral 17 was evaluated using the numerical integrator 'quad8' from Matlab. 3.2.

Part 2: Finding t h e Probability of Detecting

a n Edge for t h e Noise only Case The probability of detecting an edge for the noise only case can simply be obtained by setting the minimum height parameter A,,, to 0 in equation 20, and 22 to 24 [2]. The probability of detecting an edge in the noise only case (probability of false detection using the hybrid detector) becomes then [a]:

P(A,nB,)

To { &Term1

3.3. T h e Final Cost Function We wish to minimize the probability of detecting an edge in the noise only case P ( A , n B,), which can otherwise be thought of as the probability of false detection. At the same time, we want to maximize the probability of detecting an edge in the signal plus noise case P ( A , n B,) which can be thought of as the probability of correct detection. The minimization of P ( A , n B , ) is equivalent to a maximization of the complementary probability 1 - P ( A , n B.), which is the probability of noise suppression. Thus, we seek to maximize the sum of the two probabilities, P ( A , n B,) and 1 - P ( A , n B,), with a weight put on each of them. This weight is such that, it emphazises either the suppression of noise or the detection of edges. Note that the accurate localization of the edges is always maintained by the structure of the hybrid detector, through its use of the zero-crossings. The cost function to be maximized can then be written as follows:

C F = q P ( A , n B,) - (1- q)[l - P ( A , n B,)]

2nul.6

(25)

5 r] 5 1

(27) The parameter r] is the emphasis parameter and it is limited between 0 and 1. When q is 1, the above cost function becomes just P ( A , n B,). When q = 0, the cost function is just 1 - P ( A , n B n ) , which means that all the emphasis is placed on suppressing the noise and the detection of edges is neglected. Choosing r] around 0.5 will result in a combination of U and Th which will try to balance between suppressing noise and detecting edges. 4.

- fiTerm2 }

0

RESULTS

4.1. T h e 1D Case All the results were performed on the same signal which

1485

contains an edge of height 100 at location t = 250. This signal was first corrupted with Gaussian noise of standard deviation un = 45. In Figures 3 to 5, the corrupted signal is shown on the top of every figure and the resulting edge is shown at the bottom of the figure. The cost function, shown on the right, was maximized, and the resulting combination of and Th was then used to detect the edge in the signal. It can be seen in those figures that the cost function is different for each r ) which in turn results in a different combination of U and Th. Figures 3 and 4 show mr

.

J~lCan(u~q*IC*m".'mltr-o I

,

,

,

I

,

,

,

,

-6-

-.(JITo.o5l*l.>m

Figure 5. (a) The corrupted signal at the top and the detected edges below. (b) The cost function obtained for U, = 60, r) = 0.25 and A,,, = 100. When the cost function was maximized, the resulting u = 1.8 and Th = 20. relationship between q and the SNR will be elaborated on in future work. Table 2. Table for u, = 45, Amin = 100 for values of steps of 0.25.

(bl

(a)

Figure 4. (a) The corrupted signal at the top and the detected edges below. (b) The cost function obtained for mn = 45, r) = 0.5 and A,,, = 100. When the cost function was maximized, the resulting U = 0.5 and Th = 71. the original signal corrupted with a white Gaussian noise with un = 30, and 45 respectively. In both cases, the edge has been accurately detected. With a higher level of noise, as shown in Figure 5, where U, = 60, the edge has been correctly detected. However, a couple of other false edges have also been detected. This is due, on one part, to the high level of noise, but also to the choice of r). In this last case, 17 was chosen to be equal to 0.25. In which case, a high emphasis has been put on the noise suppression.

If we reduce further the value of r ) , we might eliminate more noise but also loose the true edge. These results are excellent when we compare the magnitude of the edge, which is equal to 100, to U, = 60. As a result for extremely low signal to noise ratio, there is still a compromise between immunity to noise and accurate detection, but this time controlled by the choice of a single parameter, r). This is similar to the result in [8], where the authors had to heuristically choose a relaxation parameter, and a stabilizing constant whose role is to balance between smoothness and accurate detection. For this purpose we analyzed the effect of the Table 1. Table for steps of 0.25.

U,

= 30, A,,,

= 100 for values of

r)

in

I

0

28 71 37 60

I

C F Max 0.6795 0.6363 0.6905 0.8157 1

in

I P(Det.) I P(false Det.)

I

0.6795 0.6322 0.5109 0.3152 0

I

0.5033 0.3514 0.1299 0.0177 0

4.2. T h e 2D Case The same analysis and the mathematical derivations in the 2D case are more cumbersome, and will be the subjects of further investigation. However, a simplified extension of the 1D case to images was obtained by applying the 1D results to the profiles of images and, the values obtained for the 1D case were used on some of the 2D images. A Comparison with Canny's and Deriche's detectors was performed.

We used two images, which are the F16 image corrupted with noise mn = 45, and the bunch of peppers corrupted with the same level of noise, shown in Figure 6. Some of the results are shown in Figures 6 and 7 . It looks from these results that the use of the hybrid detector and the optimization of the 1D cost function gives good results in the 2D case. The edges are accurately localized with thin line segments, and the noise is efficiently removed. The Table 3. Table for un = 60, Amin = 100 for values of steps of 0.25. V

1 0.75 0.5 0.25

0.1649 0.0834 0.0324

0.0

choice of on the results. The results for different values of u n rA,,, and r ) are given in tables 1, 2, and 3. The

I Th I

V I U 1 I 0.5 0.75 0.5 0.5 0.5 0.25 1 0.0 5

p7

I

1

U

0.5 0.5 0.5 1.8 5

I

I

Th 0 0 87 20 17

r)

in

I C F Max I P(Det.) 1 P(false Det.) I 0.6049 I 0.6049 I 0.5033 0.5779 0.6176 0.7869

0.6049 0.3898 0.1804

0.5033 0.1546 0.0109

1

0

0

results in Figure 6 and 7 were obtained by repeatedly trying different values of Amin for a fixed nn = 45 and p7 = 0.25.

1486

It can be seen that the hybrid detector, using the U and Th chosen by the cost function resulted in quite good results, considering that no hysteresis thresholding or other post detection techniques were used. The above results were compared to the results of Canny’s and Deriche’s detectors, using the same images and the same levels of noise [2]. The results of the adaptive hybrid detector were far better than Canny’s [l]or Deriche’s [4] detectors, shown in Figure 8.

(4

(b)

Figure 8. Edge maps of peppers image with no noise using (a) Canny’ detector (b) Deriche’s detector. Although Canny’s detector seems to detect more details, Deriche’s results look cleaner and more natural. Canny’s results seem to have ragged looking edges. Nonetheless, both detectors seem to give unecessary details as opposed to the results of Figure 6-b. [a] M. Bennamoun, Ph.D. Thesis, to be submitted, Queensland University of Technology, Australia,

Figure 6. (a) The original Peppers image corrupted with noise = 45. (b) Output of the 2D hybrid detector using U = 1.4 and Th = 23. The values were obtained by optimizing the cost function to detect a minimum edge of Amin = 85 corrupted with noise un = 45.

[3] A. A. Masoud, M. Bennamoun, M. M. Bayoumi, “An M-D Robust Edge Detector”, IEEE Workshop on Visual Signal Processing and Communication, VSPC 91, June 6-7, Hsinchu, Taiwan, 1991 pp. 222-225.

U,&

5.

[4] R. Deriche, “Using Canny’s Criteria to Derive a Recursively Implemented Optimal Edge Detector”, International Journal of Computer Vision, Kulwer Academic Publishers, Boston, 1987, pp. 167-187.

CONCLUSIONS

An adaptive probabilistic technique to automatically select the parameters of a hybrid, first and second order differential edge detector independently of the scene, has been developed. The very low SNR shows that this technique is very robust against noise. I t also gives very accurate localization of the edges due to the use of zero-crossings. With this technique the uncertainty principle [I, 51 or the compromise between robustness against noise and accurate localization is relaxed. Some results in the 1D and 2D cases have been reported.

[5] J. Babaud, A. Witkin, M. Baudin, and R.O. Duda, “Uniqueness of the Gaussian Kernel for Scale-Space Filtering” IEEE PAMl-8, No. 1, 1986, pp.26-33. [6] D. Geiger, and T. Poggio, “An Optimal Scale for Edge Detection” MIT, Technical Report, No. 1078, Sep. 1988. [7] V. Torre, and T.A. Poggio, “On Edge Detection”, IEEE PAMI-8, NO. 2, 1986, pp.147-163. [8] H. Jeong, C. 1. Kim, “Adaptive Determination of Filter Scales for Edge Detection”, IEEE PAMl-14, No. 5, May 1992. [9] I.Y., Hoballah and P.K. Varshney, “An Information Theoretic Approach to the Distributed Detection Problem”, IEEE Trans. on Info. Theory, Vol. 35, No. 5 Sep. 1989, pp. 988-994

[lo]

S. 0. Rice, “Mathematical analysis of random noise”, Bell Systems Tech. Journal, V24(1945) pp. 146-156.

[ l l ] H. Cramer, “Stationary a n d Related S t O C h Q S t i C Processes”, New York : John Wiley and Sons, Inc. 1967. Figure 7. hybrid output of F16 image corrupted with noise with g n = 45, (a) Anin = 70, U = 2.1, T h = 13, probability = 0.14 (b) Amin = 85, m = 1.4, Th = 23 and probability of detecting the minimum edge was P = 0.22.

REFERENCES [l] J. Canny, “A Computational Approach to Edge Detection”, IEEE PAMl-8, No. 6, Nov. 1986.

1487

OPTIMAL PARAMETERS FOR EDGE DETECTION M. Bennamoun, B. Boashash and J. Koo Signal Processing Research Centre, QUT, P.O. Box 24.94, Brisbane, QLD 4001, Australia E- mail: m. benn amoun @gut.edu .a u We previously suggested a robust edge detector which relaxes the trade off between robustess against noise and accurate localization of the edges [2, 31. This hybrid detector separates the tasks of localization and noise suppression between two sub-detectors. In this paper, we present an extension to this hybrid detector [Z] to determine its optimal parameters, independently of the scene. This extension defines a probabilistic cost function using for criteria the probability of missing an edge buried in noise and the probability of detecting false edges. The optimization of this cost function allows the automatic selection of the parameters of the hybrid edge detector given the height of the minimum edge to be detected and the variance of the noise, ai. The results were applied to the 2D case and the performance of the adaptive hybrid detector was compared to other detectors, such as Canny’s [l] and Deriche’s [4].

1488