Edge detection is an image-processing technique used to detect boundaries in an image. It is widely used in the field of computer vision, data visualization, and surface topology. For example, the pencil sketch effect of an image is nothing, but an application of edge detection algorithm. This recipe will demonstrate the edge detection technique using the Sobel operator or filter.
A Sobel filter measures the change in the gradient of an image in which it recognizes the regions of an image where the frequency of the color transition is higher. These higher transition regions shows sharp changes in the gradient that eventually correspond to the edges. The Sobel operator uses convolution kernels to detect the edge portions in the image. A convolution kernel is a matrix that contains predefined weights that formulate the calculation of the current pixel based on the neighboring pixels intensity and weights contained in the convolution matrix itself...