Article citation information:
Czapla, Z. Gradient-based vehicle detection
using a two-segment detection field. Scientific
Journal of Silesian University of Technology. Series Transport. 2017, 96,
27-36. ISSN: 0209-3324.
DOI: https://doi.org/10.20858/sjsutst.2017.96.3.
Zbigniew
CZAPLA[1]
GRADIENT-BASED VEHICLE
DETECTION USING
A TWO-SEGMENT DETECTION FIELD
Summary.
This paper presents a method of vehicle detection using the conversion of
images from a source image sequence into binary target images. This conversion
is performed on the basis of small image gradients. The location of binary
values after conversion is in accordance with the edges of the converted image.
For all processed images, a detection field is defined, which is composed of
two segments. In the area of each segment, the sum of the edge values is
calculated. On the basis of the calculated sums within the segments, an
adjusted sum of the edge values is established, which allows for the
determination of the state of the detection field. Vehicle detection is carried
out by recognition of distinctive changes in the state of the detection field
caused by the passing vehicle. Experimental results are provided.
Keywords:
vehicle detection; image conversion; detection field
1. INTRODUCTION
Contemporary road traffic systems use image data for
the determination of traffic parameters and traffic surveillance. Processing
and analysis of image data allow for vehicle detection. In [1], a feature-based
tracking system is presented. This system employs corner features for vehicle
detection. In [3], static and dynamic analyses of segmented images is applied.
Static analysis is used for one processed image, while dynamic analysis
involves the comparison of a current image and a previous image. In [6], vehicle
tracking at intersections with the use of a stochastic algorithm is presented.
The applied algorithm assumes the division of an image into square blocks. In
[4], vehicles are separated from the background by segmentation involving the
determination of the difference between the current image and the background.
Furthermore, in [5], the difference between the current image and the
background is calculated. In the next stages, lane-dividing lines are
determined. In [2], a rule-based method is applied. In this approach,
high-level and low-level processing modules are applied. In [7], time-spatial
images are applied for vehicle detection. The time-spatial images are obtained
from the virtual lines set in the frames of the input video sequence.
The proposed method of vehicle detection uses the
gradient-based conversion of images from the source image sequence into binary
target images. The applied detection field is composed of two segments.
Analysing changes in average
adjusted sums within the detection field allows
for vehicle detection. The proposed method of vehicle detection is intended for
road traffic systems using image data.
2. ALGORITHM OF VEHICLE DETECTION
Gradient-based vehicle detection using the two-segment
detection field is carried out on the basis of the video stream obtained from a
camera mounted over a road. Consecutive frames taken from the video stream
create a source image sequence. Images from the source image sequence are
processed separately, one by one. The processing of each individual image from
the source image sequence consists of the following stages:
-
conversion into a binary target image
-
definition of a two-segment detection field
-
summation of the edge values within the segments of
the detection field
-
determination of the adjusted sum within the detection
field
-
description of the state of the detection field
Individual images differ in terms of the number of
objects and object locations. The properties and the quality of the images in
the source image sequence depend on the parameters of the applied camera. The
time of day and changeable weather conditions can also influence the features
of images in the input image sequence.
3. CONVERSION INTO BINARY TARGET IMAGES
Images of the source image sequence
are converted from the bitmap format into the binary target images. Conversion
is carried out by analysis of small gradients in the images of the source image
sequence. The source image sequence consists of greyscale images of size M xN
pixels. The coordinate of columns is denoted by m and the coordinate of
rows is denoted by n. The position of each image in the source image
sequence points to the integer number denoted by i.
The results of conversion are
written into the binary matrix B = [bn,m]
of the dimensions N x M. All elements of matrix B are set to 0 at
the beginning of the conversion of each source image. For all pixels of the
converted source image, except border pixels, the magnitude of the small
gradients is calculated for the current pixel at coordinates (m, n)
relative to the pixels at coordinates (m - 1, n), (m, n
- 1), (m -1, n - 1), (m + 1, n - 1)
in rows, columns and diagonal directions, respectively. If the obtained value
of the magnitude is greater than the preset threshold value:
(1)
the element of matrix B, corresponding
with the current pixel at coordinates (m, n), is set to 1
(2)
The elements of matrix B,
corresponding to the pixels at coordinates (m - 1, n), (m, n
- 1), (m - 1, n -1), (m + 1, n - 1), are
also appropriately set to 1 for gradient magnitudes greater than the threshold
value.
Matrix B contains logical
values obtained as a result of the conversion of the source image into the
binary target image. The location of values equal to 1 in matrix B
corresponds to edges in the source image; thus, these values are called edge
values.
4. DEFINITION OF THE DETECTION FIELD
A detection field is defined for
each considered road lane. The rectangular detection field is specified by
coordinates describing the vertices: the left column mL, the
right column mR, the upper row nU and the
bottom row nB. The detection field covers the road lane in
terms of width, while it is small in height, such that the changes in the
features of the detection field could involve two-state properties. Samples of
the source images, which show the vehicle passing the area of the detection
field, are shown in Fig. 1 (the detection field is marked by black rectangles).
Fig. 1. Samples of
the source images within the detection field
The detection field is composed of
two segments, which partially cover each other. The first segment, denoted by A,
is specified by coordinates describing the vertices: the left column m(A)L,
the right column m(A)R, the upper row n(A)U
and the bottom row n(A)B. Similarly,
coordinates m(B)L, m(B)R,
n(B)U, n(B)U
describe the second segment denoted by B.
Both segments of the detection field
are the same in width and height. The height of the segments is the same as the
height of the detection field. The width of the segments is smaller than the
width of the detection field and can be expressed by the equation:
(3)
where:
ent – signifies the integer part of the expression
in brackets
d – denotes the constant of proportionality, which is less than 1
The samples of the source images
with the marked segment A and segment B are shown in Fig. 2 and
Fig. 3, respectively.
Fig. 2. Samples of
the source images within segment A
Fig. 3. Samples of
the source images within segment B
The segments of the detection field
are of the same size and displaced in parallel, relative to each other inside
of the detection field.
5. SUMMATION OF THE EDGE VALUES
The arithmetic sums of the edge values are calculated
within both segments of the detection field for the current image i.
These sums of the edge values, calculated in the areas of segment A and
segment B, are given respectively by the following equations:
(4)
Samples of target images, with the marked segments A
and B, are shown Fig. 4 and Fig. 5, respectively. The black points signify the edge
values, while the segments of the detection field are marked by black
rectangles.
Fig. 4. Samples of
the target images within segment A
Fig. 5. Samples of
the target images within segment B
The maximum value of the arithmetic sums of the edge
values within segments A and B is determined according to the
expression:
(5)
On the basis of the maximum arithmetic sums of the
edge values, the adjusted sum of the edge values in the area of the detection
field is calculated using the equation:
(6)
Samples of the target images, with
the edge values signified by black points and the detection field marked by
black rectangles, are shown in Fig. 6.
Fig. 6. Samples of
the target images in the detection field
Considering the current image i
and P previous images, the average adjusted sum of the edge values
within the detection field is determined for the current image i as
follows:
(7)
The determination of the average adjusted sums of the edge values in the
area of the detection field corresponds to the low-pass filtering operation
carried out on the adjusted sums of the edge
values.
6. VEHICLE DETECTION
For the current source image,
following conversion into the target image, the arithmetic sums of the edge
values are calculated: the sums within the segments A and B, the
adjusted sum within the detection field and finally the average adjusted sum.
The worked-out average adjusted sum is appropriate, compared to the preset
threshold values, for determining the state of the detection field.
The state of the detection fields
changes from “free detection field” to “occupied detection field” if the
average adjusted sum of the edge values is greater than the preset threshold
value for the detection field in the “occupied detection field” state:
(8)
The return change from the “occupied
detection field” state into the “free detection field” state occurs when the
average adjusted sum of the edge values is less than the preset threshold value
for the detection field in the “free detection field” state:
(9)
The state of the detection field is
determined by analysis of the average adjusted sums of the edge values in the
area of the detection field for the consecutive images from the source image
sequence. A vehicle driving into the detection field changes its state from the
“free detection field” to the “occupied detection field” state. Next, after a
period of time depending on the speed and length of the vehicle, the vehicle
leaves the detection field and changes its state from “occupied detection field”
to “free detection field”. Vehicle detection is carried out by the recognition
of the sequence “free detection field-occupied detection field-free detection
field” in the changes of the state of the detection field. The appearance of
such changes in the state of the detection field indicates the passing vehicle.
7. RESULT OF EXPERIMENTS
Experiments have been carried out for one road lane in
good weather conditions
and different light conditions. Short source
image sequences, presenting various traffic scenes, have been analysed. One
camera of average quality has been applied. Traffic conditions were changeable
without congestion.
The source images sequence is composed of greyscale
images with a size of 384 x 384 pixels and an intensity resolution of
8 bits per pixel. The source images are signified by their ordinal numbers,
while the size of the detection field is set to 80 x 5 pixels. The constant of proportionality is
set at d = 0.6. The samples of the
processed images are shown in Fig. 7. The source image is placed on the left side of the fig. and the
target image is situated on the right side of the figure. The detection field
is marked by black rectangles, while black points signify the edge values in
the target images.
Fig. 7. Samples of
the processed images
After conversion of the current
source image i into the target image, the arithmetic sums of the edge
values are calculated in the segments of the detection field. The changes of
the arithmetic sum of the edge values in segments A and B are
shown in Fig. 8 and Fig. 9, respectively.
The adjusted sum of the edge values is calculated on
the basis of the sums of edge values in segments A and segment B.
The changes in the adjusted sum of the edge values within the detection field are shown in
Fig. 10.
Fig. 8. Changes in the arithmetic sum of
the edge values in segment A
Fig. 9. Changes in the arithmetic sum of
the edge values in segment B
Fig. 10. Changes in the adjusted sum of the edge values within the detection field
On the basis of the adjusted sums of the edge values
within the detection field, the average adjusted sums are determined. The number of the previous images
is set at P = 3. The changes in the average adjusted sum of the edge values within the detection field are presented in
Fig. 11.
Fig. 11. Changes in the average adjusted sum of the edge values within the detection field
For the analysed source image sequence, the state of
the detection field has been determined on the basis of the average adjusted sum of the
edge values as follows:
-
For images i = 0 to i =15,
the vehicle approached the detection field and the state of the detection field
was “free detection field”
-
For images i = 15, the vehicle drove
partially into the detection field and the state of the detection field was
still “free detection field”
-
For images i = 16, the vehicle drove
into the detection field and the state of the detection field changed to
“occupied detection field”
-
For images i = 17 to i =32,
the vehicle remained in the area of the detection field and the state of the
detection field was “occupied detection field”
-
For images i = 33, the vehicle drove
out of the detection field and the state of the detection field changed to
“free detection field”
-
For images i = 34 to i =50,
the vehicle drove away from the detection field and the state of the detection
field was “free detection field”
Calculation of the adjusted sums of the edge values causes an increase in
the number of the edge values assigned to the detection field. Enlargement of
the sum of the edge values facilitates the detection of vehicles, particularly
vehicles whose depiction contains large surfaces without edges. Application of
the two-segment detection field allows for detecting various types of vehicles:
passenger cars, vans, trucks, buses, articulated lorries and motorcycles.
8. CONCLUSIONS
Vehicle detection can be performed on the basis of
image gradients. The source images are converted into binary target images.
This conversion is based on local gradients in the source images. Positions of
the edge values in the target images are in accordance with the edges of
objects contained in the source images. The main advantage of the proposed
method lies in analysis of the state of the detection field, based simply on the
sums of the edge values. The application of a detection field composed of two
segments improved the effectiveness of vehicle detection and enhanced the response of the
detection field in relation to the passing vehicle. Similar to other methods using image data, the presented method is not
very resistant to changeable weather and light conditions. The proposed method
of vehicle detection is intended for the detection of various types of
vehicles, but not directly for vehicle classification.
Gradient-based vehicle detection using the two-segment
detection field requires a small number of operations, as well as being simpler
than the majority of the widely known methods. The detection of vehicles based
on image gradients is fast and uncomplicated. The proposed method of vehicle
detection is intended for road traffic systems, e.g., surveillance or
measurement systems, for vehicle location and counting.
References
1.
Coifman Benjamin,
David Beymer, Philip McLauchlan, Jitendra Malik. 1998. “A real-time computer
vision system for vehicle tracking and traffic surveillance.” Transportation
Research Part C 6(4): 271-288. DOI: 10.1016/s0968-090x(98)00019-9.
2.
Cucchiara Rita, Piccardi
Massimo, Mello Paola. 2000. “Image analysis and rule-based reasoning for a
traffic monitoring system.” IEEE Transaction on Intelligent Transaction
Systems, 1(2): 119-130. DOI:
10.1109/6979.8809.69.
3.
Fernandez-Caballero
Antonio, Francisco J. Gomez, Juan Lopez-Lopez. 2008. “Road traffic monitoring
by knowledge-driven static and dynamic image analysis.” Expert Systems with
Applications 35(3): 701-719. DOI: 10.1016/j.eswa.2007.07.017.
4.
Gupte Surendra,
Osama Masoud, Robert F.K. Martin, Nikolaos P. Papanikolopoulos. 2002.
“Detection and classification of vehicles.” IEEE Transaction on Intelligent
Transportation Systems 3(1): 37-47. DOI: 10.1109/6979.994794.
5.
Hsieh Jun Wei,
Shih-Hao Yu, Jung-Sheng Chen, Wen-Fong Hu. 2006. “Automatic traffic
surveillance system for vehicle tracking and classification.” IEEE
Transaction on Intelligent Transportation Systems 7(2): 175-187. DOI:
10.1109/tits.2006.874722.
6.
Kamijo Shunsuke,
Yasuyuki Matsushita, Katsushi Ikeuchi, Masao Sakauchi. 2000. “Traffic
monitoring and accident detection at intersections.” IEEE Transactions on
Intelligence Transportation Systems 1(2): 108-118. DOI:
10.1109/6979.880968.
7.
Mithun Niluthpol
Chowdhury, Nafi Ur Rashid, S.M. Mahbubur Rahman. 2012. “Detection and
classification of vehicles from video using multiple time-spatial images.” IEEE
Transaction on Intelligent Transportation Systems 13(3): 1215-1225. DOI:
10.1109/tits.2012.2186128.
Received 17.05.2017; accepted in revised form 05.08.2017
Scientific Journal of Silesian
University of Technology. Series Transport is licensed under a Creative
Commons Attribution 4.0 International License
[1] Faculty of Transport, The Silesian University of Technology, Krasińskiego 8 Street, 40-019 Katowice, Poland. E-mail: zbigniew.czapla@polsl.pl.