1 min read 27 views

Sobel Edge Detection

Edge Detection includes a variety of mathematical methods that helps us to identify points in an image where the image has some sort of discontinuities. Edge Detection is an important tool which is used extensively for feature detection and feature extraction in the field of digital image processing. 

Sobel Edge Detectior  is a edge detection implementation used in image processing where it creates an image emphasising edges. In Sobel Edge Detection, the image is processed in the X and Y directions seperately which is later combined together to form a new image. The new array formed after combination of the first two arrays represents the sum of the X and Y edges of the image. If A is the original image,  the following operation can be used for sobel edge detection in the X-axis. 

\(G_x = 1/4\begin{bmatrix} -1 & 0 & 1\\ -2 & 0 & 2 \\ -1 & 0 & 1 \end{bmatrix} * A \)

Similarly, we can compute it in the Y-direction as: 

\(G_y = 1/4 \begin{bmatrix} 1 & 1& 1\\ 0 & 0 & 0 \\ -1 & -2 & -1 \end{bmatrix} * A\)

Here Gx and Gy represent the vertical and horizontal derrivative approximations of the input Image respectively. We can combine the gradient approximation to give the gradient magnitude using: 

\(G = \sqrt{G_x ^{2} + G_y^{2} } \)

Below I provide an implementation of the Sobel Edge Detection in Python. The two images show the effects on image before and after the application of Sobel Edge Detection.