Document Image Segmentation Using Edge Detection Method 1Manish T. Wanjari 2Keshao D. Kalaskar Department of Computer Science, SSESA’s, Science College, Congress Nagar, Nagpur, Department of Computer Science, Dr. Ambedkar College, Chandrapur, (MH), India (MH), India Keshao_kalaskar@yahoo. co.in mwanjari9@gmail.com ABSTRACT Document image segmentation is one of the most important aspect in the analysis of document images. A number of segmentation techniques are available which fulfills the requirement for specific type of application of Document Image Analysis. Edge detection is a fundamental tool in image processing, machine vision and computer vision, particularly in the areas of feature detection. Edge-detection method is used for performing document image segmentation tasks. In this paper various edge detection methods based on Gradient and Laplacian such as Prewitt, Sobel, Roberts, Canny, Zerocrossing, Laplacian of Gaussian edge detection are implemented along with their advantages and disadvantages. Lastly, experimental result & performance of the edge detection method is compared. Keywords Image Processing (IP), Document Image Analysis (DIA), Edge Detection, Segmentation, Sobel Operator, Canny Operator. 1. INTRODUCTION Edge detection method is a set of mathematical methods which goal 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 called edges. [1] Document Image segmentation algorithms generally are based on one of two basic properties of intensity values such as discontinuity and similarity. In the first category, the approach is to partition a document image based on abrupt changes in intensity, such as edges in a document images. The principal approaches in the second category are based on partitioning a document image into regions that are similar according to a set of predefine criteria. In this paper we discuss a number of approaches in the first category mentioned. We begin the development with methods suitable for detecting 3Mahendra P. Dhore Department of Electronics & Computer Science, R.T.M. Nagpur University Campus, Nagpur, (MH), India mpdhore@rediffmail.com gray level discontinuities such as points, lines and edges. Edge detection in particular has been a staple for many years. In addition to edge detection, we also discuss methods for connecting edge segments and for ‘assembling’ edges into region boundaries. [2] Edge detection is one of the most important element in document image analysis and image processing in computer vision because they apply sound significant role in many applications of image processing particular for machine vision. Edge detection is a method of determining the discontinuities in gray level or binary document images. Edge detection method is the common approach for detecting meaningful discontinuities in the gray level. Document Image segmentation methods for detecting discontinuities are boundary based methods. Edges are local changes in the document image intensity. Edges typically occur on the boundary between two regions. Important features can be extracted from the edges of a document image (e.g., corners, lines, curves). Edge detection is an important feature for document image analysis. These features are used by higher-level computer vision algorithms (e.g., recognition). Edge detection is used for object detection which includes various applications such as medical image processing, biometrics etc. Edge detection is an active area of research as it facilitates higher level document image analysis. There are three different types of discontinuities in the grey level like point, line and edges. Spatial masks can be used to detect all the three types of discontinuities in a document images. And also we discuss various operators uses the first and second order derivatives of edge detection methods. [3, 4] In a document image an edge is a curve that a path of rapid change in document image intensity. Edges are often associated with the boundaries of object is a scene. Edge detection method is used to identify the edges in a document images. The first derivatives of the intensity is larger in magnitude than some threshold and the second order derivative of the intensity has a zero crossing edge provides a number of derivative estimator. [5, 6] 2. DETECTION OF DISCONTINUTIES It deals with a various methods for detecting the three basic types of gray-level discontinuities in a digital image: points, line and edges. a. b. c. Point Detection: The detection of isolated points (a point whose gray level is significantly different from its background and which is located in a homogeneous or nearly homogeneous area) in a document image is straightforward in principle. Line Detection: The next level of complexity is line detection. The document image intensity abruptly changes value but then returns to the starting value within some short distance (generally used lines). Edge Detection: Although point and line detection are important in any part of segmentation, edge detection is by far the most common approach for detecting meaningful discontinuities in gray level.[1] 3. EDGE DETECTION METHODS The edge representation of a document image reduces the quantity of data to be processed; it retains necessary information regarding the shape of character in document image. There are many edge detection methods in the literature for document image segmentation. Most of the used discontinuity based edge detection methods are reviewed in this paper. Those methods are Prewitt, Sobel, Canny, Roberts, Zerocross and Laplacian of Gaussian. [7] Although point and line detection certainly are important in any part of segmentation, edge detection is the most common approach for detecting meaningful discontinuities in gray level. In this paper we discuss approaches for implementing first and second order digital derivatives for the detection of edges in a document image. Edge detection is an unsolved problem, so, there is no proper solution. However, edge detection provides rich information about the scene being observed. Many researchers have been taking advantage of edge detection information to improve the segmentation of range document images by integrating edge detection with other different segmentation methods or operators are discussed as follows. 3.1. Prewitt edge detection The Prewitt edge detector is an appropriate way to estimate the magnitude and orientation of an edge. Although differential gradient edge detection needs a rather time consuming calculation to estimate the orientation from the magnitudes in the x and ydirections, the compass edge detection obtains the orientation directly from the kernel with the maximum response. The prewitt operator is limited to 8 possible orientations, however experience shows that most direct orientation estimates are not much more accurate. This gradient based edge detector is estimated in the 3x3 neighborhood for eight directions. [8] In edge detection method, the prewitt masks are simpler to implement than the Sobel masks, but the later have slightly superior noise suppression characteristics, an important issue when dealing with derivatives. -1 -1 -1 -1 0 +1 0 0 0 -1 0 +1 +1 +1 +1 -1 0 +1 Gx Gy 3.2. Canny edge detection The Canny edge detector is regarded as one of the best and standard edge detectors recently in use; Canny’s edge detector ensures good noise immunity and at the same time detects true edge points with minimum error. The Canny edge detector is an edge detection operator that uses a multi-stage algorithm to detect a wide range of edges in document images. It is developed by John Canny considered the mathematical problem of deriving an optimal smoothing filter given the criteria of detection, localization and minimizing multiple responses to a single edge. He showed that the optimal filter given these assumptions is a sum of four exponential terms. He also showed that this filter can be well approximated by first-order derivatives of Gaussians. Canny also introduced the notion of nonmaximum suppression, which means that given the presmoothing filters, edge points are defined as points where the gradient magnitude assumes a local maximum in the gradient direction. Looking for the zero crossing of the 2nd derivative along the gradient direction was first proposed by Haralick.[9] It took less than two decades to find a modern geometric variational meaning for that operator that links it to the MarrHildreth (zero crossing of the Laplacian) edge detector. This observation was presented by Ron Kimmel and Alfred Bruckstein. [10] Although his work was done in the early days of computer vision, the Canny edge detector (including its variations) is still a state-of-the-art edge detector.[11] Unless the preconditions are particularly suitable, it is hard to find an edge detector that performs significantly better than the Canny edge detector. The CannyDeriche detector was derived from mathematical criteria as the Canny edge detector, although starting from a discrete viewpoint and then leading to a set of recursive filters for document image smoothing instead of exponential filters or Gaussian filters. [12] other Euclidean distance-based operators. The Sobel edge detection operator will be applied to the different color space. -1 -2 -1 -1 0 -1 3.3. Roberts edge detection 0 0 0 -2 0 +2 The Roberts cross operator performs a simple, quick to compute, 2-D spatial gradient measurement on an image. It highlights regions of high spatial frequency which corresponds to edges. In its most common usage, the input to the operator is a grayscale image, as is the output. Pixel values at each point in the output represent the estimated absolute magnitude of the spatial gradient of the input image at that point. +1 +2 +1 -1 0 +1 Gradient can be defined as ∇π(π₯, π¦) = πΊ(π₯, π¦) = √πΊπ₯ 2 + πΊπ¦ 2 ----- (I) Where f(x, y) is point in the original document image, Gx(x, y) is a point in an document image formed by convolving with first kernel and Gy(x, y) is a point in an document image formed by convolving with second kernel. -1 0 0 -1 0 +1 +1 0 Gx Gy 3.4. Sobel edge detection Sobel operator or method is commonly used in edge detection method. 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 sensitivity to noise but software cannot get the real time requirement. [4] The Sobel operator is a well known edge detector method [13]. The original difference-based gradient computation is replaced by a Euclidean distance calculation. This vectorization of the algorithm allows for the effective use of the color information given that simple intensity differences would not represent differences between two color vectors as well as a Euclidean distance calculation. The Sobel operator has been shown to be a good edge detector. In its expanded form, it will deal better with the information contained in color images without compromising it such as in methods where the operator is applied to each color plane independently [14]. In this case, the correlation between the various planes is lost and the final result would be probably less than adequate. The Sobel operator will suffer from an inability to identify all difference-based edges just as Gx Gy The kernel can be applied separately to the input document image, to produce separate measurement of the gradient component in each orientation, Gx and Gy. The gradient magnitude is given by |πΊ| = √πΊπ₯ 2 + πΊπ¦ ----- (II) An approximate Magnitude is computed using |G| = |Gx| + |Gy| ----- (III) 3.5. Zerocross edge detection It uses Laplacian of the second derivative and it includes Laplacian operator. It is having fixed characteristics in all directions and sensitive to noise. Haralick proposed the use of zero-crossing of the second directional derivative of the image intensity function. The edges determined by zerocrossing form numerous closed loops. Zerocrossing methods are of interest because of their noise reduction capabilities and potential for rugged performance. 3.6. Laplacian of Gaussian edge detection The Laplacian of Gaussian was proposed by Marr (1982). The LOG of a document image f(x, y) is a second order derivative defined as ∇2 π = π2 π ππ₯ 2 + π2 π ππ¦ 2 ----- (IV) The purpose of the Laplacian operator is to provide a document image with zero crossing used to establish the location of edges. In 1980, was invented by Marr and Hildreth. The Gaussian filtering is combined with Laplacian to break down the document image where the intensity varies to detect the edges effectively. The Laplacian is a 2-D isotropic measure of the 2nd spatial derivative of a document image. The Laplacian of a document image highlights regions of rapid intensity change and is therefore often used for edge detection. The Laplacian is often applied to a document image that has first been smoothed with something approximating a Gaussian Smoothing filter in order to reduce its sensitivity to noise. The operator normally takes a single gray level image as input. It has two ways, it smoothes the document image and it computes the Lapalcian, which yield a double edge image. The digital implementation of the Laplacian function is made through the mask as above; the Laplacian is basically used to found whether a pixel is on the dark or light side of an edge. 0 -1 0 -1 -1 -1 -1 4 -1 -1 8 -1 0 -1 0 -1 -1 -1 Gx Localization and response. Better detection specially in noise conditions consuming 5. EXPERIMENTAL RESULT The edge detection methods were implemented by using MATLAB R2011b and tested with a document image from UCDAR-UK Database. The objective is to produce a clean edge map by extracting the principal edge features of the document image. Gy 4. ADVANTAGES AND DISADVANTAGES OF EDGE DETECTION TECHNIQUE Edge detection is the fundamental part in computer vision; it is need to point out the true edges to get the output from the observation. We present some of advantages and disadvantages on the basis of implemented edge detection methods are as follows. [15, 16] Operator Advantages Disadvantages Classical (Sobel, Prewitt) Simplicity, Detection of edges & their orientation Sensitivity to noise, Inaccurate Zero Crossing (Laplacian, Second directional derivative) Detection of edges and their orientations. Having fixed characteristic in all directions Responding to some of the existing edges, sensitivity to noise Laplacian of Gaussian(L oG) Finding the correct places of edges, Testing wider area around the pixel Malfunctioning all the corners curves and where the gray level intensity function varies. No finding the orientation of edge because of using the Laplacian filter Gaussian (Canny) Using probability for finding error rate. Complex Computations, False zero crossing, Time There are many ways to perform edge detection for the document images. The edge detection method may be grouped into two categories Gradient and Laplacian. The gradient method detects the edges by looking for the maximum and minimum in the first derivatives of the document image. The Laplacian method searches for the zerocrossing in the second derivative of the document image to find edges. The original document image obtained by using different edge detection methods are given in figure. (a) (c) (e) (b) (d) (f) methods. Robert edge detectors highlights the regions of high spatial frequency which corresponds to edges. Zerocrossing edge detector is having the fixed characteristics in all directions and sensitive to noise. The Laplacian is applied to a document image that has first been smoothed with something approximating a Gaussian Smoothing filter in order to reduce its sensitivity to noise. (g) (h) Fig. (a) Original document Image (b) Grayscale Image (c) Prewitt method (d) Sobel method (e) Canny method (f) Roberts method (g) Zerocross method (h) Laplacian of Gaussian mehtod. The classical methods for accurate detection of edge features, as exemplified by canny operators, demands such expensive operation as iterative use of Gaussian, Laplacian. In the above figure, We considered Color Document Image as input from UCDAR-UK database and it is converted into grayscale or a binary document image, and returns a binary document image of the same size, with 1’s where the function finds edges in image and 0’s elsewhere. Figure shows (a) Original Document Image (b) Grayscale or a binary document image (c) The Prewitt method finds edges using the prewitt approximation to the derivative. It returns edges at those points where the gradient of document image is maximum. (d) The Sobel method finds edges using the sobel approximation to the derivative. It returns edges at those points where the gradient of document image is maximum. (e) the most powerful edge detection method that edge provides is the canny method. The Canny method finds edges by looking for local maxima of the gradient of a document image. The gradient is calculated using the derivative of a Gaussian filter. The method uses two thresholds, to detect strong and weak edges, and includes the weak edges in the output if they are connected to strong edges. This method is therefore less likely than the others to be fooled by noise, and to detect true weak edges. This method’s result is better than all other methods of edge detection technique. (f) The Roberts method finds edges using the Roberts approximation to the derivative. It returns edges at those points where the gradient of document image is maximum. (g) The Zerocross method finds edges by looking for zero crossing after filtering document image with a filter specify. (h) The Laplacian of Gaussian method finds edges by looking for zero crossing after filtering document image with a Laplacian of Gaussian filter. 7. CONCLUSION 6. COMPARISON OF EDGE DETECTION Edge detection is a challenging problem. The Prewitt and Sobel edge detector is a simple and appropriate way to estimate the magnitude and orientation of an edge and it is well known edge detectors. Canny edge detector is one of the best, standard and powerful edge detectors; its results are best as compared to other edge detectors or the In this paper we have implemented document image segmentation based on edge detection methods both of the gradient and laplacian. Edge Detection provides more information about the document image being detected. The sobel edge detector or operator has been good edge detector as shown in above result. The canny edge detector is one of the best edge detection methods for the better performance, standard and more powerful as compared to other edge detection methods. 8. ACKNOWLEDGEMENTS The authors are thankful to the University Grant Commission, New Delhi for supporting this work as a part of Major Research Project. REFERENCES [1] Umbaugh scott E (2010) . Digital Image processing and analysis: human computer vision applications with CVIPtools(2nd ed. ed.). Boca Raton, FL: CRC press. ISBN 9-7814-3980-2052. [2] Rafael C. Gonzalez, R. E. (2005). Digital Image Processing. University of Tennessee, Meddata Interactive. [3] Manish T. Wanjari, Dr. Mahendra. P. Dhore (2014). Segmenting Document images using Edge Detection Technique . National Conference on Recent Advances in Electronics and Computer Science-NCRAECS-2014, (pp. 249-253). Nagpur. [4] Ms. Priyanka S. Chikkali, Prof. K. Prabhushetty (2011). FPGA based image Edge detection and Segmentation . International Journal of Advance Engineering science and Technologies, Vol. No. 9 issue No. 2. , 187-192. [5] M. T. Wanjari, K. D. Kalaskar & Dr. M. P. Dhore, Document Image Segmentation Techniques : A Review. proceeding of (ICETSTM – 2013) International Conference in Emerging Trends in Science. Technology and Management-2013. Singapore. pp.147-153, ISBN 2250-0593. [6] M. T.Wanjari & Dr. M.P. Dhore, Document Image Segmentation using Region Growing Approach. Proceeding of National Seminar Technological Resources in Language Teaching and Lerning. pp. 351-356. ISBN 978-93-83132-16-4. [7] Muthukrishnan.R and M.Radha (Dec. 2011). Edge Detection Techniques For Image Segmentation. International Journal of Computer Science & Information Technology (IJCSIT) Vol 3, No 6. [8] N. Senthilkumaran and R. Rajesh, Edge Detection Techniques for Image Segmentation - A Survey. Proceedings of the International Conference on Managing Next Generation Software Applications (MNGSA-08), 2008, pp.749-760. [9] R. Haralick, Digital step edges from zero crossing of second directional derivatives. IEEE Trans. on Pattern Analysis and Machine Intelligence, 6(1):58– 68, 1984. [10] R. Kimmel and A.M. Bruckstein, On regularized Laplacian zero crossings and other optimal edge integrators. International Journal of Computer Vision, 53(3) pages 225-243, 2003. [11] Shapiro L.G. & Stockman G.C., Computer Vision. London etc.: Prentice Hall, Page 326, 2001. [12] R. Deriche, Using Canny's criteria to derive an optimal edge detector recursively implemented. Int. J. Computer Vision, vol. 1, pages 167–187, 1987. [13] I. E., Sobel, (1970). Camera Models and Machine Perception. Ph.D. Electrical Engineering Departmrnt, standford university, standford C.A. Yan, M. H., (Octomber-1992). Segmentation of color images using spatial and color space information. Journal of Electronic Imaging, vol. 1 , 374-380. [14] M. Hedley and H. Yan, Segmentation of color images using spatial and color space information. Journal of Electronic Imaging, vol. 1, pp. 374-380. October 1992. [15] R. A. Kirsch, Computer determination of the constituent structure of biomedical images. Comput. Eiorned. Res., vol. 4, pp. 315-328, 1971. [16] T. Peli and D. Malah. A Study of Edge Detection Algorithms”, Computer Graphics and Image Processing, vol.20, pp. 1-21, 1982.