Edge detection is a technique used in image processing to find the boundaries of the objects within the image. The edges are identified based on the abrupt local changes of brightness, also called discontinuities in brightness.
Edges represent the boundaries between two different regions within an image. More precisely, the edge of an object within a digital image is the set of contiguous pixels where an abrupt change of intensity occurs. However, these changes are sometimes too subtle to be noticed, making edge detection a highly complex process.
Image processing can be performed on an image after the information from the image has been captured. Edge detection serves as the first step of image processing, but the question remains how do we detect edges? Well, to understand that, let's consider a simple example given below.
In this example, we take a digital image containing 25 pixels (5 by 5) only for the sake of simplicity. As seen in the illustration below, some pixels are darker, and some are brighter. Each of these pixels has different intensities, as represented in the matrix below:
The first approach that comes to mind is to consider the intensity of a pixel and compare it with its neighboring pixels, but this approach is not good enough to detect small changes. So we consider an alternate approach explained in the illustration below:
The matrix used in the illustration is known as the kernel. It belongs to an operator used in edge detection, more specifically, the Prewitt kernel in the Y-direction. The kernel iteratively calculates the multiplication result on all the pixels and their neighbors to detect the edge within a digital image.
Prewitt kernel in the Y-direction successfully detects if a pixel exists on the edge, but this was the case when the edge was straight. But what if the edge was diagonal? Well, another operator called the Robert operator is used, which has a kernel of 2 by 2 given as follows:
Prewitt and Robert’s operators are some of the few used to detect the edge, each with its advantages and disadvantages over its counterparts.
The operators are given as follows:
Prewitt operator
Sobel operator
Robert operator
Marr-Hildreth Operator or Laplacian of Gaussian (LoG)
Canny operator
Edge detection serves as the base for many image processing techniques, requiring the features extracted by edge detection. It reduces the image’s size while preserving its structural properties. The applications of edge detection are as follows:
Face recognition
Computer vision
Machine vision
Fingerprint recognition
Medical imaging
Vehicle detection (traffic control)