You are on page 1of 5

Implementation of Gabor filter on the FPGA for

asphalt damage detection

Faruk Zaimovi, student,

Sadid Smajki, student,

Adnan Mehremi
Mehremi,, student,

University of Sarajevo,
Faculty of Electrical Engineering

Univerzitetofu Sarajevo,
of Electrical

Univerzitetofu Sarajevo,
of Electrical

Abstract The aim of this project is to

develop a low-cost solution that will enable
identification of holes and road damage
using the FPGA (Field Programmable Gate
Arrays). This solution can be used during
the implementation of driving assistance
systems in order to avoid damage to the
road. Problems that occur in damage
detection on industrial materials are usually
very complex and require integrated
solutions that can be implemented in real
time using the FPGA system. Detailed
description of the system which is based on
image processing, was developed in order to
analyze data recorded with the camera,
which gives a better efficiency and accuracy
methods, is presented in the sequel.

Extracting the damage involves the

identification of areas with a uniform texture
on the image. Region in the picture has a
permanent texture if local effect or other local
feature textures are constant, slowly changing
or approximately periodic. [1]
Different approaches for the detection of road
(asphalt) damage are based on the separation
characteristics in the spatial domain. Basically,
adaptive wavelet has great sensitivity to
sudden changes in the structure caused by
The main contribution of this paper is:

Keywords: FPGA, Gabor filter, damage,

road, image

The process of road damage detection is
similar to obstacle detection except the damage
in the form of holes is more common than
obstacles. The approach used in solving this
problem is a different visual representation of
the holes in relation to their environment. The
basic idea of this system is to alert drivers
when encountering damage on the road, in
order to adjust their speed so they could avoid
holes and notify local road maintenance
services of their existence.
Differences in mean value of gray color on a
small area are not always sufficient to detect
the damage. Instead, it should be relied on the
values of gray in neighboring pixels.

The rule of combination proposes to

integrate information from different
channels. This approach offers a high
level of detection and low probability
of false alarm
The introduction of sensitivity variable
improves the performance of the
developed algorithm.
High sensitivity and low convolution
computationally cost effective and thus
increases the real-time performance.
Detection of damage with Gabor filters
is introduced


Gabor filter is a linear filter that is used for

edge detection in image processing, and was
named by Dennis Gabor. Orientation and
frequency Gabor filters are similar frequencies
and orientations for the human visual system to
represent the texture and differentiation of
textures. Sinusoidal plane is modulated 2D
Gabor filter whose kernel is a Gaussian
function in the spatial domain. All Gabor
filters may arise dilatation and rotation from
one wavelet "parent", thus Gabor filters are
similar to each other. The harmonic function
multiplied by a Gaussian function gives the
impulse response of the Gabor filter.
Convolution Fourier transform of the Gaussian
function and the Fourier transform of the
harmonic function is the Fourier transform of
the impulse response.
The orthogonal directions are represented by
imaginary and real part of the filter. These two
components can be combined into complex
shapes or used separately. In principle, twodimensional Gabor function is expressed as

[ ( 2 + 2 ) ]
(, ) =
2 (20)


An important feature of Gabor filter is the

ability to achieve maximum localization or
spatial resolution and spatial frequency
domain. One of the disadvantages is the fact
that the filters are not orthogonal but are
complete for displaying visual information. Its
feature of extraction, Gabor filter owes to the
ability of adjusting the orientation of filter for
each selected frequency, which depends on the
number of scales.
The characteristics of the image are obtained
by filtering (convolution) the picture with each
of the filters from the bank of filters. Getting
each filter individually is explained in the
previous chapter. The total number of filters in
the bank equals (number of scales x
number of orientations). Convolution is done
by 3x3 convolution mask. Larger mask
produces better results but the execution time
is longer so that a compromise is sought
between the time of execution and the size of
the mask.


Where 0 is the frequency of the Gabor

function. Constants and represent the
length of the Gaussian envelope along the
and -axes. Using (1) as a Gabor wavelet
matrix we can get the appropriate bank of
filters using the appropriate dilation and
rotation of function (, ) through a generic
(, ) = ( , )
= ( + )
= ( + )
> 1; = 1,2, , ; = 1,2, ,

( 1)


and parameters represent scale and

orientation indexes respectively. represents
the total number of scales and is the total
number of orientations. For each orientation ,
the angle is equal to:

One of the advantages of this filter that damage

detection is done directly using vector
elements obtained in the manner described in
the previous section. We extract images
from that vector element that serve us to get
the final image according to the algorithm (6):
R (x, y), |R pq (x, y) pq | K v
Dpq (x, y) = { pq
0, inae

Where represents a picture obtained by

processing algorithm, represents a picture
obtained by convolution filters - scale and orientation with the picture we want to edit,
is the mean value of images and is
the mean of all means of convoluted images.
represents a coefficient of sensitivity which
actually determines whether the pixel is
damaged or not.


The task of image merging module is to
combine all the pixels that have a high
probability of being damaged into a single
image. The algorithm combines (sums up) all
the images that passed the damage detection
phase. At the end, the obtained image is
divided by the total number of images to obtain
a photo-Z, which represents the mean value of
all Gabor filter mages.

results in precisely obtained damage surface.

We have taken an example of 1x1 (x scale
orientation) and 2x2 (scale and orientation),
and difference can be obtained in terms of
filtration visually and through PSNR and MSE
values set out in table (1 and 2 ..) for the
sample images we worked on.





The implementation of the algorithm is done
by using the FPGA. First, it was needed to
determine the number of the scales and
orientations. Number of scales in general
represents the number of intensity levels of
gray color in the image to be sampled while
the number of orientations can be linked to the
number of orientations that we apparently can
see in the picture. It is determined individually
and in combination with images that get
filtered. By repeatedly changing the number of
scales and orientations, we can get excellent
parameters for a particular image, but the aim
of this paper is to implement Gabor filter on
FPGA and show the example that is taken in
this paper, which is the detection of asphalt
holes (damage), as its application.
Another important part is to determine whether
its needed to use the real part of the received
image or the amplitude part. In this paper we
have used the real part, just to give an example
of application, in an analogous way as this was
done for the real part, it can be done for an
amplitude part as well.
We wanted to show, through filtering more
images, how the filtering affects different
damages, and also that the threshold and the
coefficient K, which is explained earlier have a
major impact on detection. We also showed
that increasing scale and orientation number,
increases and the quality of filtering which

Image 1. Obtained by using 4 filters

Image 2. Obtained by using 4 filters

Image 3. Obtained by using 4 filters

Image 7. Obtained by using 1 filter

Image 4. Obtained by using 4 filters

Image 8. Obtained by using 1 filter

Image 5. Obtained by using 1 filter

Image 6. Obtained by using 1 filter

Also, it is very important to note that the value

of detection can be changed for different
values of the parameters that are defined in the
formula for calculating the response of the
filter, due to the limitation by paper size and
time we are constrained to one parameter.
Whereas time of filtering depends on the
number of scales and orientations, compromise
is sought between the execution time and the
precision of detection. Also in this example
can be seen that the algorithm detects even the
smallest details in the picture.
This represents a matrix of pixels from the
image that we take so we can perform
convolution with (, ) Gabor filter, with the
designations that have been used in the model.
1 _2
(2 _2
3 _2

1 _1
2 _1
3 _1

2 )


Here is the MATLAB code for calculating

Gabor filters matrix, and the values of the
parameters that were used in our work.
Through this example we can illustrate
how Gabor filter works in general.

for i = 1:u
fu = fmax/((sqrt(2))^(i-1));
alpha = fu/gama;
beta = fu/eta;
for j = 1:v
tetav = ((j-1)/8)*pi;
gFilter = zeros(m,n);
for x = 1:m
for y = 1:n
xprime = (x((m+1)/2))*cos(tetav)+(y((n+1)/2))*sin(tetav);
yprime = -(x((m+1)/2))*sin(tetav)+(y((n+1)/2))*cos(tetav);
gFilter(x,y) =

Formula for MSE (9) and PSNR calculation:


( (( ) ))
255 255

= 10 10 (



Table 1. MSE and PSNR values while using 4



Slika 1

Slika 2

Slika 3

Slika 4


fmax = 0.125;
gama = 0.8;
eta =0.8;

Table 1. MSE and PSNR values while using 1


Slika 1

Slika 2

Slika 3

Slika 4

For future work on this or a similar model, we

suggest using a large number of scales and
orientations eg. 39x39 and perform testing on a
bigger size (, ) Gabor filter than the one that
was used in this paper. Also, the model can be
adapted to detect other material damages such
as canvas, and it depends on the number of
scales and orientations and the coefficient K,
which strongly affects the accuracy of
detection. The detection can also be done on
the video, because video is made up of a series
of images, where each image is separately
analyzed as a single image. Furthermore, it can
try to perform the analysis for different areas
of image and to try to find the optimal value of
K that will support these models, both
mathematically and practically.
This paper describes the process of setting
Gabor filter to identify asphalt damage which
is implemented on the FPGA. Throughout the
proceedings the conclusions have been drawn
which can be used in setting the parameters for
the other type of error and damage or to adjust
Gabor filter to detect any features on any other
picture. It can be concluded that the use of a
large number of filters, increases the accuracy
of damage detection, and therefore increases
the complexity and execution time. Based on
all of the above, it is clear that the possibilities
of Gabor filter application are numerous.
[1] Ajay Kumar, Grantham Pang, Defect detection in
textured materials using Gabor filters, Industrial
Automation Research Laboratory, The University of
Hong Kong, 2000

[2] Ajay Kumar, Grantham K. H. Pang,, Defect

Detection in Textured Materials Using Gabor Filters,
IEEE transactions on Industry aplications, vol. 38, no. 2,
March/April 2002.