An Edge Detection Algorithm for Online Image Analysis Azzam Sleit, Abdel latif Abu Dalhoum, Ibraheem Al-Dhamari, Afaf Tareef Department of Computer Science, King Abdulla II School for Information Technology University of Jordan, Amman, Jordan azzam.sleit@ju.edu.jo, a.latif@ju.edu.jo, ibr_ex@yahoo.com, a.tareef@yahoo.com Abstract: - Online image analysis is used in a wide variety of applications. Edge detection is a fundamental tool used to obtain features of objects as a prerequisite step to object segmentation. This paper presents a simple and relatively fast online edge detection algorithm based on second derivative. The proposed edge detector is less sensitive to noise and may be applied on color, gray and binary images without preprocessing requirements. The merits of the algorithm are demonstrated by comparison with Canny s and Sobel s edge detectors. Keywords: Edge detection, Canny s edge detector, Sobel s edge detector, Wavelet transforms, Derivative operators. 1. Introduction Several real life applications related to medical imaging, Geographical Information Systems (GIS) and Object Character recognition (OCR) depend on the discovery of edges surrounding objects since they hold desired features for the objects which appear in the images. Applying an edge detector to an image may significantly reduce the amount of data to be processed and may therefore filter out information that may be regarded as less relevant, while preserving the important structural properties of an image. An edge is a set of connected pixels that lie on the boundary between two regions reflecting discontinuities in the brightness of the image due to surface, depth, color, or illumination [1]. Sobel edge operator is one of the simplest operators known since 1968. It is a discrete differentiation operator which computes the approximated gradient of the image intensity. For each pixel of the image Sobel operator produces either the corresponding gradient vector or the norm of the corresponding gradient vector. The gradient approximation which Sobel operator produces is crude for high frequency variations in the image [2]. The Canny edge detector and its variations are considered the state-of-the-art edge detectors. Canny showed that the optimal filter is a sum of four exponential terms. He also showed that this filter can be well approximated by first-order derivatives of Gaussians. Canny edge detector is relatively complex and typically requires noise smoothing, edge enhancement, and edge localization [3]. There are many other edge detection algorithms which utilize more complex techniques such as k-means, neural networks and wavelet transform [4, 5, 6]. Such techniques have massive run-time requirements which make them inappropriate for online analysis of video steams or applications with large sets of images. Section 2 of this article proposes a fast and simple edge detection algorithm. Section 3 demonstrates experimental runs for the proposed algorithm including comparisons with Sobel and Canny. Section 4 concludes this article. 2. Proposed Edge Detector Real-time video and image processing is used in a wide variety of applications from video surveillance and traffic management to medical imaging applications. Edge detection is a fundamental tool used in most image processing applications to obtain information from the frames as a prerequisite step to feature extraction and object segmentation. This section presents a simple and relatively fast online edge detection approach based on the second derivative operator. The difference of the neighbor pixels is a good indicator of an edge in digital images. Second-order derivative operators such as Laplacian are sensitive to noise. However, we address this issue by the following steps: ISSN: 1790-2769 250 ISBN: 978-960-474-150-2
1. Get the negative value of the second derivative of the current pixel. 2. Remove the center pixel value. 3. Subtract the four diagonal pixels values. Now we can write the operator equation as follow: f(x, y) = - 2 f(x, y) 4f(x, y) f(x-1,, y-1) f(x-1, y+1) f(x+1, y-1) f(x+1, y+1) The value of f(x, y) is the color value of the current 2 pixel with coordination (x, y), and f(x, y) is the second derivate of the value f(x, y). The following operator mask represents the above equation: The simplicity of the algorithm makes it possible to be implemented by hardware which is suitable for high resolution and large size images such as satellite frames. 3. Experiments and Sample Runs We have implemented the proposed operator along with Sobel and Canny using Matlab. Fig 1 compares the outcome of the proposed operator with Sobel and Canny for the leaf image. More runs are demonstrated in figures 2-7. It is clear that the proposed operator is less sensitive to noise than both Sobel and Canny. The fact that our operator detects edges with exactly one pass over the image with simple mathematical operations applied on each pixel makes it appropriate for online image analysis. -1 1-1 1 0 1-1 1-1 Adding the diagonal values and remove the center value gives us the necessary balancing for edge detection and removes undesired noise. The operator employs the differences between neighboring pixels with respect to the current pixel to become the new value of the current center pixel. The operator removes undesired data (colors and noise) and only holds the edges. The following algorithm implements the proposed operator for an image hxw, where, h is the number of rows and w is the number of columns. The algorithm has a runtime complexity of Θ ( hw ) constant., where d is (a) (c) (b) (d) Input: A =an image with size [height x width]. Output: B=the edges image of the image A. [h w d]=size(a);// the dimensions of the image for k=1 to d for x=1 to h for y=1 to w B(x,y,k)=-A(x-1,y-1)+A(x-1,y)-A(x-1,y+1) +A(x,y-1) -A(x,y+1) -A(x+1,y-1)+A(x+1,y) -A(x+1,y+1); Fig 1. (a) Leaf image (b) Edge-detection using Sobel (c) Edge-detection using Canny (d) Edge- detection using proposed algorithm. ISSN: 1790-2769 251 ISBN: 978-960-474-150-2
RECENT ADVANCES in APPLIED MATHEMATICS 4. Fig 2. Chalks image ISSN: 1790-2769 Fig 3. LKMagenta image 252 Fig 4. Random image ISBN: 978-960-474-150-2
RECENT ADVANCES in APPLIED MATHEMATICS Fig 5. Sample image ISSN: 1790-2769 Fig 6. Rose image Fig 7. Washington image 253 ISBN: 978-960-474-150-2
Conclusion This paper introduces a fast edge detection algorithm which runs in Θ ( hw ), where h and w are the height and width of the source image. The algorithm utilizes 8 operations per pixel in the source image which makes it appropriate for large size images and image streams. Experiments demonstrate the merits of the proposed operator as it is less sensitive to noise than Sobel s and Canny s edge detectors. As future work, we will investigate the merits of the operator for optical character recognition. References [1] Rafael C. Gonzalez and Richard E. Woods, 2008, Digital Image Processing, 3rd edition. [2] Sobel, I., Feldman,G., A 3x3 Isotropic Gradient Operator for Image Processing", presented at a talk at the Stanford Artificial Project in 1968, unpublished. [3] Canny, J., 1986, A Computational Approach to Edge Detection, IEEE Trans. Pattern Analysis and Machine Intelligence, Vol. 8, Issue 6, pp. 679-698. [4] Suzuki, K., Horiba, I., and Sugie, N., 2003, Neural Edge Enhancer for Supervised Edge Enhancement from Noisy Image, IEEE Trans. Pattern Analysis and Machine Intelligence, Vol. 25, Issue 12, pp. 1582 1596. [5] Guowei T., Xiaoqing Z., Fangzhou Z., Zhenying J., 2009, X-Ray Image Edge Detection Based on Wavelet Transform and Lipschitz Exponent, Second International Symposium on Intelligent Information Technology and Security Informatics, pp. 56-66. [6] Ganguly, D., Mukherjee, S., Mitra, K., Mukherjee, P., 2009, A Novel Approach for Edge Detection of Images, International Conference on Computer and Automation Engineering, pp. 49-53. ISSN: 1790-2769 254 ISBN: 978-960-474-150-2