Edge Detection
Edge Detection
Edge detection is a fundamental image processing technique for identifying and locating the
boundaries or edges of objects in an image. It is used to identify and detect the
discontinuities in the image intensity and extract the outlines of objects present in an image.
The edges of any object in an image (e.g. flower) are typically defined as the regions in an
image where there is a sudden change in intensity. The goal of edge detection is to highlight
these regions.
Types of edges:
How It Works:
1. Gradient Calculation: The first-order derivative measures how quickly the intensity
of pixels changes in an image. The gradient is a vector that points in the direction of
the steepest increase in intensity.
o The magnitude of the gradient indicates the strength of the edge.
o The direction of the gradient indicates the orientation of the edge (horizontal,
vertical, or diagonal).
2. Edge Detection: If the gradient magnitude at a pixel exceeds a certain threshold, that
pixel is classified as part of an edge.
Common Techniques for First-Order Derivative Edge Detection:
Sobel Operator: The Sobel edge detection method is introduced by Sobel in 1970 (Rafael
C.Gonzalez (2004)). The Sobel method of edge detection for image segmentation finds edges
using the Sobel approximation to the derivative. It precedes the edges at those points where
the gradient is highest. The Sobel technique performs a 2-D spatial gradient quantity on an
image and so highlights regions of high spatial frequency that correspond to edges. In
general it is used to find the estimated absolute gradient magnitude at each point in n input
grayscale image. The Sobel operator uses convolutional masks to approximate the first-
order derivatives in both the horizontal (Gx) and vertical (Gy) directions.
Prewitt Operator: Similar to the Sobel operator but uses different convolutional
masks for approximating the derivatives. The Prewitt edge detection is proposed by
Prewitt in 1970 (Rafael C.Gonzalez [1]. To estimate the magnitude and orientation of an
edge Prewitt is a correct way. Even though different gradient edge detection wants a quite
time consuming calculation to estimate the direction from the magnitudes in the x and y-
directions, the compass edge detection obtains the direction directly from the kernel with
the highest response. It is limited to 8 possible directions; however knowledge shows that
most direct direction estimates are not much more perfect. This gradient based edge
detector is estimated in the 3x3 neighborhood for eight directions. All the eight convolution
masks are calculated. One complication mask is then selected, namely with the purpose of
the largest module.
Vertical Sobel Kernel (G y)
-1 -1 -1
0 0 0
1 1 1
-1 0 1
-1 0 1
-1 0 1