Vehicle Detection and Counting From A Video Frame: Chomtip Pornpanomchai, Thitinut Liamsanguan, Vissakorn Vannakosit

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

Proceedings of the 2008 International Conference on Wavelet Analysis and Pattern Recognition, Hong Kong, 30-31 Aug.

2008

VEHICLE DETECTION AND COUNTING FROM A VIDEO FRAME


CHOMTIP PORNPANOMCHAI, THITINUT LIAMSANGUAN,VISSAKORN VANNAKOSIT

Department of Computer Science, Faculty of Science, Mahidol University,


Rama 6 Road, Rajchatavee, Bangkok 10400, Thailand
E-MAIL: cccpp@mahidol.ac.th, u4788053@mahidol.ac.th, u4788129@mahidol.ac.th

Abstract: area. The users do not have to install much equipment since
The research intends to develop the vehicle detection and we can combine the tasks together. So, the users can reduce
counting system using image processing. Overall works are the cost of investment. Image processing technology can
software development of a system that requires a video stream fulfill this requirement.
and capture to a video frame. They consist of the following Image processing is the technique which is based on the
components: background road without any moving vehicle
and the frame with moving vehicles. The system is designed to
software component that does not require special hardware.
find the differentiation which is the moving vehicles and find With a typical video recording device and a normal
the number of moving vehicles from the video frame. The computer, we can create the detection and counting device.
vehicle detection and counting system consists of four major By using the basic pattern matching theory, we can find the
components: 1) Image Acquisition, 2) Image Analysis, 3) number of objects in the video scene from the known size
Object detection and Counting, and 4) Display Result of the object [2-6].
The experiment has been conducted in order to access the Few image processing key methodologies have been
following qualities: 1) Usability, to prove that the system can applied to this project. The image differentiation is used in
determine vehicle detection and counting under the specific the object detection process, level of difference for the
condition lay out. 2) Efficiency, to show that the system can
work with high accuracy.
image analysis and pattern matching to find the number of
objects [7-9]. The project is still in the prototype mode. We
require more research and development in order to reduce
Keywords:
Vehicle detection; Vehicle counting; Digital Image the system limitation and enhance the efficiency of the
Processing; Multimedia system to be able to perform for a real-world application.
The topic of further enhancement will be discussed at the
1. Introduction end of the document.
This project is about developing an image processing
The idea of using the video camera to count the number system that can detect the number of vehicle from the video
of objects has been proposed as a new way of detection and frame, which is running on specific constraints. The system
counting approach. The current detection and counting is intended to replace the sensor equipment, which has
approaches are based too much on the sensor equipment. some weak points as explained before. The system will be
The use of sensor equipment to count the number of objects created in the form of software which consists of input and
has been widely spread into different kinds of industries. output parts. The input part accepts a data, which is an
Even though the equipment itself provides a benefit to the image from a video scene. The output part is responsible for
user, there are also some disadvantages. The sensor reporting the result to the user.
equipment is only used for real time - the user cannot insert
other kinds of inputs such as video file to the sensor 2. Related work
equipment in order to count the number of objects.
The sensor equipment also has a high cost and it is not a Due to the traffic jam problem in Bangkok, the idea of
multitasking tool [1]. Compared to the video camera applying the technology to solving the problem has been
device, many users have now already installed video launched. Genius Traffic System is used to represent the
camera devices in their offices or buildings for security. We state of traffic in real time for the traveler. The system will
can use these video cameras for multitasking - not only for present the state of the main streets in Bangkok in order to
security, but also as the sensor equipment. That means we resolve the traffic problem [10]. The traveler can make the
can count the number of objects or people in the detection

978-1-4244-2239-5/08/$25.00 ©2008 IEEE


356
Proceedings of the 2008 International Conference on Wavelet Analysis and Pattern Recognition, Hong Kong, 30-31 Aug. 2008

decision to choose a better way by trying to avoid streets the total time for each car to run through a square. If the
that have traffic jams shown in Figure 1. total time is quite little, it means that a car can run with
speed and so there is no traffic jam. If the total time is very
much, it means that a car can only run slowly and so there
is a traffic jam occurring. The computer system will
measure the total time that the car has occupied the detector
over the time unit. For example, the time unit is 100
seconds and a car has occupied the square area for 100
seconds. This means that there is a traffic jam. The
occupancy ratio is between 0.0 and 1.0 and the related color
is shown in Table 1.

Table 1 The occupancy ratio of genius traffic system


Occupancy Ratio Color
0-0.3 Green
0.3-0.8 Yellow
Figure 1 The genius traffic system in the real life 0.8-1.0 Red

Finally, the result will be sent from the computing


centre back to the genius traffic board. The genius traffic
board will show the traffic state using the color result. The
traffic state is almost in real time since it takes some time to
compute and transfer the result.

3. System design

This part introduces our approach of creating a system


of vehicle detection and counting from the video frame. We
will start with the overall framework of the system and the
Figure 2 The genius traffic board description of each component in the framework and the
basic understanding of the technique that we are using in
The genius traffic board will be installed near main each component.
cross-roads that usually have traffic jams. The genius traffic
board represents the traffic state in a graphic view which 3.1. Overview of vehicle detection and counting
shows street structure. It uses three colors to present the framework
traffic states, which are green, yellow and red, as shown in
Figure 2. The system consists of a normal PC which is connected
to a video camera, as shown in Figure 3. An input of the
2.1. How the genius traffic system works system must be a background frame without any moving
vehicles and a foreground frame with moving objects. The
First, the detector cameras or closed circuit televisions basic idea of the system is to calculate the number of
(CCTVs), which are installed at each point, will detect the vehicles that move through the detection area from the
traffic movement. Then the data will be sent through difference between the background frame and foreground
fiberglass cable to the computing centre. frame.
At the computing centre, the system will determine the
traffic status by using the image processing technique. It
uses occupancy ratio to consider the traffic state.
With the occupancy ratio algorithm, the computer
system will generate a square area whose size is close to the
size of a car on the street. The detector camera will detect

357
Proceedings of the 2008 International Conference on Wavelet Analysis and Pattern Recognition, Hong Kong, 30-31 Aug. 2008

.BMP file will be used in the image processing part. The


image processing will detect and collect the number of cars
in the .BMP file that comes from player part.

We represent the overall components which describe


all processes of the vehicle detection and counting system
structure chart, as shown in figure 4.

Figure 3 The required system hardware for gathering the


input vehicles

3.2. Vehicle detection and counting system structure


chart

In this project, we make a program possible to detect


each kind of vehicles on the road which are recorded in
video file. Moreover, the program can detect the cars which
have different color, so we have to make the program that
can separate the cars which are the objects on the road. The
program contains the picture of the road that have no cars,
as a background picture and then the program can
differentiate the cars from the road and make car detection Figure 4 The vehicle detection and counting system
with a captured image. After the car detection process is structure chart
done, the program will perform a counting process from car
detection and show the number of cars in the program. To The framework which is shown in Figure 4 displays
provide a better understanding and more details for each overall vehicle detection and counting. It consists of four
operation of object detection and counting, we will major components; 1) Image Acquisition, 2) Image
introduce the system structure and elaboration of how each Analysis, 3) Object Detection & Counting, and 4) Display
module is constructed. Result. The second level of the structure chart is the main
Preparing data: This process is the input part of the task that must be done in each component.
system. Before the system begins, we need to prepare our The first component is image acquisition. The processes
video which records the cars on the road in the .VOB in this component are “video stream” which is an input
format, but in Visual Basic6 allows a programmer that can from the video camera, “single-sequence image” which
use the .AVI to perform the image processing, so we need comes from capturing the video stream to single-sequence
to convert the .VOB format in the DVD format to the .AVI image in one frame, “store image in buffer” which is used
format file. We use a third party program to prepare the to store the images in the buffer, and “display captured
.AVI video file. We can use the .AVI video files in our image” which will show the image in picture box.
system when the process of preparing the .AVI file format The second component is image analysis. The processes
is done. After we finish preparing file, we can use the .AVI in this component are “differentiate image” which will
video file to play in the player part of our system for traverse the whole pixels of background image and it has to
capturing video as a one-frame image for image processing. compare the RGB value of each pixel at the same time
Preprocess: Preprocess is the process after we have during traversal in the differentiate image process, “store
finished preparing input data. It uses the video file from the the different RGB value” which is a process that stores the
player part and captures the one frame-image from video in values that come from differentiate image process and it
player part. The image that is captured and saved as the will store value as binary number and, “display binary

358
Proceedings of the 2008 International Conference on Wavelet Analysis and Pattern Recognition, Hong Kong, 30-31 Aug. 2008

image” which is used to show the image after previous 3. The third window area displays the background
processes are done, and the image is displayed in black and which has no cars in the image.
white. 4. The fourth window area displays the image in which
The third component is vehicle detection and counting. noises are recorded and converted into 2-bit image.
The processes in this component are “pattern creation” 5. The fifth window area displays the image which
which will create the patterns for making car detection, shows the detection and counting process. All black
“pattern matching” which uses the rules to detect the object rectangular boxes show a location of all counted
in the captured image and, “counting result” which is used cars.
to show result in the image that crops each detected object 6. The group of Multimedia buttons allows users to
in the image. control the video stream.
The fourth component is display result. The process in 7. The group of text box and command button area is
this component is “display result” which will show the used to select video file path.
object number in the screen after all of previous processes 8. The <Capture> button allows users to capture a
have been done. single frame from the video stream in the first
picture area.
4. System implementation 9. The <Count> button allows the end user to start the
car detection and counting system. The user can
This section explains the design of input and output user press this button again to recount action.
interface. The graphic of user interface will be presented 10. The <Save> button allows users to save the
here. We will introduce how the system performs in real- captured picture in the decided destination
life application. We create the interface by using Visual 11. The <View Report> button and report area
Basic 6, which is also used for programming. allows the user to retrieve all the counting cars at the
present time and view them immediately.
12. The <Exit> button allows the user to close the
application and exit the program.

5. Experimental results

This part presents an experimentation on the vehicle


detection system, which is developed and based on the
concepts and design mentioned in the previous part. In this
system, the experiment’s results are focused on the usability
and the effectiveness of the system.

5.1 Usability proof

In this section, we will analyze the usability of capturing


and detection and counting of this system. The input data
are the cars which pass through the road. The cars move
from left to right side and also move from right to left side
too. We use the capturing process to get the single-frame
Figure 5 The user interface of vehicle detection and
images. If we activate the detection and counting process
counting system
with the captured image, it will record the result with the
number of cars in notepad which can record the data with
The first interface is designed to support the users that
time stamp property, which means that the system will
want to use their stream file as an input of the system.
record every result in the notepad with the time of
The twelve parts in the interface relevant to the user, as
activation of detection and counting processes. We will
shown in Figure 5, are as follows:
check how well the system can be used without any error.
1. The first window area displays the video stream
According to the usability proof, the captured screens
which comes from the video file.
shown in Figure 6 display the correct detection and
2. The second window area displays the frame which
counting vehicle from a capture video frame.
comes from capturing the video stream.

359
Proceedings of the 2008 International Conference on Wavelet Analysis and Pattern Recognition, Hong Kong, 30-31 Aug. 2008

5.2.3. Playing video in our system

We use a multimedia player module in our system to


open video files. It can also play, stop and pause video like
other multimedia players in the real world. For using our
multimedia player, the users have just to choose video file
and click the play button.

5.2.4. Capturing video in our system

When the multimedia player module works well, the


capturing process should be checked before going to the
image processing phase. The user has just to click the
capture button, so the system will capture the video file
which is playing in the multimedia player module, and the
Figure 6 A screen showing correct detection and counting images which come from capturing in the screen will be
vehicles from video frame saved in the folder automatically. The images that come
from capturing can be used for image processing
5.2. Effectiveness proof immediately.

In order to test all functional aspects of the system 5.2.5. Detection and counting from video frame
thoroughly, we set up a test scenario which consists of 5
phases as shown below: After the program gets video frame, the user can click
• Recording Video from top view the count button to call Digital image processing method in
• Converting Video to .AVI file format our system. When the process of digital image processing is
• Playing Video in our system done, it will show block which covers on each car and the
• Capturing Video in our system result that shows the number of cars in the textbox.
• Activating the Detection and Counting from video
Table 2 The effectiveness testing result
Moreover, the test scenario can be used as a user
guideline for using our system in the real world because it Testing time Total number Correct Precision
covers all the steps necessary in order to use our system. of cars counting
The details of each phase are as the following:
Afternoon 233 212 91.98%
5.2.1. Recording video from top view

Since our system is developed for using with the web Evening 192 185 96.35%
camera or video camera which records video from top
view, we have to follow these steps. 1) We need to choose a
location that can record video from the bird eyes’ views. 2) The effectiveness test will be done the same as that in
We need to find a location that can record video clearly. 3) the previous section, but we focus on the correctness of the
We must record video without any annoyance with video or final result. We had tested from different samples of video
web camera. frames which were recorded from different views to prove
that our program can be used to perform the vehicle
5.2.2. Converting video into .AVI file format detection and counting not only in one place but it can also
be implemented with other cases at different time. We have
two data sets for our experiment. The first data set comes
We need to convert video by using any third party
from recording video in the afternoon and the second data
video converter. If our program is implemented with a
set comes from recording video in the evening. Each case
video camera directly, it does not have to convert video file
captures 51 video frames and the results of effectiveness
before using in the system.
testing are shown in Table 2.

360
Proceedings of the 2008 International Conference on Wavelet Analysis and Pattern Recognition, Hong Kong, 30-31 Aug. 2008

[8] Hideo M. N.M.Charkari and Takeshi M., ”On-Line


Vehicle and Pedestrian Detections Based on Sign
Pattern”, IEEE Transactions on Industrial Electronics,
6. Conclusion Vol. 41, No. 4, August 1994.
[9] Chia-Jung P., Hsiao-Rong T., Yu-ming L., Hong-
Based on the experimental results in the previous Yuan M.L. and Sei-Wang C., “Pedestrian detection
section, we can conclude that the correctness of result and tracking at crossroads”, Pattern Recognition,
depends on three factors: 1) The system may not Vol.37, Issue 5, May 2004.
differentiate some vehicles of which the color is similar to [10] Genius Joint Venture Co.,Ltd., “Genius Traffic
that of the road in the background image. 2) The system System”, http://www.forth-its.com,creation date:
cannot differentiate some vehicle size that is too small or unknown, last modified date: June 19, 2006, accessed
too large, such as that of bicycle, motorcycle, truck and bus. date:November 28, 2006.
3) The brightness of surrounding environment is one of the
three factors that can affect the result because the brightness
of environment affects the color value of each vehicle and
also that of the road. From our experiment, we can observe
that the percentage of correctness which comes from the
second data set is higher than that which comes from the
first data set because of the brightness.

References

[1] Dariu M.G. “Sensor-Based Pedestrian Protection”,


IEEE transaction on Intelligent Transportation
Systems, November/December 2001
[2] Kaweepap Kongkittisan, “Object Speed Detection
from a Video Scene”, Mahidol University, Bangkok
Thailand, May 2003.
[3] Liang Z. Charlea E.T. “Stereo- and Neural Network-
Based Pedestrian Detection”, IEEE Transactions on
Intelligent transaction system, Vol. 1, No 3,
September 2000.
[4] Osama M. and Nikolaos P.P. “A Novel Method for
Tracking and Counting Pedestrians in Real-Time
Using a Single Camera”, IEEE Transactions on
Vehicular Technology, Vol. 50, No. 5, September
2001.
[5] Fengliang X., Xia L. and Kikuo F., ”Pedestrian
Detection and Tracking with Night Vision” , IEEE
Transactions on Intelligent Transaction System, Vol.
6, No.1, March 2005.
[6] Massimo B., Alberto B., Alessandra F., Thorsten G,
and Marc-Michael M., ”Pedestrian Detection for
Driver Assistance Using Multiresolution Infrared
Vision”, IEEE Transaction on Vehicular Technology,
Vol. 53, No 6, November 2004.
[7] Dariu M.G., “A Bayesian, Exemplar-Based Approach
to Hierarchical Shape Matching”, IEEE Transactions
on Pattern Analysis and Machine Intelligence, Vol.29,
No.8, August 2007.

361

You might also like