Introduction to the Fourier Transform

Edge Detection

Last but not the least, let’s go back to convolution. Rather than just being a way to simulate an imaging system, it has many more applications. One of these is Edge Detection.

First, what is an ‘edge’? It can be described as the border between two regions that have distinct values. In addition, it is also characterized as having high contrast. In binary images, a typical vertical edge looks like this:

VertEdge
Binary vertical edge

Note that there is a sudden change from 0 to 1. The filter to detect such an edge is as follows:

VertFilt
Vertical Edge Filter

This filter is applied by scanning it across all the points in an image. Assume that this filter is acting on pixel A. The filter is multiplied term-by-term with the same-sized matrix centered about pixel A. The products are then added together, and this sum will be the new value of the pixel A.

What is the effect of this?

If the filter acts on a uniform area, the filter returns a zero, like so:

1.) All 1’s ->  1 (-1 -1 -1 + 2 + 2 + 2 -1 -1 -1) = 0

2.) All 0’s -> 0 (-1 -1 -1 + 2 + 2 + 2 -1 -1 -1) = 0

If it acts on a vertical edge, we get a value.

1.) 0 (-1-1-1) + 1(2+2+2) + 1(-1-1-1) = 3

Hence, the filter picks out and enhances the vertical edges. There are also other filters such as the two found below.

HorzFilt
Horizontal Filter
SpotFilt
Spot Filter

To easily implement these scanning filters, we again utilize the Fourier Transform. Recall that a scanning filter functions like a convolution; i.e., the filter is convolved with the image. Hence, instead of using for loops to scan the entire image, we can just take the product of their Fourier Transforms. This also has the advantage of avoiding the indexing problem at points at the border of the image (since the filter will be centered at these points, the space around these points must have some values).

Here are the results after applying the three filters to the ‘VIP’ text used in the previous convolution section. From left to right: original image, and the results after applying the vertical filter, horizontal filter and spot pattern.

VIP2_1_3_

As can be observed, the vertical filter successfully located the vertical edges, even the mostly vertical portions of the curves in ‘P’. The horizontal filter also located the horizontal edges at the top of ‘V’, ‘I’ and ‘P’. For detection of all edges, however, the spot pattern is the best as it simultaneously found the horizontal and vertical edges.

Leave a comment