Sobel Edge Detection Filter

Submitted by: Aaron Brooks - Brent Bolton - Jason O'Kane

Algorithm

Horizontal Kernel
-1 -2 -1
0 0 0
+1 +2 +1
 
Vertical Kernel
-1 0 +1
-2 0 +2
-1 0 +1
Two 3x3 convolution masks are applied to each pixel, one color at a time - one with a horizontal trend and one with a vertical trend. The result of the each convolution is treated a vector representing the edge through the current pixel. If the magnitude of the sum of these two orthogonal vectors is greater than some user-specified threshold, the pixel is marked in black as an edge. Otherwise, the pixel is set to white.

Run Time Assessment

  Hardware Approximate Run Time
Bolton, Brooks, and O'Kane CSS Linux workstation 11 sec
Digital Darkroom, IP Toolkit CSS Multimedia workstation 7 sec
Understandably, this filter runs slowly. At each pixel, two 3x3 convolutions (requiring 9 multiplications each) are made, followed by an expensive square root calculation.

Results

The algorithm works well - the main edges of the image can be seen clearly. However, some possibly undesirable features can be seen on the can itself - probably resulting from the droplets of condensed water in the original image. These might possibly be eliminated by adjusting the threshold.

Several factors account for the differences seen between our results and the results from the IP tooklit:

Our filter begins by converting the image to grey-scale. The approach taken by the IP Toolkit filter is not known. One possibility is to convert the image to an HSI representation and perform processing on the I value. It is also reasonable to detect edges in the H or S values as well. The precise approach chosen should depend on the type of image being processed and the nature of the edges being detected.

Source Code

Test Images

Original Image


After edge detection (Bolton, Brooks, and O'Kane)
After edge detection (Digital Darkroom, IP Tooklit)