An Optimal Edge Detector for Automatic Shape Extraction M. Sarifuddin1 , Rokia Missaoui1 , Jean Vaillancourt1 and Michel Paindavoine2 1. D´epartement d’informatique et d’ing´enierie, Universit´e du Qu´ebec en Outaouais, C.P. 1250, Succ. B, Gatineau (Qc), Canada, J8X 3X7 e-mail : {rokia.missaoui, m.sarifuddin, jean.vaillancourt}@uqo.ca, 2. Laboratoire LE2I - UMR-CNRS, Universit´e de Bourgogne, Aile des Sciences de l’Ing´enieur, 21078 Dijon cedex - France, e-mail :
[email protected]
Abstract. Detecting edges in digital images is a tricky operation in image processing since images may contain areas with different degrees of noise, blurring and sharpness. Such operation represents an important step of the whole process of similarity shape analysis and retrieval. This article presents two smoothing and detection filters which are based on a model of blurred contours and well adapted to the detection of blurred and/or noisy edges. These filters can be implemented in a third-order recursive form and offer advantages in the analysis of different edge types (sharp, noisy and blurred). Experimental analysis shows that these filters give definitely better edge detection and localization than some existing filters. Key words: Blurred edge model, smoothing filter, edge detection filter.
1
Introduction
The identification of edges inside digital images is a crucial but non-trivial operation in image processing. It is more complicated when images contain not only sharp, but also blurred and noisy regions. There are many algorithms for shape description such as Fourier descriptor [1], moment invariants, B-Spline [2], active shape models, wavelet descriptor [3] and statistical shape Analysis [4]. The objective of this article is to propose two filters: one for smoothing and the other one for edge detection. The first filter minimizes or eliminates noise whereas the second one allows edge detection in digital images. The detection filter should take into account the fact that image smoothing will result in blurred edges. For this reason, the development of the two filters is based on a blurred edge model. The rest of this article is organized as follows. Section 2 describes some existing edge detectors. The models of sharp and blurred edges as well as filter design and implementation are presented in Section 3. Experimental analysis, filter performance and conclusion are given in Sections 4, 5 and 6 respectively.
2
Edge Detectors
Sharpness of object edges during an image capture depends on the diaphragm opening, shutter speed of the camera, and the light effect in the scene. The moving objects in the
2-9525435-1 © SITIS 2006
- 696 -
scene will be blurred and the rest of the image will be sharp if the shutter speed is slow. However, the sharpness of the scene can involve noise which is more visible in dark image areas. So, we can state that, by nature, a real image taken by a photo/video camera may contain sharp, blurred, and noisy areas. Consequently, image analysis techniques have to take into account these characteristics. An edge in a given image is a set of pixels corresponding to abrupt changes of intensity value. It can be determined based on the gradient or Laplacian. The performance of a given detector is closely related to the computation time and the detection efficiency. A detector efficiency is often based on three Canny’s criteria [5]: (a) good detection: all edges have to be detected (without losing certain pixels on the edge to be found), (b) good localization: the edges have to be located in their ideal positions,and (c) low multiplicity of the response: detector does not give multiple responses or false edges. There are many factors which can influence the performance of an edge detection process in real images. They include noise, blurring and the interference between adjacent edges. Moreover, an edge can be located in a sharp area or submerged into a noisy or blurred area. The elimination of the harmful effects of these factors (e.g., noise) has lead to the development of many algorithms for edge detection such as first-order operators (Roberts, Sobel and Prewitt operators), second-order operators (Laplacian, LOG and DOG operators), multi-scale algorithms, and filtering algorithms. The method proposed in [6] uses a multi-scale wavelet decomposition. The filters of Canny [5], Deriche [7], Bourennane [8], Laggoune [9] and Demigny [10] can be included into the group of optimized filters. Each one of these detectors has its own properties and peculiarities.
3
Filter Definition
In this section we present new filters, which are based on a blurred edge model. The first part of this section will describe the edge models whereas the second one will present the proposed filters. 3.1
Model of Blurred Edges
Edge detection in an image is a very important feature in the process of object recognition and content-based image retrieval. Development of an edge detector is often based on a specific property of the image. For example, when considering the previously mentioned authors [5, 7, 10, 8, 9], each of these researchers proposes a detector that is well adapted to sharp and noisy images by a tuning of one or several parameters. Figures 1-a to 1-c represent the models of step, crest-line and impulse edges respectively, while figures 1-d to 1-f show the blurred version of the previous edge models. In our case, we select Figure 1-e as a blurred edge model. According to its plot, the model of a blurred crest-line edge can be mathematically represented by a function C(x) (Equation 1) with two normalizing constants K and λ, the blurring parameter β and the scale parameter α related to noise. The value of the blurring parameter β varies
- 697 -
Fig. 1. (a) step edge, (b) crest-line edge and (c) impulse edge. (d) Blurred step edge (ramp edge), (e) blurred crest-line edge and (f) blurred impulse edge.
Fig. 2. (a) Model of blurred crest-line edges, (b) Plot of the detection filter f (x) and (c) Plot of the smoothing filter h(x).
between 0 and 1. When β takes the value zero, C(x) corresponds to a non-blurred crestline edge model [9], whereas when β is close to 1, C(x) represents a blurred crest-line edge model. In addition, when α is zero, C(x) corresponds to an impulse edge. Figure 2-a shows the curve of this function for α=1 and two distinct values of β. C(x) = K.e−α|x| .(λ +
3.2
sin(αβ|x|) − cos(αβ|x|)) β
(1)
Edge Detection Filters
Let us suppose that C(x) corresponds to an edge model in an image (model of the edge intensity variation of crest-line type along the axis x) described by Equation 1. The edges in the image can be computed by a second derivative (Laplacian) or by a first derivative (gradient) of the function C(x) according to the following formula: f (x) =
∂C(x) (1 − β 2 ) = −K.α.e−α|x| .(λ − 2 cos(αβ|x|) + sin(αβ|x|)) ∂x β
(2)
We require that R f (x) becomes a band-pass filter. Its impulse response has to be an odd function, i.e. f (x)dx = 0, f (0) = 0, and f (x) = −f (−x). In order to make it stable, this function should be convergent, i.e. f (−∞) = 0 et f (∞) = 0. Therefore, the value of λ can be derived as follows: f (0) = 0 = −Kα(λ − 2) ⇒ λ = 2. In order to guarantee that the function is odd, we can generalize Equation 2 as follows (see Equation 3), with K1 = −2Kα which corresponds to the new normalization constant and sgn(−x) returns the negative sign when x is positive and the positive sign when x
- 698 -
is negative. The plot of this filter is illustrated in Figure 2-b for α = 0.75 with different values of β (β=0.01, β=0.65 and β=0.95). We notice that the extrema of the curve move away of the axis y as much as the value of β increases and approaches to one. This indicates that the filter f (x) can detect blurred or sharp edges. f (x) = sgn(−x).K1 .e−α|x| .(1 − cos(αβ|x|) +
(1 − β 2 ) sin(αβ|x|)) 2β
(3)
The discrete expression for f (x) filter can be obtained using the Z-transform, which is the sum of the causal and anti-causal parts. Each one of the two parts is implemented in a third-order recursive form. The impulse response y(m) of digital signal S(m) corresponding to the f (x) digital filter can be written as: y(m) = y + (m) − y − (m)
(4)
where y + (m) determines a left-to-right recursion (causal parts) and y − (m) determines a right-to-left recursion (anti-causal parts) given by: y + (m) = K1 (c0 .s(m−1)+c1 .s(m−2))−b1 .y + (m−1)−b2 .y + (m−2)−b3 .y + (m−3) y − (m) = K1 (c0 .s(m+1)+c1 .s(m+2))−b1 .y − (m+1)−b2 .y − (m+2)−b3 .y − (m+3) 2 ) where the coefficients ci and bi are given by: c0 = e−α (1−cos(αβ)+ (1−β sin(αβ)), 2β 2
) c1 = e−2α (1−cos(αβ)− (1−β sin(αβ)), b1 = −e−α (1+2 cos(αβ)), b2 = e−2α (1+ 2β 2 +b3 . 2 cos(αβ)), b3 = −e−3α and K1 = 1+bc10+b +c1
3.3
Smoothing Filters
In the case of noisy image analysis, it is first necessary to attenuate or smooth the noise and then to detect edges. The smoothing filter h(x) can be determined as follows: S 0 (x) = h(x) ∗ S(x);
Smoothed signal :
(5)
The signal edges correspond to the derivative of the smoothed signal or can be calculated by the convolution of the detection filter and the signal as follows: Edge of signal :
f (x) ∗ S(x) ≈
∂(S 0 (x)) ∂h(x) = ∗ S(x); ∂x ∂x
(6)
where S(x) is 1-D signal and f (x) is equivalent to the first derivative of a smoothing filter. So, the smoothing filter using K2 , which is a normalization constant, can be calculated as follows: Z 1 1 sin(αβ|x|)) (7) h(x) = f (x)dx = K2 .e−α|x| (1 − cos(αβ|x|) + 2 2β The plot of this filter is illustrated in Figure 2-c for α = 0.75 with different values of β (β=0.01 and β=0.95). The discrete expression for h(x) filter can be obtained using the Z-transform, which is the sum of the causal and anti-causal parts. Each one of the two parts is implemented in a third-order recursive form. The impulse response y(n) of digital signal S(n) corresponding to the h(x) digital filter can be written as: y(n) = y + (n) + y − (n)
- 699 -
(8)
where y + (n) determines a left-to-right recursion (causal parts) and y − (n) determines a right-to-left recursion (anti-causal parts) given by: y + (n) = K2 (a0 .s(n) + a1 .s(n − 1) + a2 .s(n − 2)) − b1 .y + (n − 1) − b2 .y + (n − 2) − b3 .y + (n − 3) y − (n) = K2 (a3 .s(n + 1) + a4 .s(n + 2) + a5 .s(n + 3)) − b1 .y − (n + 1) − b2 .y − (n + 2) − b3 .y − (n + 3) where the coefficients ai take the following values: a0 = 0.5, a1 = e−α (0.5−1.5 cos(αβ)+ 0.5 −2α −α (1 − 0.5 cos(αβ) − 0.5 (1 − 0.5 cos(αβ) + β sin(αβ)), a2 = e β sin(αβ)), a3 = e 0.5 0.5 −2α −3α sin(αβ)), a = e (0.5 − 1.5 cos(αβ) − sin(αβ)), a = 0.5e and K2 = 4 5 β β 1+b1 +b2 +b3 a0 +a1 +a2 +a3 +a4 +a5 . 3.4
Algorithm for 2-D Edge Detection
The 2-D representation of the edge detection filter can be obtained using a convolution between the 1-D smoothing function with 1-D detection function imposing the separability condition with respect to x and y axes. The two filters f x (x, y) = f (x) ∗ h(y) and f y (x, y) = h(x) ∗ f (y) (see Figures 3-a and 3-b) are obtained as follows: in order to have a cost-effective recursive 2-D implementation, the separability of the filters for image analysis in two directions x (or m) and y (or n) is considered [7]. It means that the smoothing in x is followed by the detection in y (horizontal edges) and the detection in x is followed by the smoothing in y (vertical edges). The algorithm given below represents the 2-D edge detection by the convolution of the image I(m, n) by the proposed filters. F (n) and F (m) are the digital filters of f (x) for the axes n and m respectively, and H(n) and H(m) are the digital filters for h(x).
Fig. 3. 2-D edge detection algorithm and plot of the 2-D edge detection filters.
4
Experimental Results
In this section we present the results of edge detection obtained by the proposed f (x) and h(x) filters and the Deriche filters. Figure 4-a shows synthetic images containing a step edge and crest-line edge smoothed by the Gaussian with the standard deviation σ = 10 and then altered by white Gaussian noise (SNR=2). Figures 4-c and 4-d show
- 700 -
Fig. 4. (a) A synthetic image, with step and crest-line edges, blurred by the Gaussian and altered by white Gaussian noise. (b) The ideal edges of image (a), (c) Edges obtained by the Deriche filters for α = 0.35 and (d) Edges obtained by our filters for α = 0.35 and β = 0.25.
Fig. 5. (a) A synthetic image containing six different objects, blurred by the Gaussian (σ = 4) and altered by white Gaussian noise (SNR=4).(b) The ideal edges of image (a),(c) Image edge from Figure 5-a obtained by the Deriche filters for α = 0.85 and (d) Edges obtained by our filters for α = 0.85 and β = 0.25.
- 701 -
Fig. 6. (a) Original image of a wood slice.(b) Ring shapes obtained by Deriche filters for α = 1.125. (c) Ring shapes obtained by our filters for α = 1.125 and β = 0.75.
Fig. 7. (a) and (b) Theoretical curves of the products Σ.L and Σ.L.U resp. for our filter and (c) Experimental comparison of the product Σ.L between the Deriche filter and our filter.
- 702 -
the edges of the blurred and noisy image (Figure 4-a) obtained by the application of the Deriche filters for α = 0.35 and our filters for α = 0.35 and β = 0.25, respectively. Figure 5-a shows synthetic images, containing six different objects, smoothed by the Gaussian with the standard deviation σ = 4 and then altered by white Gaussian noise (SNR=4). Figures 5-c and 5-d represent the edges of the blurred and noisy image (Figure 5-a) obtained by the application of the Deriche filters for α = 0.85 and our filters for α = 0.85 and β = 0.25, respectively. We can conclude that the filters proposed in this paper give better results compared to the Deriche filters. For example, for the blurred and noisy image (Figure 4), with α = 0.35, the Deriche detector gives a multiple edge response while our detector gives a single edge response. We have used the proposed filters to estimate tree growth (and age) by identifying rings in wood samples. Figure 6 shows a slice of wood and the rings detected by Deriche and our filters.
5
Filter Performance
In this section we analyze in a quantitative manner the performance of the filters. First, we handle the theoretical performance of our detection filter, and then, we discuss the experimental performance. As mentioned in Section 2, the performance of the filter can be determined based on three criteria: good detection, good localization, and low multiplicity of the response (uniqueness). We apply these criteria to the evaluation of our detection filter. According to Canny criteria, an optimal edge detection filter provides the maximum of products Σ.L and Σ.L.U , where Σ is the signal to noise ratio SNR, L is the localization index (Pratt index) and U is multiplicity of the response. Deriche filter has a performance Σ.L = 1.12. Figures 7-a and 7-b show the influence of the parameters α and β on the products Σ.L and Σ.L.U by our filter f (x), respectively. The curve in Figure 7-a shows that the filter f (x) is optimal for β = 0.87, ∀α, (product Σ.L = 2.52) and the curve in Figure 7-b (product Σ.L.U ) shows that the filter f (x) is optimal for β = 0.77, ∀α. In order to strengthen our investigation of the theoretical performance, we have conducted some experiments on synthetic images containing step edges and crest-line edges (see Figure 4) blurred by the Gaussian with standard deviation σ = 10 and then immersed in white noise with SNR=2. The edges at the output of the 2-D algorithm described in Section 3.4 are then analyzed to determine the performance of SNR and localization. We compare the results of our filters with those of the Deriche filters. In the experimental case, Σ and L (Pratt index) are evaluated using Equations 9 and 10, respectively. P Nb i,j Pc (i, j)2 ) (9) SN R = 10.log( P Nc i,j Pb (i, j)2 L=
Nc 1 X 1 Ncm 1 + d2l
(10)
l=1
where Ncm = max(Nc , NI ), Nc and NI correspond to the number of pixels belonging to the detected edges and ideal edges, respectively. Nb is the number of noisy pixels,
- 703 -
Pc and Pb represent the edge pixel intensity and the noise pixel intensity, respectively. dl is the distance between the pixel of an ideal edge and the pixel of a detected edge at the position l. Figure 7-c shows the experimental performance of the Deriche detection filter and our filter in terms of good detection and good localization. This curve shows that our filter has a better performance than the Deriche filter. It gives the maximum of the product Σ.L for the value of β near 0.75 and any value of α.
6
Conclusion
We have described two new filters for edge smoothing and detection that depend on two parameters. The parameter β tunes the blurring influence on the edges, whereas the parameter α is important for noise elimination. Our filters clearly outperform the Deriche filters for β > 0, ∀α, and are optimal for 0.7 < β < 0.9 and any value of α. Theoretical and experimental results show that our smoothing and detection filters are better adapted to sharp, blurred, noisy or blurred and noisy images.
References 1. C. T. Zahn and R. Z. Roskies, : Fourier descriptors for plane closed curves. IEEE Trans. on Comput. 3. C-21 (1972) 269-281 2. F. S. Cohen and Z. Huang, Z. Yang,: Invariant matching and identification of curves using B-Splines curve representation. IEEE Trans. On Image Processing. Vol. 4. No. 1 (1995) 1–10 3. G.C.H. Chuang and C.C.J. Kuo, : Wavelet Descriptor of Planar Curves: Theory and Applications. IEEE Tans. on Image Processing. Vol. 5, No. 1, (1996) 56–70 4. A. Srivastava and S. H. Joshi and W. Moi and X. Liu, : Statistical Shape Analysis : Clustering, Learning and Testing. IEEE Trans. On PAMI. Vol. 27, No. 4, (2005) 5. J. Canny : A Computational approach to edge detection. IEEE Trans. On PAMI. Vol. 8, (1986) 679–697 6. S. Mallat and S. Zhong, : Characterization of signals from multiscale edges. IEEE Trans. On PAMI. vol. 14, no. 7, (1992) 710–732 7. R. Deriche, : Using Canny’s criteria to derive a recursively implemented optimal edge detector. Internat. J. Computer Vision. vol. 1, no. 2, (1987) 167-187 8. E. Bourennane and P. Gouton and M. Paindavoine and F. Truchetet, : Generalization of Canny-Deriche Filter for detection of noisy exponential edge. Signal Processing. vol. 82, (2002) 1317–1328 9. P. Gouton and H. Laggoune and Rk. Kouassi and M. Paindavoine, : Optimal Detector for Crest Lines. Optical engineering. vol. 39, no. 6, (2002) 1602–1611 10. D. Demigny, : On optimal linear filtering for edge detection, : IEEE Transactions on Image Processing. vol. 11, no. 7, (2002) 78–88
- 704 -