
In
image processing
An image is a visual representation of something. It can be two-dimensional, three-dimensional, or somehow otherwise feed into the visual system to convey information. An image can be an artifact, such as a photograph or other two-dimension ...
, a Gabor filter, named after
Dennis Gabor
Dennis Gabor ( ; hu, Gábor Dénes, ; 5 June 1900 – 9 February 1979) was a Hungarian-British electrical engineer and physicist, most notable for inventing holography, for which he later received the 1971 Nobel Prize in Physics. He obtained ...
, is a
linear filter
Linear filters process time-varying input signals to produce output signals, subject to the constraint of linearity. In most cases these linear filters are also time invariant (or shift invariant) in which case they can be analyzed exactly using ...
used for
texture analysis, which essentially means that it analyzes whether there is any specific frequency content in the image in specific directions in a localized region around the point or region of analysis. Frequency and orientation representations of Gabor filters are claimed by many contemporary vision scientists to be similar to those of the
human visual system
The visual system comprises the sensory organ (the eye) and parts of the central nervous system (the retina containing photoreceptor cells, the optic nerve, the optic tract and the visual cortex) which gives organisms the sense of sight (the a ...
. They have been found to be particularly appropriate for texture representation and discrimination. In the spatial domain, a 2-D Gabor filter is a
Gaussian kernel function modulated by a
sinusoidal
A sine wave, sinusoidal wave, or just sinusoid is a mathematical curve defined in terms of the '' sine'' trigonometric function, of which it is the graph. It is a type of continuous wave and also a smooth periodic function. It occurs often in ...
plane wave
In physics, a plane wave is a special case of wave or field: a physical quantity whose value, at any moment, is constant through any plane that is perpendicular to a fixed direction in space.
For any position \vec x in space and any time t, t ...
(see
Gabor transform).
Some authors claim that simple cells in the
visual cortex
The visual cortex of the brain is the area of the cerebral cortex that processes visual information. It is located in the occipital lobe. Sensory input originating from the eyes travels through the lateral geniculate nucleus in the thalamus and ...
of
mammalian brains can be modeled by Gabor functions. Thus,
image analysis
Image analysis or imagery analysis is the extraction of meaningful information from images; mainly from digital images by means of digital image processing techniques. Image analysis tasks can be as simple as reading bar coded tags or as sophi ...
with Gabor filters is thought by some to be similar to perception in the
human visual system
The visual system comprises the sensory organ (the eye) and parts of the central nervous system (the retina containing photoreceptor cells, the optic nerve, the optic tract and the visual cortex) which gives organisms the sense of sight (the a ...
.
Definition
Its
impulse response
In signal processing and control theory, the impulse response, or impulse response function (IRF), of a dynamic system is its output when presented with a brief input signal, called an impulse (). More generally, an impulse response is the reac ...
is defined by a
sinusoidal
A sine wave, sinusoidal wave, or just sinusoid is a mathematical curve defined in terms of the '' sine'' trigonometric function, of which it is the graph. It is a type of continuous wave and also a smooth periodic function. It occurs often in ...
wave (a
plane wave
In physics, a plane wave is a special case of wave or field: a physical quantity whose value, at any moment, is constant through any plane that is perpendicular to a fixed direction in space.
For any position \vec x in space and any time t, t ...
for 2-D Gabor filters) multiplied by a
Gaussian function
In mathematics, a Gaussian function, often simply referred to as a Gaussian, is a function of the base form
f(x) = \exp (-x^2)
and with parametric extension
f(x) = a \exp\left( -\frac \right)
for arbitrary real constants , and non-zero . It i ...
.
Because of the multiplication-convolution property (
Convolution theorem), the
Fourier transform
A Fourier transform (FT) is a mathematical transform that decomposes functions into frequency components, which are represented by the output of the transform as a function of frequency. Most commonly functions of time or space are transformed, ...
of a Gabor filter's impulse response is the
convolution
In mathematics (in particular, functional analysis), convolution is a mathematical operation on two functions ( and ) that produces a third function (f*g) that expresses how the shape of one is modified by the other. The term ''convolution' ...
of the Fourier transform of the harmonic function (sinusoidal function) and the Fourier transform of the Gaussian function. The filter has a
real and an
imaginary component representing
orthogonal
In mathematics, orthogonality is the generalization of the geometric notion of '' perpendicularity''.
By extension, orthogonality is also used to refer to the separation of specific features of a system. The term also has specialized meanings in ...
directions. The two components may be formed into a
complex number
In mathematics, a complex number is an element of a number system that extends the real numbers with a specific element denoted , called the imaginary unit and satisfying the equation i^= -1; every complex number can be expressed in the for ...
or used individually.
Complex
:
Real
:
Imaginary
:
where
and
.
In this equation,
represents the wavelength of the sinusoidal factor,
represents the orientation of the normal to the parallel stripes of a
Gabor function,
is the phase offset,
is the sigma/standard deviation of the Gaussian envelope and
is the spatial aspect ratio, and specifies the ellipticity of the support of the Gabor function.
Wavelet space

Gabor filters are directly related to
Gabor wavelets, since they can be designed for a number of dilations and rotations. However, in general, expansion is not applied for Gabor wavelets, since this requires computation of bi-orthogonal wavelets, which may be very time-consuming. Therefore, usually, a filter bank consisting of Gabor filters with various scales and rotations is created. The filters are convolved with the signal, resulting in a so-called Gabor space. This process is closely related to processes in the primary
visual cortex
The visual cortex of the brain is the area of the cerebral cortex that processes visual information. It is located in the occipital lobe. Sensory input originating from the eyes travels through the lateral geniculate nucleus in the thalamus and ...
.
Jones and Palmer showed that the real part of the complex Gabor function is a good fit to the receptive field weight functions found in simple cells in a cat's striate cortex.
Extraction of features from images
A set of Gabor filters with different frequencies and orientations may be helpful for extracting useful features from an image. In the discrete domain, two-dimensional Gabor filters are given by,
:
:
where ''B'' and ''C'' are normalizing factors to be determined.
2-D Gabor filters have rich applications in image processing, especially in
feature extraction
In machine learning, pattern recognition, and image processing, feature extraction starts from an initial set of measured data and builds derived values ( features) intended to be informative and non-redundant, facilitating the subsequent learning ...
for texture analysis and segmentation.
defines the frequency being looked for in the texture. By varying
, we can look for texture oriented in a particular direction. By varying
, we change the support of the basis or the size of the image region being analyzed.
Applications of 2-D Gabor filters in image processing
In document image processing, Gabor features are ideal for identifying the script of a word in a multilingual document. Gabor filters with different frequencies and with orientations in different directions have been used to localize and extract text-only regions from complex document images (both gray and colour), since text is rich in high frequency components, whereas pictures are relatively smooth in nature. It has also been applied for facial expression recognition
Gabor filters have also been widely used in pattern analysis applications. For example, it has been used to study the directionality distribution inside the porous spongy
trabecular bone
A bone is a rigid organ that constitutes part of the skeleton in most vertebrate animals. Bones protect the various other organs of the body, produce red and white blood cells, store minerals, provide structure and support for the body, an ...
in the
spine.
The Gabor space is very useful in
image processing
An image is a visual representation of something. It can be two-dimensional, three-dimensional, or somehow otherwise feed into the visual system to convey information. An image can be an artifact, such as a photograph or other two-dimension ...
applications such as
optical character recognition
Optical character recognition or optical character reader (OCR) is the electronic or mechanical conversion of images of typed, handwritten or printed text into machine-encoded text, whether from a scanned document, a photo of a document, a sc ...
,
iris recognition
Iris recognition is an automated method of biometric identification that uses mathematical pattern-recognition techniques on video images of one or both of the irises of an individual's eyes, whose complex patterns are unique, stable, and can ...
and
fingerprint recognition
A fingerprint is an impression left by the friction ridges of a human finger. The recovery of partial fingerprints from a crime scene is an important method of forensic science. Moisture and grease on a finger result in fingerprints on surfac ...
. Relations between activations for a specific spatial location are very distinctive between objects in an image. Furthermore, important activations can be extracted from the Gabor space in order to create a sparse object representation.
Example implementations
This is an example implementation in
Python:
import numpy as np
def gabor(sigma, theta, Lambda, psi, gamma):
"""Gabor feature extraction."""
sigma_x = sigma
sigma_y = float(sigma) / gamma
# Bounding box
nstds = 3 # Number of standard deviation sigma
xmax = max(abs(nstds * sigma_x * np.cos(theta)), abs(nstds * sigma_y * np.sin(theta)))
xmax = np.ceil(max(1, xmax))
ymax = max(abs(nstds * sigma_x * np.sin(theta)), abs(nstds * sigma_y * np.cos(theta)))
ymax = np.ceil(max(1, ymax))
xmin = -xmax
ymin = -ymax
(y, x) = np.meshgrid(np.arange(ymin, ymax + 1), np.arange(xmin, xmax + 1))
# Rotation
x_theta = x * np.cos(theta) + y * np.sin(theta)
y_theta = -x * np.sin(theta) + y * np.cos(theta)
gb = np.exp(-.5 * (x_theta ** 2 / sigma_x ** 2 + y_theta ** 2 / sigma_y ** 2)) * np.cos(2 * np.pi / Lambda * x_theta + psi)
return gb
For an implementation on images, se
This is an example implementation in
MATLAB
MATLAB (an abbreviation of "MATrix LABoratory") is a proprietary multi-paradigm programming language and numeric computing environment developed by MathWorks. MATLAB allows matrix manipulations, plotting of functions and data, implementa ...
/
Octave
In music, an octave ( la, octavus: eighth) or perfect octave (sometimes called the diapason) is the interval between one musical pitch and another with double its frequency. The octave relationship is a natural phenomenon that has been refer ...
:
function gb=gabor_fn(sigma, theta, lambda, psi, gamma)
sigma_x = sigma;
sigma_y = sigma / gamma;
% Bounding box
nstds = 3;
xmax = max(abs(nstds * sigma_x * cos(theta)), abs(nstds * sigma_y * sin(theta)));
xmax = ceil(max(1, xmax));
ymax = max(abs(nstds * sigma_x * sin(theta)), abs(nstds * sigma_y * cos(theta)));
ymax = ceil(max(1, ymax));
xmin = -xmax; ymin = -ymax;
,y= meshgrid(xmin:xmax, ymin:ymax);
% Rotation
x_theta = x * cos(theta) + y * sin(theta);
y_theta = -x * sin(theta) + y * cos(theta);
gb = exp(-.5*(x_theta.^2/sigma_x^2+y_theta.^2/sigma_y^2)).*cos(2*pi/lambda*x_theta+psi);
Code for Gabor feature extraction from images in
MATLAB
MATLAB (an abbreviation of "MATrix LABoratory") is a proprietary multi-paradigm programming language and numeric computing environment developed by MathWorks. MATLAB allows matrix manipulations, plotting of functions and data, implementa ...
can be found at http://www.mathworks.com/matlabcentral/fileexchange/44630.
This is another example implementation in
Haskell:
import Data.Complex
gabor λ θ ψ σ γ x y = exp(-(x'^2 + γ^2 * y'^2) / (2*σ^2)) * exp(i * (2*pi*x'/λ + ψ))
where x' = x * cos θ + y * sin θ
y' = -x * sin θ + y * cos θ
i = 0 :+ 1
See also
*
Gabor transform
*
Gabor wavelet
*
Gabor atom In applied mathematics, Gabor atoms, or Gabor functions, are functions used in the analysis proposed by Dennis Gabor in 1946 in which a family of functions is built from translations and modulations of a generating function.
Overview
In 1946, De ...
*
Log Gabor filter
References
External links
MATLAB code for Gabor filters and Gabor feature extraction3D Gabor demonstrated with Mathematicapython implementation of log-Gabors for still images
Further reading
*
*
*
*
*
*
* Steerable Pyramids:
*# Eero Simoncelli's page o
Steerable Pyramids*#
PDF)
Code
*
{{DEFAULTSORT:Gabor Filter
Linear filters
Image processing
Pattern recognition
Articles with example MATLAB/Octave code
Articles with example Python (programming language) code