Traffic Management Using Image Processing

lemonadeviraginityΤεχνίτη Νοημοσύνη και Ρομποτική

6 Νοε 2013 (πριν από 3 χρόνια και 9 μήνες)

149 εμφανίσεις

Traffic Management Using Image Processing


COMPUTER ENGINEERING
-

SIXTH SEMESTER

Page
3



ACKNOWLEDGEMENT



With deep sense of gratitude I would like to acknowledge the inspiring gui
dance of my
guides, respected M
s.P
ooja Shelar
, Professor, Computer Department and M
r
.
Makrand
Gurav
, Professor, Computer Department of Pravin Rohidas Patil College
Of Diploma
Engineering and Technology. Despite of their busy schedule they were always kind and
patient to listen to my difficulties throughout the duration of my project. It is because of
their support that I could synchronize the efforts in covering the
manifold features of the
topic.

I would like to thank all the teachers of Computer Engineering Department, my classmates
and all those who helped me directly or indirectly in the completion of my project work.

I would also like to acknowledge the infrast
ructural support provided by our Library and
Diploma laboratory.

I would also like to express my heartfelt gratitude to my parents, teachers and friends
for their direction, motivation and selfless support
.















Traffic Management Using Image Processing


COMPUTER ENGINEERING
-

SIXTH SEMESTER

Page
4



ABSTRACT




Traffic
management is becoming one of the most important issues in rapidly growing
cities like Pune. Due to bad traffic management lot of man
-
hours are being wasted. Regarding
this problem, we have thought to develop a self adaptive system which can help in better

traffic
management.



The main objectives of our project are :


1) To develop an application that helps to manage traffic effectively by providing different
strategies for different situations.


2) To provide options to perform certain im
age enhancements operations on traffic images.


3) To provide a good user interface for user to work with.



We came up with two different strategies for different situations depending on rate of
change of traffic density.




In the first part we have implemented the basic traffic control system called the fixed time
system which is implemented almost everywhere in India. Also in this part we have
synchronized the signals serially. Synchronization of signals helps in saving tim
e.



In the second part we are using the technique of image processing for traffic control. An
Image is a rectangular graphical object. Image processing involves issues related to image
representation and compression techniques and various c
omplex operations, which can be carried
out on the image data.

We are using image processing operations to calculate traffic density as
cameras are cheaper and affordable devices compared to any other devices such as sensors. We
have provided options for l
oading traffic image files and for calculating traffic density. The
different steps in image processing are : image representation, image enhancement, image
restoration and edge detection.




The main applications of this tool are : The RTO

Department , The Railway Department
and the everyday commuters who go to and from from one place to another everyday. This tool
will be of great use to control and manage traffic which save time of the commuters and also
reduce the risk of accidents in ci
ties.



We have used java language since java has many inbuilt classes which help in image
processing and also are portable since java is both compiled and interpreted.



Finally we would conclude that we were able to develop a
self adaptive traffic
management system. Our product can be taken as foundation to develop better traffic
management systems.




Traffic Management Using Image Processing


COMPUTER ENGINEERING
-

SIXTH SEMESTER

Page
5



INDEX


Chapter 1: Introduction


This chapter will give importance of
our project in management of traffic
.


Chapter 2: Hardwar
e & Software Requirement


This chapter gives the details of hardware & software required in the project.

Chapter 3: Block Diagram &
data Flow

Diagram

This chapter gives the flow of project

Chapter 4: Implementation and Results

Detail explanation of the pro
ject

Chapter 5:
Application & Future Scope

Where we can use project and its future scope for improvement

Chapter 6
: Bibliography

The references used for the successful implementation of project are listed here.




Traffic Management Using Image Processing


COMPUTER ENGINEERING
-

SIXTH SEMESTER

Page
6



1
.


Abstract

4

2.


Introduction

7




2.1
Traffic Management

7



2.2
Image Processing

8

3.


Literature Survey

9



3.1
Image Processing

9



3.2 Java

13

4
.


Hardware and Software Requirement

1
5





4
.1 Hardware

1
5



4
.2 Software

1
5

5
.


Analysis

1
6




5
.
1

Data Flow Diagram

16



5
.
2

Activity Plan Chart

18

6
.


Design

19



6
.1 UML Diagrams

19



6
.1.1 Use Case Diagram (Scenario 1)

19



6
.1.2 Use Case Diagram (Scenario 2)


20



6
.1.3 Class Diagram

21



6
.1.4 State Diagram

22



6
.1.5

Component Diagram

23



6
.1.6 Deployment Diagram

24

7
.


Project
Application

33

8
.


Bibliography


34





Traffic Management Using Image Processing


COMPUTER ENGINEERING
-

SIXTH SEMESTER

Page
7





INTRODUCTION



2
.1 Traffic Management




Traffic means the movement of vehicles along a route. Congestion may result due to heavy
traffic at a junction. In developing cities like Pune, traffic management is becoming
important issue day by day due to rapid increase in number of vehicles. Lot of man
-
hours are
being wasted in traveling due to bad traffic management. To avoid congestion

there are so
many traffic management techniques available. Even though many companies are working
on traffic management over years, no technique is perfect by itself as the real time situations
are generally continuously changing and the system has to ada
pt itself to change in the
continuously changing circumstances.






We have made an attempt to provide some traffic management strategies which
are self adaptive in nature, so as to fit in to continuously c
hanging real time traffic scenarios.
For the Junction at which rate of change of average traffic density is less we have provided
strategy called Gradual Adaptation and for the Junctions at which average traffic density
varies drastically with respect to t
ime we have provided a strategy which we have named On
-
Situation scheduling. In exceptional situations we have provided option for manual traffic
control.







Traffic Management Using Image Processing


COMPUTER ENGINEERING
-

SIXTH SEMESTER

Page
8





2.
2 Image Processing







Traffic density of lanes is calculated using image processing which is
done of images of lanes that are captured using digital camera. We have chosen image
processing for calculation of traffic density as cameras are

very much cheaper than other
devises such as sensors.





An Image is rectangular graphical object. Image processing involves issues
related to image representation, compression techniques and various complex oper
ations,
which can be carried out on the image data. The operations that come under image
processing are image enhancement operations such as sharpening, blurring, brightening, edge
enhancement etc.Image processing is any form of
signal processing

for which the input is an
image, such as photographs or frames of video; the output of image processing can be either
an image or a set of characteristics or parameters related to

the image. Most image
-
processing techniques involve treating the image as a two
-
dimensional signal and applying
standard
signal
-
processing

techniques to it. Image proces
sing usually refers to
digital image
processing
, but optical and analog image processing are also possible.


















Traffic Management Using Image Processing


COMPUTER ENGINEERING
-

SIXTH SEMESTER

Page
9






LITERATURE SURVEY


3
.1 Imag
e Processing




An Image is rectangular graphical object. Image processing involves issues
related to image representation, compression techniques and various complex operations,
which can be carried out on the image data. The operations that c
ome under image processing
are image enhancement operations such as sharpening, blurring, brightening, edge
enhancement.


3
.1.1
Steps in Image Processin
g



Image Representation




Image representation is concerned with characterization of the quantity that
e
ach picture
-
element (pixel) represents. The fundamentals requirement of digital processing is
that images can be sampled and quantized.




Image can be represented in analog or digital form. In digital representation,
image can be represented in
gray
-
scale or color format. The gray
-
level images are represented
as 8
-
bits which allows 256(0
-
255) possible gray color combinations. The color images are
represented as 24
-
bits (32
-
bits including alpha transparency) in which each 8
-
bits represents
red, gr
een and blue colors.




Traffic Management Using Image Processing


COMPUTER ENGINEERING
-

SIXTH SEMESTER

Page
10





Image Enhancement






In Image enhancement, the goal is to accentuate certain image features
for subsequent analysis or for image display. Examples include contrast and edge
enhancement is useful in feature
extraction, image analysis,

and visual information
display. The enhancement process itself does not increase the inherent information
content in the data. It simply emphasizes certain specified image characteristics.






Image Restoration






Image restoration refers to removal or minimization of unknown
degradations in an image. This includes deblurring of images degraded by the limitation
of sensor or its environment, noise filtering, and correction of geometric distortion or
non
-

linear
ties due to sensors.





Edge Detection




The image consists of objects of interest displayed on a contrasting
background; an edge is a transition from background to object or vice versa. The total
change in intensity from background to
foreground is called the strength of the edge or
edge detection.




Traffic Management Using Image Processing


COMPUTER ENGINEERING
-

SIXTH SEMESTER

Page
11







Histogram Calculation


The histogram of an image represents the relative frequency of
occurrence of the various gray levels in the image. The histogram of a digital i
mage with
gray levels in the range(0,l
-
1) is a discrete function




P(r
k
)= n
k
/n




Where,




r
k

is the k
th
gray level




n
k
is the number of pixels in the image with that gray




level





n is the total number of pixels in the image k=0, l
-
1.

P(r
k
) gives an estimate of the probability of occurrence of gray level r
k
. A plot of this
function for all values of k provides a global description of the appearance of an image.


The horizontal
axis of the histogram encompasses the range (0,255), which is possible
range of gray level values for an 8
-
bit image. The vertical axis shows the number of
pixels for each gray level instead of probabilities.


3
.1.2 Linear Spatial Filter (Convolution Opera
tion
)

Linear
s
pa
t
ial

filtering

is referred to as “Convolving a mask with an image. Similarly
filter masks are sometimes called
Convolution masks
. The term
convolution kernel

also is
in common use. While interest lies on the response R, of an mxn mask at an
y point (x,y)
and not on the mechanics of implementing mask convolution, it is common practice to
simplify the notation by using the following expression:
-



Traffic Management Using Image Processing


COMPUTER ENGINEERING
-

SIXTH SEMESTER

Page
12




R=w
1
z
1+

w
2
z
2+.....+
w
mn
z
mn


= ∑ w
i
z
i


mn


i=1

where,

w’s are mask coefficients,

z’s are the values of image gray l
evels corresponding to those coefficients and,

mn is total number of coefficients in the mask.




Non linear specia
l filters also operate on neighborhoods, and the mechanics of
sliding a mask past an image are same as was just outline. In general, however, the
filtering operation is based conditionally on the values of pixels in the neighborhood
under consideration, an
d they do not explicitly use coefficients in the sum
-

of


products
manner described in the above equation.


W
1

W
2

W
3

W
4

W
5

W
6

W
7

W
8

W
9



An important consideration in implementing neighborhood operations for spatial
filtering is the issue of what happ
ens when the center of the filter approaches the border
of the image. Consider for simplicity a square mask of size nxn. At least one edge of such
a mask will coincide with the border of the image when the center of the mask is at a
distance of (n
-
1)/2 pix
els away from the border of the image. If the center of the image
moves any closer to the border, one or more rows or columns of the mask will be located
outside the image plane. There are several ways to handle this situation; the simplest is
to limit th
e excursions of the center of the
mask to be at a distance no less than (n
-
1)/2
pixels from the border. The resulting filtered image will be smaller than the original, but
all the pixels in the filtered imaged will have been processed with the full mask.



Traffic Management Using Image Processing


COMPUTER ENGINEERING
-

SIXTH SEMESTER

Page
13





If the result is required to be the same size as the original then the approach typically
employed is to filter all pixels only with the section of the mask that is fully contained in
the image, with this approach there will be bands of pixels near the

border that will have
been processed with a partial filter mask. Other approaches include “padding” the image
by adding rows and columns of zeros or other constants gray level, or padding by
replicating rows or columns the padding is then stripped off at
the end of the process this
keeps the size of the filtered image the same as the original, but the values of padding
will have an effect near the edges that becomes more prevalent as the size of the mask
increases the only way to obtain a perfectly filtere
d result is to accept a some what
smaller filtered image by limiting the excursions of the center of the filter mask to a
distance no less than (n
-
1)/2 pixels from the border of the original image.


3
.2 Java



3
.2.1 Java Development Toolkit


The Java dev
elopment kit comes with a collection of tools that are used for developing
and running java programs.

They include :



Appletviewer (for viewing applets)



Javac (Java compiler)



Java (Java Interpreter)



Javap(Java Diassembler)






Traffic Management Using Image Processing


COMPUTER ENGINEERING
-

SIXTH SEMESTER

Page
14





3
.2.2 Multi Threaded Prog
ramming






A multi Threaded program contains 2 or more parts that can run
concurrently. Each part of such a program is called a thread, and each thread defines a
separate path of execution. Thus multithreading is a special
ized form of multitasking. We
use Runnable interface for continuous animation to take place. The runnable abstracts are
unit of executable code; you can construct a thread on any object that implements
runnable.







Java’s threading is built into the language, which makes a complicated
subject much simpler. The threading is supported on an object level, so one thread of
execution is represented by one object. Java also provides limited resource locking. It

can
lock the memory of any object (which is, after all, one kind of shared resource) so that
only one thread can use it at a time. This is accomplished with the synchronized

keyword.
The programmer must lock other types of resources explicitly, typically
by creating an
object to represent the lock that all threads must check before accessing that resource
.














Traffic Management Using Image Processing


COMPUTER ENGINEERING
-

SIXTH SEMESTER

Page
15




3
.2.3
Swings






Swing components are not implemented by platform specific code.
Inst
ead, they are written entirely in Java and are platform independent. The term
lightweight is used to describe such elements. Some of the swing component classes used
are:





JFrame



JMenu



JMenuItem



JScrollBar



JSlider



JButtons



JMenuBar



JPanel



JLabel















Traffic Management Using Image Processing


COMPUTER ENGINEERING
-

SIXTH SEMESTER

Page
16



SYSTEM REQUIREMENT SPECIFICATION



4
.1 Hardware Requirements




Processing engine and processing speed: 1.2 G Hz +




Memory Requirements: 64MB RAM or higher.




Peripheral Requirements: Digital Camera, Stable computer.


4
.2 Software Requirements




Operati
ng system: windows 9X, 2000,XP




Language: Java 1.2.x with Net Beans IDE




Database: not applicable.












Traffic Management Using Image Processing


COMPUTER ENGINEERING
-

SIXTH SEMESTER

Page
17



Data Flow Diagrams



5
.
1
.

DFD f
or Image Enhancements Operations









Traffic Density

Calculate Average Traffic density



Load Image

Convert to grayscale image

Traffic Density Calculation

Calculate preferable LAN


Calculate GSD at appropriate time

Signaling

Calculate weightage

Gradual Adaptation

On
-
Situation


Scheduling

Traffic Management Using Image Processing


COMPUTER ENGINEERING
-

SIXTH SEMESTER

Page
18




5
.
2
.
DFD for Traffic Controlling Using Ima
ge Processing







Resettin
g

Sharpenin
g

Process Image

Enhanced Image

Edge


Detection

Brightenin
g

Blurring

Load the Image

Traffic Management Using Image Processing


COMPUTER ENGINEERING
-

SIXTH SEMESTER

Page
19



5
.3 Activity Plan Chart



The proje
ct schedule starts from SEP

2007 and ends in MAY 2008


The Different Phases identified are:


1.

Requirement Analysis.


2.

Requirement Specification.


3.

System Design.


4.

Detailed Design.


5.

Coding.


6.

Testing.



The Gantt chart as shown below represents the approximate schedule follo
wed for the
completion of
each phase
:





Traffic Management Using Image Processing


COMPUTER ENGINEERING
-

SIXTH SEMESTER

Page
20



DESIGN


UML Diagrams



6
.1. Use Cas
e Diagram (Scenario 1)



Traffic Management Using Image Processing


COMPUTER ENGINEERING
-

SIXTH SEMESTER

Page
21




6
.2. Use Case Diagram (Scenario 2


Development Phase)


Traffic Management Using Image Processing


COMPUTER ENGINEERING
-

SIXTH SEMESTER

Page
22




6
.3. Class Diagram





Traffic Management Using Image Processing


COMPUTER ENGINEERING
-

SIXTH SEMESTER

Page
23




6.4.

State

Machine Diagram (States of the Camera)





Traffic Management Using Image Processing


COMPUTER ENGINEERING
-

SIXTH SEMESTER

Page
24




6
.5. Component Diagram



Traffic Management Using Image Processing


COMPUTER ENGINEERING
-

SIXTH SEMESTER

Page
25




6
.6. Deployment Diagram



Traffic Management Using Image Processing


COMPUTER ENGINEERING
-

SIXTH SEMESTER

Page
26



PRINT SCREEN



7
.1
.

Main Screen 1








Traffic Management Using Image Processing


COMPUTER ENGINEERING
-

SIXTH SEMESTER

Page
27









7
.2
.
Main Screen 2
















Traffic Management Using Image Processing


COMPUTER ENGINEERING
-

SIXTH SEMESTER

Page
28




RESULT





8.1.
Traffic Monitoring









Traffic Management Using Image Processing


COMPUTER ENGINEERING
-

SIXTH SEMESTER

Page
29







8.2.
Traffic Control












Traffic Management Using Image Processing


COMPUTER ENGINEERING
-

SIXTH SEMESTER

Page
30







8.3.

Emergency System












Traffic Management Using Image Processing


COMPUTER ENGINEERING
-

SIXTH SEMESTER

Page
31







8.4.

Fixed Timer System












Traffic Management Using Image Processing


COMPUTER ENGINEERING
-

SIXTH SEMESTER

Page
32







8.5.

Self Adaptive

System













Traffic Management Using Image Processing


COMPUTER ENGINEERING
-

SIXTH SEMESTER

Page
33




PROJECT APPLICATIONS




The main application of our project is that it is a very helpful tool for the RTO
Department. This tool helps in the management of traffic. This tool will be of great help to
the traffic police. His hectic job

of standing in the sun and controlling the traffic will lessen.
Also with the help of this tool the traffic police can catch hold of the people who break the
traffic signals and traffic rules. They will no longer have to run after such people because the
camera will capture images of such people and alert at the next junction. Thus this will also
help in reducing crime. All people will have to follow the rules.


Also this tool will be very useful to the commuters who go to and fro from
one pl
ace to another everyday for work. After long working they have to wait at the junctions
for a long time. This tool will be of great use to these people because they will no longer
have to wait for long for their signal to go green. This tool will help in
reducing the rate of
accidents which are taking place almost everyday on busy streets. And also will help in
reducing the rates of traffic jams.




If made some further changes this tool can also be used by the Railway
Departme
nt. The movement of trains can be done with the help of this tool. This tool will
also prevent the unwanted accidents which take place almost everyday because of wrong
signals given to the trains.




Thus this tool is of great

use to the RTO Department, everyday commuters and the
Railway Department.






Traffic Management Using Image Processing


COMPUTER ENGINEERING
-

SIXTH SEMESTER

Page
34





BIBLIOGRAPHY


1.

Rafael C.Gonzalez & Richard E.Woods,
Digital Image Processing
,
Addision Wesley
Longman, Fourth Edition, 2000


2.
Anil
K.Jain,

Introduction to Image Processing,
PHI India Ltd.Second Edition, 1990.



3. Maher A. Sid
-
Ahmed, Image Processing: Theory, Algorithms, and Architectures,
McGraw
-
hill Publications, 1995


4.
Patrick Naughton & Herbert

Schildt
,
Java 2 :

The Complete Reference, Tata McGraw
-
Hill Ltd, Third Edition, 2000


5.

Laurence Venhelsuwe,

Ivan Phillips,

Goang
-
Tay Hsu, Krishna S
hankar,

Mastering Java
,
2
nd

Edition,1997