Filters and Fourier Transforms. Traveling back to Applied Physics 185 in 2009.

 I recently started taking Udacity's course on Computer Vision. As I go through my lessons, 5th now to be exact, I can't help but compare it to my courses in Applied Physics with Dr. Maricar Soriano back in the day! I even have a dedicated blog for it. It's really good to uncover these concepts from my baul.

This brings back a LOT of memories from way back in 2009, when I was just a student who was passing my requirements for the sake of passing the course (Applied Physics 185 to be exact). I mean when you're a student, you don't get to appreciate all these because of the pressure of getting a grade. Fast forward to now. Here I am, revisiting those exact concepts simply because I am curious and wanted to learn them by heart.

And they call it Computer Vision (how sassy is that?). I simply used to call it image processing. Anyways,  so back to filters it is!

So for this post, we'll be focusing our attention on the image of a brain.

In order to extract important features from images (edges, non-edges), normally we use filters or kernels that we convolve with images. So far, four types of filters have been introduced.

  1. Gaussian - used to blur out the image to be able to reduce the effect of high frequency noise 

  2. Sobel_x - used to detect vertical edges 

  3. Sobel_y - used to detect horizontal edges

  4. Laplace - used to detect edges regardless of orientation 

And now, we're just curious how these filters look like in the frequency domain. What we have seen previously are in the space domain. After performing a fast fourier transform on each filter and scaling them, we get the following:

Areas of white or light gray, allow that part of the frequency spectrum through! Areas of black mean that part of the spectrum is blocked out of the image. Recall that the low frequencies in the frequency spectrum are at the center of the frequency transform image, and high frequencies are at the edges. You should see that the Gaussian filter allows only low-pass frequencies through, which is the center of the frequency transformed image. The sobel filters block out frequencies of a certain orientation and a laplace (all edge, regardless of orientation) filter, should block out low-frequencies!

Applying the four filters on the image of the brain separately gives us the following:

Notice how the gaussian filter "softens" out the image by allow low frequencies to pass through. Sobel_x (Sobel_y), on the other hand, emphasizes vertical (horizontal) edges. Laplacian filter focuses on all edges. But there is a lot more room for improvement here. Just excited I am back into image processing.

One of the best and most widely used edge detector is known as the Canny edge detector because it goes through a series of steps:

Step 1: Uses Gaussian filter to filter out noise.
Step 2: It detects edges using Sobel filters
Step 3: Applies non-maximum suppression to isolate the strongest edges and thin them out to one-pixel wide lines
Step 4: Uses hysteresis to isolate the best edges by applying a double threshold as summarized in the picture below. An edge which falls between the low and high threshold will only be kept when they are connected. Thus it emphasizes important edges!





Comments

Popular Posts