Currently, smart city project is running in INDIA for
urban development. Under this project, intelligent transportation system (ITS) is the very significant step towards achieving the goal of reducing traffic congestion as well as different traffic monitoring applications, like – parking management, emergency vehicle detection, car speed detection, accidents detection, car
counting etc. To achieve intelligent transportation system’s goal
for traffic monitoring, Image and video processing becomes a
significant tool. In this article focus on vehicle counting, or say
car counting for available online video (YouTube) using -
Frame difference, Edge detection, Euclidean distance
methods, Morphology, adaptive threshold and effective
prediction of center position with addition of calculation of
change in positions, delta positions and Gaussian blur. To
differentiate car as an object with another object, we consider
here particular size for car objects or say four-wheeler
objects, which are different then pedestrians available on the
road, as well as different static objects –like a tree, posters
available on road etc. Here simulation results check for
Ahmedabad, Chennai, Bangalore, Mumbai traffic related
video available with different resolution on YouTube. Also
with night traffic conditions. For, Ahmedabad Traffic
video, simulation results validate using recall, precision, and
F1 parameter.
2. So now look in the other fact that, if we know total no. of
four-wheelers, passed from the particular station, traffic
management becomes easier. Like total no. of Vehicles (four-
wheelers) entry in the particular area and total arrangement
for four-wheelers parking slot within that area compared and
accordingly advance booking system for a particular parking
slot in that area facilities to avoid parking management
problem and similarly to avoid congestion of the traffic for
that defined area. So, now our main focus is to count Four-
wheelers, particularly car for small-scale video, for developing
smart transportation, in a smart city.
IV. DIFFERENT METHODS DISCUSSED EARLIER
This type of work earlier established by different
authors, in [1] vehicle counting and classification, used
combinations of object detection, frame differentiation, edge
detection [12] and Kalman filtering [4] [11]. Whereas [2]
indicated this work with the simple principle of a light-beam
blocking system using the embedded system. Gaussian
Mixture Modelling based [8] [11] car counting system
explained in [3]. Lane marker detection for car counting
discussed in [4]. Model based object recognition system with
2 different approaches considered in [5]. Other methods are
using foreground extraction, object segmentation,
background subtraction and mathematical morphology [6][8]
[10] [11].
In many articles first step was the conversion of color to
grey, because many a time color information is not needed,
so this conversion step increase speed of the procedure [12].
Any computer vision research mainly or we can say mostly
depends upon light, variation in the light result may differ.
This content review in [7] i.e. traffic analysis at night time
using light intensity. 3D perspective mapping, use of 3D
coordinated from the captured video is explained in [9].
Template matching, full search block matching algorithm, k-
nearest neighbor methods, the neural network for
classification of different vehicle and various features based
vehicle detection, and active basis model discussed in [10].
Support vector machine based classification for traffic
explained [11].
One of the very interesting method [13] for counting
car using loci extraction method by linkage and separation,
detailed with all features consideration. Nearest object
distance and subtraction canny interpreted for automatic
counting of turtles [14].
IV. PROPOSED WORK
Proposed work-flow is shown in fig. [a], recorded
video (available video from YouTube) first captured, then
initialize car count equal to zero. For easy and speedy
calculation convert color information to grey information,
because in color, if consider only 3 basic color, though
computation task is complex compared to grey level
information. Define different scalar vector matrix for store
and indication of different value. Then in next step match the
current frame with an existing frame, or we can say compare
three consecutive frames one after another. Now the main
task is, first differentiates car object from other objects. For
that, different conditions are set before going to
implementation, (1) set rectangular size box (2) set aspect
ratio (3) set height and width (4) set threshold (5) create
contour and (6) convex hull.
In particular, this article, rectangular size shape,
predefined for car detection and car counting, though in some
videos rickshaws, trucks and other four-wheelers counted as a
car, which lies under false detection. For minimize false
detection in next step apply different morphology operation,
basically, dilation, erosion and convex hull and Gaussian blur
applied for removal of noise. Now for selected portion of
blob, area under which maximum four-wheelers, specifically
cars are present, shape and draw contour, using connected
component concepts.
Next step is, calculate distance between two points,
Euclidian distance measurement, equation for the same is,
D(a,b)=D(b,a)=
2 2 2 2 2 2
1 1 2 2
( ) (a ) .... (a )n n
a b b b
=
2
i i
1
(a b )
n
i
---------------------(1)
Where, D (b, a) is indicated Euclidian distance parameter an
and b indicates points for distance calculations. As per
equation (1) distance between n point measured using this
formula. Now frame by frame difference calculated, for edge
detection, using absolute differentiations, as indicated in
equation (2),
| A (xi, yi) − B (xi+ 1, yi+1) | ……………………… (2)
After this operation now set a different threshold using trial
and error method, for object differentiations, it may have
affected or changed accordingly, due to lighting condition as
well as video resolution clarity for a better result. Different
morphological operation, Erosion, dilation and convex hull.
Are used for object matching and car counting, with different
structure element – 3 x 3, 5 x 5, or 7 x 7.
From, Gonzalez and Woods, “Digital Image
Processing”, reference book, dilation operation ( ) on a
binary image, is to gradually enlarge the boundaries of regions
of foreground pixels [c], in equation (3) basic definitions of
dilation operation shown. Thus areas of foreground pixels
grow in size while holes within those regions become smaller.
And erosion operation, on a binary image, is to erode away the
boundaries of regions of foreground pixels. Thus areas of
foreground pixels shrink in size, and holes within those areas
become larger [c]. Mathematical representation of erosion
operation indicated in equation (4),
x ⊕ B = {p z2 | p= x + b, x∈ X, b B} ................. (3)
2
3. Sr.
No.
Set Threshold Total No. of Vehicle detected as
per discussed method
1 31 12
2 32 07
3 33 10
4 34 15
5 35 14
Here B, indicate structuring elements, X represent, elements of
given image, p is point available in Z structure.
X⊖B = {p z2 |∀ b B, p + b ∈ X} ……………. (4)
Proposed work-flow is shown in the fig. [a]
Basically, erosion operation shrinks the elements in a
given image, whereas due to dilation operation, image
elements or objects expand. Using convex hull, one of the
concepts from image morphology processing, contour created.
In present work, convex hulls and contour created using
different conditions with, define bounding rectangular area,
aspect ratio, width and height of selected blob. The Curving
out (convex) Hull is a subset of the N random points that form
the outer edge (border) to all other points.
For counting vehicle, reference line drawn in the
center of the image. Update and calculate, reference lines,
for car counting. For that, current center positions of x and y,
assigned with calculating at that time center positions of x and
y, and also calculating height and width for selected size
portion. For an update that positions, add delta values, for x
and y in the selected portion. Delta position indicates,
displacement of points from 0th
, position or say center
position to 1st
position, equation (5) and (6) represent delta
position for x and y position. Add this Delta position for next
displacement. Repeat this procedure until, covers all the
points, from selected bonding box or selected size box.
§ x (delta of x) = ∑ (xi –xi-1); ………… (5)
§ y (delta of y) = ∑ (yi –yi-1); …………. (6)
Add this § x, § y, for prediction of next positions.
Gaussian blur, is used for removing noise from the image,
and enhance image structures. Actually, in a Gaussian blur, a
convolution of a Gaussian function with image operation
done.
V. SIMULATION RESULT
Here simulation results collected with varying
threshold value, with the implementation of an above
discussed method simulation result on different traffic related
video, which is captured from Indian city – these listed cities
may become the smart city in near future. Our main focus to
develop a system for the smart city – we tried to apply these
on Chennai, Bangalore, Mumbai, Ahmedabad traffic video
using different threshold set. First Tabular result obtained for
Chennai traffic video –with Width X Height – 1280 x 720,
Frame rate -30, For total no. of Video Frame -90.
Chennai Traffic Video Result – Table 1.1
Here, Simulation result for the same, for threshold 34,
mentioned in fig. [1]
Fig. [1] Chennai traffic video [b] for 90 frames and
threshold value 34.
Tabular result obtained for Ahmedabad traffic video –with
Width X Height – 640 x 360, Frame rate -24, For total no. of
Video Frame -528
Ahmedabad Traffic Video Result – Table 1.2
Sr.
No.
Set
Threshold
correct Missed False
Positive
Recall Precision F1
1 31 8 5 0 0.61 1 0.75
2 32 13 0 0 1 1 1
3 33 13 0 0 1 1 1
4 34 11 2 0 0.84 1 0.88
5 35 13 0 3 1 0.81 0.89
3
4. Sr.
No.
Set Threshold Total No. of Vehicle
detected
1 31 57
2 32 62
3 33 65
4 34 65
5 35 52
Here, Simulation result for the same, for threshold 34,
mentioned in fig. [2]. While calculating car detection for the
second video, we have changed car detection – Horizontal Line
position calculation from rows to columns, due to change in
the recorded video orientation for getting a better result. For
measurement of these result, Recall, Precision and F1
parameter [d],
Recall = correct …………………. (7)
correct + missed
Precision is a ratio of correct detection to correct and false
positives detection. To find out overall performance of
algorithms that combines both recall and precision one most
important parameter used is F1 which is defined as follows
Precision = correct …………………. (8)
correct + false-positive
F1 = 2 x Recall x Precision …………. (9)
Recall + Precision
As here seen in table 1.2 compared to 1.1, the same result
repeated in case of threshold value – 32 and 33, which is an
exact matching of total car counting in given video. So for
Ahmedabad recorded video achieved 100 % results with
varying threshold and columns. In table 1.3 simulation result
shown in Bangalore traffic video.
Fig. [2] Ahmedabad traffic video [b] for 528 frames and
threshold value 34.
Bangalore traffic video – with Width X Height – 640 x 480,
Frame rate -30, For total no. of Video Frame -347.
Bangalore Traffic Video Result – Table 1.3
Fig. [3] Bangalore traffic video [b] for 347 frames and
threshold value 35.
Mumbai traffic video – with Width X Height – 1002 x 720,
Frame rate -25, For total no. of Video Frame -525.
Mumbai Traffic Video Result – Table 1.4
Sr.
No.
Set Threshold Total No. of Vehicle detected as
per
1 31 137
2 32 150
3 33 143
4 34 160
5 35 142
In Mumbai traffic video car counting in case of threshold
value 32 shown in figure [4].
Fig. [4] Mumbai traffic video [b] for 525 frames and threshold
value 32.
For, night traffic video (from YouTube), with different
illumination conditions, implement the same method, and we
get an almost same result as we received in daytime
conditions. Night traffic video, with Width X Height – 1280
X 720, frame rate -30, For total no. of 360 video frame. In
below, fig [5], vehicles counting with night conditions
mentioned.
4
5. In above 4 mentioned case, Mumbai, Bangalore and
Chennai traffic video with very congested traffic,
compared to Ahmedabad traffic video. For Ahmedabad
traffic video we have calculated Recall, Precision and F1
parameter for result verification.
Fig. [5] Car counting, in night traffic video, for 360 frames and
threshold value 35.
Night traffic Video Result – Table 1.5
Sr.
No.
Set Threshold Total No. of Vehicle detected as
per discussed method
1 31 12
2 32 12
3 33 12
4 34 12
5 35 12
Here, in all these tables, simulation results are
checked and car counting based on varying threshold value,
with applied proposed work discussed earlier. Tabular results,
show an important of a threshold value for the accurate
calculation of car counting. Now, in next table, simulation
results were shown, comparison, with use of dilation,
erosion operation, for constant threshold value. In table 1.6,
four cases compared, (1) With Erosion and dilation, (2) With
Dilation, Without erosion, (3) With Erosion, Without Dilation,
and (4) Without Dilation and Erosion.
In, mentioned all cases, dilation operation is firstly
applied, for expansion of the object, then once again apply
dilation and erosion operation for successful
implementation of vehicles counting procedure. So by
default dilation operation present, in the mentioned table 1.6,
all cases.
Comparative Analysis, with Dilation and Erosion effect –
Table 1.6
Sr.
No.
Video –
Frame rate
Morphology Effect No. of
Vehicle
counted
Approx.
range of
vehicle
counted
from
earlier
table.
1 Chennai
Traffic
Video -30
With Erosion and
dilation
10 ~7-15
With Dilation,
Without erosion
15
With Erosion,
Without Dilation,
11
Without Dilation
and Erosion
18
2 Ahmedabad
Traffic
Video-24
With Erosion and
dilation
13 ~8-13
With Dilation,
Without erosion
22
With Erosion,
Without Dilation,
17
Without Dilation
and Erosion
20
3 Bangalore
traffic
video -30
With Erosion and
dilation
65 ~52-65
With Dilation,
Without erosion
36
With Erosion,
Without Dilation,
29
Without Dilation
and Erosion
65
4 Mumbai
traffic
Video-25
With Erosion and
dilation
143 ~137-160
With Dilation,
Without erosion
117
With Erosion,
Without Dilation,
211
Without Dilation
and Erosion
173
5 Night
traffic
Video-30
With Erosion and
dilation
12 ~12
With Dilation,
Without erosion
9
With Erosion,
Without Dilation,
0
Without Dilation
and Erosion
10
VI. CONCLUSION AND FUTURE WORK
Here, five different types of video, collected from
YouTube–specially from one of the future smart cities, and
tried to implemented, proposed algorithm on it. In Chennai
video– video include, pedestrian, the big sign board of
advertisement, bus stand, and small vehicles, and etc.
Ahmedabad video, orientation is different from all other
videos, so in that case change rows to columns, a calculation
5
6. for effective car counting. In Bombay and Bangalore video,
congested traffic, consider for car counting calculation. And
in the last video, how this, proposed effective in different light
condition checked with Night traffic video.
From the result mentioned in the tabular result, for a
different city- which will become the smart city in nearer
future, car counting experiment conducted. For a different
value of the threshold, we get an almost accurate result. For
more congested traffic video, we have to set a threshold value
with trial and error method for an accurate result. For
Ahmedabad traffic video we have concluded with 100%
accuracy with the threshold value 32 and 33. That is shown
with Recall, Precision, and F1 parameter. For night video,
threshold values do not affect car counting results, which is
shown in table 1.5.
Limitations of these works, still it is not tested on
real time video, so image (video) taken from a different
camera, is not calculated. Second is sometimes rickshaw,
truck also counted as a car in car counter as a false detection.
Third limitations are not checked in each and every
illumination conditions.
In future work, our main focus is to overcome those
limitations, which are mentioned in this article. Next, we will
be trying to achieve automatic threshold value or double
threshold value for fast and accurate results. That will be
useful for developing Intelligent Transportation System,
which is one of the parts of Smart city project development.
ACKNOWLEDGMENT
In this article, Simulation result develops using
Visual Studio version 2015 and Open-cv Library and for
checking video Properties we used Matlab 2015 version.
REFERENCES
[1] A. Tourani and A. Shahbahrami, “Vehicle counting method
based on digital image processing algorithms,”2015 2nd Int.
Conf. Pattern Recognit. Image Anal., no. Ipria, pp. 1–6, 2015.
[2] M. Y. Chiu, R. Depommier, and T. Spindler, “An
embedded real-time vision system for 24-hour indoor/outdoor
car-counting applications,” Proc. - Int. Conf. Pattern
Recognit., vol. 3, pp. 338–341, 2004.
[3] J. Lu, Y. Xu, and X. Yang, “Counting pedestrians and cars
with an improved virtual gate method,” ICCASM 2010 -
2010 Int. Conf. Comput. Appl. Syst. Model. Proc., vol. 4,
no. Iccasm, pp. 448–452, 2010.
[4] L. Huang, “Real-time multi-vehicle detection and sub- feature
based tracking for traffic surveillance systems,”
CAR 2010 - 2010 2nd Int. Asia Conf. Informatics
Control. Autom. Robot., vol. 2, pp. 324–328, 2010.
[5] C. Setchell and E. L. Dagless, “Vision-based road- traffic
monitoring sensor,” IEE Proc. - Vision, Image, Signal
Process., vol. 148, no. 1, p. 78, 2001.
[6] I. K. E. Purnama, A. Zaini, B. N. Putra, and M. Hariadi,
“Real time vehicle counter system for intelligent
transportation system,” Int. Conf. Instrumentation, Commun.
Inf. Technol. Biomed. Eng. 2009, ICICI- BME 2009, pp. 4–
7, 2009.
[7] J. M. Mossi, A. Albiol, A. Albiol, and V. N. Ornedo, “Real-
time traffic analysis at night-time,” 2011 18th IEEE Int.
Conf. Image Process., pp. 2941–2944, 2011.
[8] A. J. Kun and Z. V??mossy, “Traffic monitoring with
computer vision,” SAMI 2009 - 7th Int. Symp. Appl. Mach.
Intell. Informatics, Proc., pp. 131–134, 2009.
[9] N. K. Kanhere and S. T. Birchfield, “Real-time
incremental segmentation and tracking of vehicles at low
camera angles using stable features,” IEEE Trans. Intell.
Transp. Syst., vol. 9, no. 1, pp. 148–159, 2008.
[10] S. Kamkar and R. Safabakhsh, “Vehicle detection,
counting and classification in various conditions,” IET Intell.
Transp. Syst., vol. 10, no. 6, pp. 406–413, 2016.
[11] Z. Chen, T. Ellis, and S. a Velastin, “Vehicle detection,
tracking and classification in urban traffic,” 15th Int. IEEE
Conf. Intell. Transp. Syst., pp. 951–956, 2012.
[12] S. Banerjee, P. Choudekar, and M. K. Muju, “Real time car
parking system using image processing,” ICECT 2011 -
2011 3rd Int. Conf. Electron. Comput. Technol., vol. 2, pp.
99–103, 2011.
[13] T. Hasegawa, K. Nohsoh, and S. Ozawa, “Counting cars
by tracking moving objects in the outdoor parking lot,” Proc.
VNIS’94 - 1994 Veh. Navig. Inf. Syst. Conf., pp. 63–68, 1994.
[14] J. J. Philipps, I. Bönninger, J. Vásquez, U. D. C. Rica, S.
José, and C. Rica, “Automatic Tracking and Counting
of Moving Objects,” pp. 93–97, 2014.
[15] https://github.com/
[16] https://www.youtube.com/
[17] Gonzalez and Woods , “Digital Image Processing”, 3rd
edition , Pearson https://chrisalbon.com/
6