# Understanding Gabor Filters

In the field of image processing, filters play an extremely important role. If you don’t know what a filter is, you may quickly want to read the wiki article and come back. Otherwise, this post will not make much sense to you. All image processing operations can be viewed as applying a series of filters to an image and transforming it in some way. We do this for a variety of reasons, like understanding the content of images, transforming the images into another domain, detecting the presence of something in the images, and so on. Gabor filter is a particular type of filter, and it happens to be an important one. If you google “Gabor filter”, you will get a lot of articles. So in this post, rather than looking at the mathematics behind it, we will try to understand the underlying concept. Let’s go ahead, shall we?

Why do we need this filter?

Let’s say you are trying to extract the edges from an image. These edges might be in any shape, size and orientation. When you apply a filter to an image, you basically modify each pixel in that image and extract some information from it. If you apply the same rule across the entire image, it might not be efficient. To give a fairly simple demonstrative example, an image might contain both horizontal and vertical edges. Now you design a filter that detects sharp horizontal edges very well. But what about those vertical edges? What about the edges that are not sharp? To take care of it, you design another filter which detects vertical edges. Going by this logic, does it mean that we need to design a separate filter for all of them? That’s not very efficient! Natural images usually tend to have a large number of shapes and sizes. How do we cater to all the different types? This is where Gabor filter comes into picture.

What is a Gabor filter?

Gabor filters are orientation-sensitive filters, used for edge and texture analysis. It is named after Dennis Gabor, a brilliant Nobel prize winning physicist. A Gabor filter can be viewed as a sinusoidal plane of particular frequency and orientation, modulated by a Gaussian envelope. Wait, what does that even mean? Well, I can go into the mathematical explanation behind it, but that’s not what we want to do here. Basically, it means that Gabor filter is mathematically structured in such a way that it can take care of different shapes, sizes and smoothness levels in the image. A Gabor filter oriented in a particular direction gives a strong response for locations of the target images that have structures in this given direction. For example, if your target image is made up of edges in the diagonal direction, a Gabor filter set will give you a strong response only if its direction matches with the direction of the edges. It’s like pouring a solidifying liquid onto a unknown rigid structure. Once it solidifies and you take a look at the solidified form, it looks like the surface of the structure. Gabor filter does something similar for images!

Why is this so important?

Gabor Filters have received considerable attention because they closely resemble the human visual system. All these attempts to design good filters are aimed at mimicking the human visual cortex. Humans have an uncanny ability to process visual data and distinguish things with extreme ease. Machines, not so much! The characteristics of certain cells in the visual cortex of some mammals can be approximated by these Gabor filters. In addition, these filters have been shown to possess optimal localization properties in both spatial and frequency domain. What this means is that you don’t have to worry about designing something that will fit all the cases. It will mould itself to suit different scenarios, like smoothness, orientation, scale, etc, of these edges. This is the reason they are well suited for edge detection and texture segmentation problems.

Where are they used in real life?

Gabor filters have been used in many applications, such as:

• Texture segmentation: Gabor filters are used to separate multiple textures in an image. This analysis is critical in a lot of fields, including space missions where they have to traverse unknown terrains.
• Optical character recognition: To automatically recognize handwritten letters, number plates, billboards, etc.
• Object Recognition: Gabor filters and their modified versions are used extensively in computer vision. Since they can closely mimic the human visual system, they are used in designing object recognition systems.
• Fractal dimension management: Fractals are basically self-similar patterns. They are actually quite fascinating! You can google about it if you want to learn more.
• Edge detection: Detecting the edges in an image is preprocessing step in many image processing systems.
• Retina identification: Identifying the retina of humans reliably. Very important in security!
• Image coding: The encoding of images is used almost everywhere for transmission.

————————————————————————————————-