SumitBirla.com

Home » Software » Image Processing II » Edge Detection

Assignment 4: Edge Detection

This assignment dealt with edge detection using the Sobel operator. The Sobel operator yields a gradient amplitude and a direction component for each edge pixel. This information was used to process the image in different ways.

dxdy
-101
-202
-101
121
000
-1-2-1
The Sobel Operator (3x3)


Source Code:

Using Gradient Amplitude Information


Gradient image

The Sobel operator gives an estimate of the change of intensity at a given pixel in relation to it's neighbors. This number is usually high at the edges where intensity values jump from a low value to a high value or vice versa. By applying a thresold on this gradient information, a binary image containing edges can be extracted. Unfortunately this has the side effect of showing edges that we (humans) may not perceive as edges or boundaries. The examples below illustrate this problem.



Examples of Gradient Thresholding:


lax.pgm (original image)

threshold = 8

threshold = 15

threshold = 30

We would expect only the buildings to produce edges, but in the image, we see a lot of stray edges due to local high gradients in those places.


Using Gradient Amplitude and Direction Information

The direction of an edge can be computed from the gradients in the x and y directions:
angle = tan-1(dy/dx)
In images with some known information, for example: the orientation of buildings in lax.pgm, the direction component can be used to pick out edges of just those structures. One must take into account the crude angle measurement obtained from the Sobel operator and implement a tolerance range. In my case this was set to +/- 10 degrees.


threshold = 10, direction = 10

threshold = 10, direction = 100


Ways to improve results

Smoothing can be used as a preprocessor for edge detection. It results in fewer stray edges and generally less of small edges. This is because smoothing eliminates noise and other small regions that do not contribute to the edges. The result is a clearer image showing only the prominent edges. Shown below are the results of edge detection after a) a low pass filter was applied, b) Gaussian Smoothing was performed.


lax.pgm (original image)

Low Pass filter

threshold = 10

lax.pgm (original image)

Gaussian smoothing

threshold = 10


Conclusion:

Although the Sobel operator provides a simple way to perform edge detection, it lacks the "intelligence" to work well on images with different characteristics (eg. light intensity). The user has to experiment with different thresholds in order to come up with an acceptable result. There may be other algorithms better suited for this task.