International Journal of Application or Innovation in Engineering & Management (IJAIEM) Web Site: www.ijaiem.org Email: editor@ijaiem.org, editorijaiem@gmail.com Volume 2, Issue 12, December 2013 ISSN 2319 - 4847 Design Study Sobel Edge Detection Elham Jasim Mohammad1, Ahmed Jassm Mohammed2, Zainab Jasim Mohammad3, Gaillan H. Abdullah4, Iman Majeed Kadhim5 and Yasser Abd Al-Kalak Mohammed Wdaa6 1 University Professor, University of Mustansiriyah, Collage of Science, Physics Department, Baghdad, Iraq 2 Engineer, University of Mustansiriyah, Collage of Engineering, Electric Department, Baghdad, Iraq 3 Lecturer, University of Mustansiriyah, Collage of Education, Department of Computer Science, Baghdad, Iraq 4 Senior Physics' Chief, Ministry of Science & Technology Materials Chemistry, Physics Directorate, Baghdad, Iraq 5 Chief Engineer Oldest, Division of Engineering Affairs, University of Mustansiriyah, Baghdad, Iraq 6 Under Graduate Student, University of Mustansiriyah, Collage of Science, Physics Department, Baghdad, Iraq ABSTRACT Edge detection is one of the most fundamental operations in image processing and computer vision. It is defined as the process of locating the boundaries of objects or textures depicted in an image. Knowing the positions of these boundaries is critical in the process of image enhancement, recognition, restoration and compression. The edges of image are considered to be most important image attributes that provide valuable information for human image perception. The data of edge detection is very large, so the speed of image processing is a difficult problem. Sobel operator is commonly used in edge detection. In the edge function, the Sobel method uses the derivative approximation to find edges. Therefore, it returns edges at those points where the gradient of the considered image is maximum. The horizontal and vertical gradient matrices whose dimensions are 3×3 for the Sobel method has been generally used in the edge detection operations. This paper mainly used the Sobel operator method to do edge detection processing on the images. It has been proven by the results we have obtained, that the edge detection mathematical method by simulation using MATLAB software is very good in the analyzing the image. Keywords: Edge, Edge Detection, Sobel Operator, Image Processing. 1. INTRODUCTION Edge detection is the name for a set of mathematical methods which aim at identifying points in a digital image at which the image brightness changes sharply or, more formally, has discontinuities. The points at which image brightness changes sharply are typically organized into a set of curved line segments termed edges. The same problem of finding discontinuities in one dimensional (1D) signal is known as step detection and the problem of finding signal discontinuities over time is known as change detection. Edge detection is a fundamental tool in image processing, machine vision and computer vision, particularly in the areas of feature detection and feature extraction. Extracting edges from a still image is certainly the most significant stage of any computer vision algorithm requiring high accuracy of location in the presence of noise. In many contour-based vision algorithms, such as, curved-based stereo vision, contour-based image compression and edge-based target recognition, edge-based face detection their performance is highly dependent on the quality of the detected edges [1]. Edges characterize boundaries and are therefore considered for prime importance in image processing [2]. An edge is seen at a place where an image has a strong intensity contrast. Edges could also be represented by a difference in color, without any difference in intensity. Of course there are exceptions where a strong intensity contrast does not embody an edge. Therefore a zero crossing detector is also thought of as a feature detector rather than a specific edge detector. Edges are significant local changes of intensity in an image. Edges typically occur on the boundary between two different regions in an image [3]. Edge is a part of an image that contains significant variation. The edges provide important visual information since they correspond to major physical, photometrical or geometrical variations in scene object. Physical edges are produced by variation in the reflectance, illumination, orientation, and depth of scene surfaces. Since image intensity is often proportional to scene radiance, physical edges are represented by changes in the intensity function of an image [4]. The most common edge types are steps, lines and junctions. The step edges are mainly produced by a physical edge, an object hiding another or a shadow on a surface. It generally occurs between two regions having almost constant, but different, grey levels. The step edges are the points at which the grey level discontinuity occurs, and localized at the inflection points. They can be detected by using the gradient of intensity function of the image. Step edges are localized as positive maxima or negative minima of the 1st derivative or as zero-crossings of the 2nd order derivative shown in figure 1 below: Figure 1 Profile of (a) ideal step edge (b) smoothed step edge corrupted by noise (d) 1st order derivative (d) 2nd order derivative of the smoothed step edge corrupted by noise [4]. Volume 2, Issue 12, December 2013 Page 248 International Journal of Application or Innovation in Engineering & Management (IJAIEM) Web Site: www.ijaiem.org Email: editor@ijaiem.org, editorijaiem@gmail.com Volume 2, Issue 12, December 2013 ISSN 2319 - 4847 It is more realistic to consider a step edge as a combination of several inflection points. The most commonly used edge model is the double step edge. There are two types of double edges shown in figure 2, the pulse and the staircase [4]: Figure 2 Profile of pulse (left) and staircase (right) step edges [4]. The line edges are often created by either a mutual illumination between two objects that are in contact or a thin object placed over a background. Line edges correspond to local extremes in the intensity function. Lines correspond to local extreme of the image. They are localized as zero-crossings of the first derivative, or local maxima of the Laplacian, or local maxima of the grey level variance of the smoothed image. This type of edge is successfully used in remote sensing images for instance to detect roads and rivers [4]. Finally, the junction edge is formed where two or more edges meet together. A physical corner is formed at the junction of at least two physical edges. Illumination effects or occlusion, in which an edge occludes another, can produce a junction edge. Figure 3 depicts profiles of line and junction edges. The junction can be localized in various ways: e.g., a point with high curvature, or a point with great variation in gradient direction, or a zero-crossing of the Laplacian with high curvature or near an elliptic extremum. Though, the most of our studies encompass the all types of edges, but the majority of the reviewed literature is adapted to step edges, which are the most common [4]. Figure 3 (a) Line profile. (b) Juction profile [4]. 2. SOBEL EDGE DETECTION Edge detection is the process of localizing pixel intensity transitions. The edge detection has been used by object recognition, target tracking, segmentation, and etc. Therefore, the edge detection is one of the most important parts of image processing. There mainly exist several edge detection methods: Sobel, Prewitt, Roberts and Canny. In this paper, Sobel which is an edge detection method is considered. The Sobel edge detector uses two masks, one vertical and one horizontal. These masks are generally used 3×3 matrices. Especially, the matrices which have 3×3 dimensions are used in matlab. Sobel has two main advantages: it has some smoothing effect to the random noise of the image [5]: i) Since the introduction of the average factor, it has some smoothing effect to the random noise of the image. ii) Because it is the differential of two rows or two columns, so the element of the edge on both sides has been enhanced, so that the edge seems thick and bright. In the airspace, edge detection is usually carried out by using the local operator. What we usually use are orthogonal gradient operator, directional differential operator and some other operators relevant to 2nd order differential operator. Sobel operator is a kind of orthogonal gradient operator. Gradient corresponds to first derivative, and gradient operator is a derivative operator. Here, the image is convolved with only two kernels, one estimating the gradient in the x- direction, , the other the gradient in the y-direction, . The absolute gradient magnitude is then given by [6], [7]: (1) and is often approximated with [6], [7]: (2) In many implementations, the gradient magnitude is the only output of a gradient edge detector. After having calculated the magnitude of the 1st derivative, we now have to identify those pixels corresponding to an edge. The easiest way is to threshold the gradient image, assuming that all pixels having a local gradient above the threshold must represent an edge. An alternative technique is to look for local maxima in the gradient image, thus producing one pixel wide edges. A general problem for edge detection is its sensitivity to noise, the reason being that calculating the derivative in the spatial domain corresponds to accentuating high frequencies and hence magnifying noise [8]. For a continuous function , in the position , its gradient can be expressed as a vector (the two components are two first derivatives which are along the X and Y direction respectively) [9]: (3) Volume 2, Issue 12, December 2013 Page 249 International Journal of Application or Innovation in Engineering & Management (IJAIEM) Web Site: www.ijaiem.org Email: editor@ijaiem.org, editorijaiem@gmail.com Volume 2, Issue 12, December 2013 ISSN 2319 - 4847 The magnitude and direction angle of the vector are [10], [11]: (4) (5) The partial derivatives of the formulas above need to be calculated for each pixel location. In practice, we often use small area template convolution to do approximation. and need a template each, so there must be two templates combined into a gradient operator. The two 3×3 templates used by Sobel are showed as (a) and (b) in figure 4 below: Figure 4 Sobel edge masks [7]. Every point in the image should use these two kernels to do convolution. One of the two kernels has a maximum response to the vertical edge and the other has a maximum response to the level edge. The maximum value of the two convolutions is used as the output bit of the point, and the result is an image of edge amplitude. Their convolution is as follows [9]: (6) (7) (8) If , it means that there is an edge with a vertical direction passing through the point . Otherwise, an edge with a level direction will pass through the point. If the pixel value of the point is , and this point is judged as an edge point if satisfy one of the following two conditions [9]: 1) (8) (9) (10) (11) 2) (12) (13) (14) (15) In the formulas above, row and list refer to the number of rows and columns of the image respectively [9]. 3. SIMULATION RESULTS AND DISCUSSION We proceed with the Sobel edge detector. MATLAB is a great and easy tool to use to simulate image process. The main steps in edge detection using masks are: First derivative: Sobel operators. 1. Smooth in one direction, differentiate in the other. 2. Apply Sobel mask for x-direction. 3. Apply Sobel mask for y-direction. 4. Found the absolutes value. 5. Found the arctan= gradient direction. 6. Found the gradient of the image. 7. Defined a threshold value. The edge detection techniques were implemented using MATLAB, and tested with (Aishwarya Rai) image. The objective is to produce a clean edge map by extracting the principal edge features of the image. The masks of the Sobel edge detection 3×3 are constructed in this work. The original image figure 5, and the image obtained by using different threshold Sobel edge detection technique are given in figure 6 and figure 7 below. As mentioned before, the Sobel method finds edges using the Sobel approximation to the derivative. It returns edges at those points where the gradient of the image is maximum, figure 6 and figure 7 displays the results of applying the Sobel method on the original images: Volume 2, Issue 12, December 2013 Page 250 International Journal of Application or Innovation in Engineering & Management (IJAIEM) Web Site: www.ijaiem.org Email: editor@ijaiem.org, editorijaiem@gmail.com Volume 2, Issue 12, December 2013 ISSN 2319 - 4847 function createfigure(cdata1) % Create figure figure1 = figure; % Create axes axes1 = axes ('Visible','off','Parent',figure1, … 'YDir','reverse','TickDir', 'out','Position',… [0.2122 0.1379 0.5751 0.7882], 'Layer', 'top',... 'DataAspectRatio', [1 1 1]); % Uncomment the following line to preserve % the X-limits of the axes % xlim ([0.5 222.5]); % Uncomment the following line to preserve % the Y-limits of the axes % ylim ([0.5 320.5]); box('on'); hold('all'); % Create image image(cdata1,'Parent',axes1); Figure 5 Aishwarya Rai original image Figure 5 is about Aishwarya Rai photo. Aishwarya Rai, also referred to as Aishwarya Rai Bachchan, is an Indian model and film actress. She took birth on 1st November, 1973. She is the holder of 2 IIFA awards, 2 Screen awards, and 2 Film fare Awards. She gave many successful films back to back after 1997. She was titled Miss India and Miss World in 1994. She is the brand ambassador of several charity and trust organizations. Aishwarya took birth in Mangalore, Karnataka. In 1991, she won a supermodel contest, organized by Ford and appeared in the American edition of 'Vogue'. The statistical value for Aishwarya Rai image is: mean =111.5, median =111.5, mode =1 and the standard deviation (STD) =156.3. For recognizing edge and edge direction, Sobel function is used. It gives the binary image with discrete point at the edges and where the intensity level changes. Points are present on everywhere including the edges. To clear the edges, other points should be minimizing. To minimize the point the threshold value is kept to 100. These edge detection operators can have better edge effect under the circumstances of obvious edge and low noise. There are various edge detection methods in the domain of image edge detection, each having certain disadvantages. As edge detection is a fundamental step in computer vision, it is necessary to point out the true edges to get the best results from the matching process. That is why it is important to choose edge detectors that fit best to the application. Figure 6 and figure 7 explain the results after used Sobel edge detection operators on Aishwarya Rai original image: Threshold Value= 100 Threshold Value= 150 Threshold Value= 200 Figure 6 Aishwarya Rai image after used Sobel gradient. Threshold Value= 100 Threshold Value= 150 Threshold Value= 200 Figure 7 Edge detected for Aishwarya Rai image. Volume 2, Issue 12, December 2013 Page 251 International Journal of Application or Innovation in Engineering & Management (IJAIEM) Web Site: www.ijaiem.org Email: editor@ijaiem.org, editorijaiem@gmail.com Volume 2, Issue 12, December 2013 ISSN 2319 - 4847 4. CONCLUSIONS The results showed that we obtained for the process of analyzing the image using the method of Sobel edge operator is a smoothing effect of the random noises in the image. And because it is the differential separated by two rows or two columns, so the edge elements on both sides have been enhanced and make the edge seems thick and bright. Calculate the magnitude and the argument value of the image horizontal and vertical 1 st order or 2nd order gradients, at last calculate modulus maxima along the angular direction and obtain the edge of the image. But when the image has lots of white Gaussian noises, it is very difficult to get the peak value of the first derivative; the reason is because that the noise points and the useful signals mix up. Sobel operator is commonly used in edge detection. Sobel operator has been researched for parallelism, but Sobel operator locating complex edges are not accurate; it has been researched for the Sobel enhancement operator in order to locate the edge more accurate and less sensitive to noise. References [1] K. Binnur, G. Muhittin, "Goal Oriented Edge Detection", International Symposium on Computer and Information Sciences (ISCIS), 2008. [2] J. Mamta and S. S. Parvinder, "Performance Evaluation of Edge Detection Techniques for Images in Spatial Domain", International Journal of Computer Theory and Engineering, vol. 1, no. 5, 1793-8201, 2009. [3] Trucco and Jain et al., "Edge detection", Chapter 4 and 5. [4] A. O. Mohammadreza and H. Huosheng, "A Survey on Edge Detection Methods", School of Computer Science & Electronic Engineering, University of Essex, Colchester CO4 3SQ, United Kingdom, 2010. [5] A. Elif, "Sobel Edge Detection Method for Matlab", Assistant Professor Elif Aybar Is With Porsuk Vocational School, Anadolu University, Eskisehir. E-Mail: Elaybar@Anadolu.Edu.Tr. Fax: 0 222 224 1390. [6] S. A. Salem, N. V. Kalyankar and S. D. Khamitkar, "Image Segmentation By Using Edge Detection", (IJCSE) International Journal On Computer Science And Engineering, vol. 2, no. 3, pp. 804-807, 2010. [7] T. A. Al-Aish, "Edge Detection in Sensor Networks using Image Processing", Diala Jour., vol. 31 , Iraq, 2008. [8] R. Fisher, S. Perkins, A. Walker and E. Wolfart, "Edge Detectors", 2003. [9] G. Wenshuo, Y. Lei, Z. Xiaoguang and L. Huizhong, "An Improved Sobel Edge Detection", IEEE, 2010. [10] M. A. Fari, "Study Of Image Segmentation By Using Edge Detection Techniques", International Journal of Engineering Research & Technology (IJERT), vol. 1, Issue 9, 2012. [11] K. V. Manoj and S. U. Nimbhorkar, "Edge Detection of Images Using Sobel Operator", International Journal of Emerging Technology and Advanced Engineering Website: www.ijetae.com, ISSN 2250-2459, vol. 2, Issue 1, 2012. AUTHORS Elham Jasim Mohammad, was born in Iraq, she received her Ph.D. degree in Optoelectronics Physics Science from Al-Mustansiriyah University, her M.S. degree in Image Process, Physics Science from AlMustansiriyah University. She received B.S. degree in Physical Science from Al-Mustansiriyah University. She works as a University Professor in the Department of Physics Science from Al-Mustansiriyah University, Baghdad, Iraq. Ahmed Jassm Mohammed, was born in Baghdad, Iraq 1985, he received B.S. degree in Electrical Engineering, University of Mustansiriyah, Collage of Engineering, Electric Department, Baghdad, Iraq. He works as an engineer in Company Civil. Zainab Jasim Mohammad, was born in Iraq 30/7/1983, she received B.S. degree in Computer Science, University of Mustansiriyah, Collage of Education, Department of Computer Science, Baghdad, Iraq. She works as a lecturer staff in Ministry of Education. Gaillan H. Abdullah, was born in Bagdad, Iraq; he received B.S. degree in Physical Science from Baghdad University, M.S. degree in Laser and Optoelectronics (Alrasheed College/University of Technology-Baghdad) and his Ph.D. degree in Laser and Optoelectronics technology from Technology University, Iraq, Bagdad. He joined to the Laser and Optoelectronic center in Ministry of Science and Technology and carried out research in Thin Films design system and optical design. Volume 2, Issue 12, December 2013 Page 252 International Journal of Application or Innovation in Engineering & Management (IJAIEM) Web Site: www.ijaiem.org Email: editor@ijaiem.org, editorijaiem@gmail.com Volume 2, Issue 12, December 2013 ISSN 2319 - 4847 Iman Majeed Kadhim, was born in Miesaan, Iraq 1962. She received B.S. degree in Electrical Engineering and Education, Technical Education Department, University of Technology, Baghdad, Iraq. She works as Chief Engineer Oldest, Division of Engineering Affairs, University of Mustansiriyah, Baghdad, Iraq. Yasser Abd Al-Kalak Mohammed Wdaa, was born in Iraq 26/2/1991, he received his Under Graduated Study in Physical Science from Al-Mustansiriyah University, Baghdad, Iraq. He worked in the field of Image Processing and his project title is: "Design Study Sobel Edge Detection Processing Using MATLAB", supervised by Dr. Elham Jasim Mohammad. Volume 2, Issue 12, December 2013 Page 253