Gabor filter for image processing and computer vision

N. Petkov and M.B. Wieling, University of Groningen,
Department of Computing Science, Intelligent Systems

This page contains examples concerning a simulation program available on internet.

On this site you can: visualize Gabor functions, use a Gabor filter for edge detection and extraction of texture features, simulate simple and complex cells (visual cortex), simulate non-classical receptive field inhibition or surround suppression and use it for object contour detection, and explain certain visual perception effects.


0) Gabor filter

Select the following parameter values: This filter deploys an antisymmetric Gabor function (phase offset 90 or -90 degrees) and gives a maximum response at an edge. Observe the response of the filter to the edge (black to white transition) in the lower part of the input image. The response is maximal exactly at the edge. There are two flanking responses (and you can observe a larger number of such flanking responses if you take a smaller bandwidth, e.g. 0.5) that are due to the ripples of the Gabor function, but you can remove them by enabling halfwave rectification with a HWR threshold=40(%).

Take now a filter that deploys a symmetric Gabor function (phase offset 0 or 180 degrees). Observe the response of that filter to the concerned edge - the maximum is shifted from the edge, there are actually two maxima - one to the left and the other to the right of the edge. A the same time, a symmetric filter gives a maximum response to a line of appropriate width whereby the response is centered on the line - observe the response of the filter to the vertical line in the middle of the image.

To conclude, symmetric and antisymmetric Gabor filters are good (localization) detectors of lines and edges, respectively. You can read more on this in references [2] and [3]. A complex Gabor function that combines a symmetric real and an antisymmetric imaginary part has optimal joint localization properties in the spatial and the spatial frequency domain (see reference [1]).

1) Gabor energy filter

Select the following parameter values: Observe that the responses to all lines and edges in the output image are (approximately) equally strong. (See also Fig.7 in reference [6] and Fig.6 in reference [7].)

A positive aspect of the Gabor energy filter in comparison with the simple linear Gabor filters (see Example 0) is that this filter gives a smooth response to an edge or a line of appropriate width with a local maximum exactly at the edge or in the center of the line. If you now apply thinning on this response, you will get one thin line that follows the corresponding edge or line. In contrast, the simple linear Gabor filters give flanking responses (due to the ripples of the Gabor function). Without appropriate local half-wave rectification, these flanking responses can cause problems in the thinning stage. (We thank Dr. John Daugman for his comments on this aspect of the Gabor energy filter.)

The Gabor energy filter is often used in texture processing, see references [4] and [5].

2) Effect of anisotropic surround inhibition

Most of the parameters have values as in Example 1 but surround inhibition is enabled. Observe that the strength of the response to lines that are part of the vertical and oblique gratings is reduced compared to Example 1. Increase the value of Alpha (strength of surround inhibition) to 1.5 to further decrease these responses, and then to 2 to see how they disappear completely. In contrast, the response to the vertical line where it is not surrounded by other such lines remains strong. (See also Fig.7 in reference [6] and Fig.6 in reference [7].)

3) Effect of isotropic surround inhibition

All parameters but Select inhibition type have the same values as in Example 2. Choose: Increase Alpha from 1 to 1.5 and then to 2 to observe how the response to all lines that are surrounded by other lines will decrease and finally completely disappear (for Alpha = 2). (See also Fig.7 in reference [6] and Fig.6 in reference [7].)

4) Orientation-contrast pop-out and its relation to anisotropic surround inhibition

The input image popout.png illustrates a perceptual effect know as orientation-contrast pop-out. A single vertical bar that is embedded in a group of horizontal bars segregates, or "pops out", from its surrondings.

a) Gabor-energy filtering
A pixel value in the output models the response of a complex cell that is responsible for that point of the visual field. Select the following parameter values:

Observe that the responses to all bars in the output image are (approximately) equally strong. Hence, the responses of complex cells according to the Gabor-energy model cannot explain the difference in the perception of the single vertical bar vs. the group of horizontal bars.

b) Gabor-energy filtering augmented with anisotropic surround inhibition
Select the parameter values as under a) above, but now set

Carry out a series of simulations in which you increase the value of the parameter Alpha, starting with and increasing it to Alpha = 3 and then Alpha = 4.

Observe how the responses to the horizontal bars in the output image are reduced due to the surround suppression mechanism in which bars of the same orientation inhibit each other. The response to the vertical bar is not inhibited because this bar is alone - there is no other such bar in its vicinity. This type of suppression is called anisotropic because the strength of response suppression depends on the mutual orientation of the stimuli: it is strongest for parallel and weakest for orthogonal stimuli. (See also Fig.7 in reference [6] and Fig.6 in reference [7].)

5) Decreased saliency of contours embedded in gratings and its relation to anisotropic surround inhibition

Select as an input image triangle.png. It is a modified version of an image due to Galli and Zama [1931 Zeitschrift für Psychologie 31 308-348]. A triangle is superimposed on a grating of bars. While two of the triangle's legs are very salient, the third leg which coincides with one bar of the grating is not perceived as part of the triangle at all: our visual system groups it with the grating bars rather than with the other legs of the triangle.

Select the following parameter values:

Start with inhibition strength which corresponds to no inhibition. Observe that there is strong response (indicated by light colour) in the output image in the area covered by the grating in the input image. The response to the two legs of the triangle which are not parallel to the grating bars is weaker. This is in contrast to the perceived strong saliency of these two legs.

Increase the inhibition strength Alpha first to Alpha = 0.7, then to Alpha = 1 and then to Alpha = 2.

For Alpha = 0.7 the response to the bars of the grating is approximately as strong as the response to the two legs of the triangle. This is achieved by reducing the response to the grating due to surround inhibition: the responses to the bars of the grating inhibit each other and all such responses are collectively reduced. No such suppression is excercised on the legs of the triangle which have different orientation.

For Alpha = 1 the response to the bars of the grating is further reduced and is considerably smaller than the response to the two legs of the triangle. This mimicks the observed effect of increased saliency of these two legs vs. the third leg that is part of the grating.

For Alpha = 2 only response to the two concerned legs of the triangle is observed in the output. (See also Fig.8 in reference [6].)

6) Biological utility of surround inhibition - enhancement of occluding contours and region boundaries by suppression of texture edges

Rhino original image a) Gabor-energy filtering.
Select the following parameter values:
  • Input image = rhino.png
  • Wavelength = 4 ; Orientation(s) = 0 ; Phase offset(s) = 0, 90 ; Aspect ratio = 0.5 ; Bandwidth = 1 ; Number of orientations = 16
  • Enable HWR = not checked
  • Superposition of phases = L2 norm
  • Select inhibition type = No surround inhibition
  • Enable thinning = checked ;
  • Enable hysteresis thresholding = checked ; T-low = 0.00005 ; T-high = 0.052
Rhino Gabor image Observe that the contours of the rhinocerus are detected in the output image but that the edges of the grass texture are detected as well. Most of the edges found by the operator are actually due to the texture and dominate the output image. This output is not very useful for contour based object recognition because of the noise effect of the texture edges.

Rhino Suppression image b) Gabor-energy filtering augmented with surround inhibition
Select the parameters as above but now choose in addition the following values:
  • Select inhibition type = Isotropic surround inhibition ; Alpha = 2 ; K1 = 1 ; K2 = 4 ; Superposition method for the inhibition term = L-infinity norm
Observe how the texture edges disappeared from the output image that is now dominated by the contours of the rhinocerus. This output image is more useful for contour based object recognition. The observed effect supports the idea that the biological utility of non-classical receptive field inhibition is the quick pre-attentive detection of contours and their separation from texture edges. This would help a human or an animal to quickly detect an object of interest in a surroundings rich in texture edges. (For further information on this topic, see references [6] and [7].)

7) Filter bank of Gabor energy filters for texture processing (MPEG-7 browsing descriptors)

Gabor filters are often used for texture processing. For instance, in the MPEG-7 standard, texture browsing descriptors are defined and used that are based on Gabor filters as follows. A bank of Gabor filters with different preferred orientations and wavelength are applied to an image. Each of these filters gives as a result a two-dimensional array of the same size as the input image. The sum of all elements in one such array is a number that can be used as a descriptor of the input image regarding the presence of edges of the corresponding orientation and spatial frequency. In the MPEG-7 standard 6 preferred orientations and 5 preferred wavelengths are used, resulting in a bank of 30 filters that are used to compute the values of 30 descriptors. These descriptors are used for browsing in image data bases.

For texture analysis, the elements of the two-dimensional array that is output by a Gabor filter are not summed together. Rather, the outputs of the different Gabor filters used in a filter bank for a given image position (pixel) are combined in a vector that is associated with the considered pixel. The number of elements in that vector is equal to the number of filters in the bank. The vectors associated with the different pixels can be used, for instance, for segmentation. For further information on this, see references [4] and [5].

Below we give an example of how to use the program to compute the above mentioned outputs of Gabor energy filters for six preferred orientations and one preferred wavelength. To compute outputs for a different wavelength, the steps given below have to be repeated for each wavelength value that is needed. Select the following parameter values:

After you press the button 'update view' the outputs of the above six Gabor filters will be computed and their maximum value (per pixel) will be displayed in the output window. Now you can select one by one each of the preferred orientations used (by using the select window at the bottom of the page and pressing the button 'change orientation') and visualize and store the outputs of the filters separately.
Last changed: 2008-07-03