0% found this document useful (0 votes)
19 views

Vehicle Detection and Counting Final

The document discusses a project that aims to detect and count vehicles using computer vision and OpenCV. It describes the basic process which includes taking video input, registering the background, performing image subtraction to detect foreground objects, and counting vehicles by defining virtual zones.

Uploaded by

sumitrawal2020
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views

Vehicle Detection and Counting Final

The document discusses a project that aims to detect and count vehicles using computer vision and OpenCV. It describes the basic process which includes taking video input, registering the background, performing image subtraction to detect foreground objects, and counting vehicles by defining virtual zones.

Uploaded by

sumitrawal2020
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

Vehicle Detection And Counting Using OpenCV

An Industrial Training Project report for the evaluation and partial fulfillment of the
requirement for the award of the degree

B. TECH. (IT)

UNDER THE SUPERVISION OF

Dr. Pradeep Tomar

Co-Supervisor: -
Mrs. Sumedha Dangi

UNIVERSITY SCHOOL OF INFORMATION AND COMMUNICATION


TECHNOLOGY GAUTAM BUDDHA UNIVERSITY
GREATER NOIDA –201312, GAUTAM BUDDHA
NAGAR UTTAR PRADESH INDIA
Dec. 2021

Submitted By: -
Sakshi Rawal (19/BIT/037)

1
SCHOOL OF INFORMATION AND
COMMUNICATION TECHNOLOGY

GAUTAM BUDDHA UNIVERSITY, GREATER


NOIDA, 201312, U. P., (INDIA)
Candidate’s Declaration
We, hereby, certify that the work embodied in this project report entitled “vehicle
detection and counting using openCV” in partial fulfillment of the requirements for
the award of the Degree of B. Tech. (IT) submitted to the School of Information and
Communication Technology, Gautam Buddha University, Greater Noida is an authentic
record of our own work carried out under the supervision of Dr. Pradeep Tomar and
co-supervisor of Mrs Sumedha Dangi of School of ICT. The matter presented in this
report has not been submitted in any otherUniversity / Institute for the award of any
other degree or diploma. Responsibility for any plagiarism related issue stands solely
with me.

NAME: - ROLLNO: - SIGNATURE: -

Sakshi Rawal 19/BIT/037

This is to certify that the above statement made by the candidates is correct to the best
of my knowledge and belief. However, responsibility for any plagiarism related issue
solely stands with the students.

Signature of the Supervisor:


Name : Dr. Pradeep Tomar
Signature of the Co-Supervisor:

Name: Mrs.Sumedha Dangi


Date Place:24/12/2022, Greater Noida

2
Acknowledgement

We have taken efforts in this project. However, it would not have been possible without
the kind support and help of many individuals and organizations. I would like to extend
my sincere thanks to all of them.

We are highly indebted to Mrs. Sumedha Dangi for their guidance and constant supervision
as well as for providing necessary information regarding the project & also for their support
in completing the project.

We would like to thank Dean of ICT Prof. S. K. Sharma and HOD of IT, Dr. Neeta Singh
whose support helped me to complete my work. I would like to express my gratitude
towards my friends & family members ‘kind cooperation and encouragement which helped
me in completion of this seminar.

3
Abstract

In this paper the main focus is on detecting of vehicle and counting, particularly in traffic control.
Vehicle detecting and also counting are becomes growing important in a area of highway
regulators. However, because of the various structure of vehicles, their detections remain
challenging which directly influence in accuracy of a vehicle count. This paper address a video-
based techniques for vehicle recognition and counting based on OpenCV technologies. The
proposed technique uses the background subtraction method to discover forefront objects in video
sequel. Several OpenCV techniques, including of an thresholding, the adaptive morphology
operations, and hole filling are later applied in the series of detecting moving vehicles more
accurately. At last, vehicle counting is done by utilizing virtual identification zones.

4
Contents

Declaration 2
Acknowledgment 3
Abstract 4
Chapter 1: Introduction 7
1.1 About company 7
1.2 Technology Learned
1.3 Introduction to project 7-9
1.4 Challenges 10
1.5 Motivation 11
1.6 Project Objective 11

Chapter 2: Requirements for project 12

Chapter 3: Applications 13

Chapter 4: Benefits & Limitations 14

Chapter 5: Future Scope 15

Conclusion 16

References 17

5
Training Certificate: -

6
CHAPTER-1. Introduction:
1.1 Introduction to the company
NTPC is India’s largest energy conglomerate with roots planted way back in 1975 toaccelerate
power development in India. Since then, it has established itself as the dominant power major
with presence in the entire value chain of the power generation business. From fossil fuels it
has forayed into generating electricity via hydro, nuclear and renewable energy sources. This
foray will play a major role in lowering its carbon footprint by reducing greenhouse gas
emissions. To strengthen its core business, the corporation has diversified into the fields of
consultancy, power trading, training of power professionals, rural electrification,ash utilization
and coal mining as well.
INFORMATION TECHNOLOGY
NTPC has integrated Information Technology as a strategic tool in its management systems.
Services covered under Information Technology include the following:
• Management Information Systems
• Consultancy for development of Local Area Network /Wide Area Network
• Consultancy for Satellite Communication Network
• Computerization of O&M and Material management manuals

1.2Technology Learned: -
• Python
• Machine Learning (OpenCV)

1.3 Introduction to Project:


The traffic issue is a significant issue occurring in numerous urban areas in the world. There
are numerous significant reasons for the traffic issue. The quantity of individuals moving into
a metropolitan region has developed generously, prompting an emotional expansion in the
quantity of vehicles. However, the street limit has become generally lethargic and get lacking.
This causes an irregularity between the quantities of vehicles and streets, bringing about street
gridlock, particularly in enormous urban areas. An insufficiency of public transportation
frameworks likewise causes a similar issue. Vehicle detecting and counting have a significant
influence in numerous system that helps to regulate and control traffic in urban areas. The
fundamental goal is to detect and count moving vehicles with clear accuracy and to have the
option to do as such on streets, highways and in little paths, etc. OpenCV-analysis and
understanding of images and videos taken by an advanced camera-has acquired more approval
and been utilized in numerous fields including industry, medication, robotics, and so on.

7
Vehicle detection and counting systems can vary, but in general, they tend to operate as
follows:

1.3.1 Input Video


In this type of processing typically needs input data provided by the computer vision system
and acting as a vision sensor and providing a high-level information. Then the video frames
which are captured by the surveillance cameras are given as an input video for vehicle detection
and counting

1.3.2 Background Registration


The Background registration technique is used to construct a reliable background image from
the accumulated frame difference information. The moving object region is seperated from that
background region by comparing the current frame with the background image. In background
registration, the history of the frame difference mask is considered in constructingand updating
the background buffer. If a pixel is marked as changing in the frame difference mask, the
corresponding value in the stationary map is cleared to zero. Otherwise, if the pixelis stationary
the corresponding value is incremented by one. The value in the stationary map is indicate that
the corresponding pixel has been not changing for how many consecutive frames. If the pixel
is stationary for the past several frames, then the probability is high that it belongs to the
background region.

1.3.3 Image Subtraction


Image subtraction or pixel subtraction are process where the digital numeric value one pixel
or whole image are subtracted from another image. This is primarily done for one of two
reasons levelling uneven sections of an image such as half an image having a shadow on it, or
detecting changes between two images. This detection of changes can be used to tell if
something in the image move. In which the target is moving and would be in one place in one
image, and another from an image one hour later and where using this technique would make
the fixed stars in the background disappear leaving only the target.

1.3.4 Foreground Detection


Foreground detection is one of the major tasks in the field of computer vision and image
processing whose aim is to detect changes in image sequences. Background subtraction is any
technique which allows an image's foreground to be extracted for further processing (object
recognition etc.). Foreground detection separates foreground from background based on these
changes taking place in the fore ground. It is a set of techniques that typically analyse video
sequences recorded in real time with a stationary camera.

1.3.5 Image Segmentation


Image segmentation techniques are interested in segmenting out different parts of the image
as per the region of interest. As videos are sequences of images, motion segmentation aims at
decomposing a video in moving objects and background by segmenting the objects that
undergo different motion patterns. The analysis of these spatial and temporal changes
occurring in the image sequence by separating visual features from the scenes into different
groups lets us extract visual information. Each group corresponds to the motion of an object in
the dynamic sequence.

8
1.3.6 Vehicle Detection
Vehicle detection is a technique used in computer vision and image processing. Multiple
consecutive frames from a video are compared by various methods to determine if any moving
object is detected. Moving objects detection has been used for wide range of applications like
video surveillance, activity recognition, road condition monitoring, airport safety, monitoring
of protection along marine border.

1.3.7 Vehicle Counting


In counting step, a counter is used to store the sum value of them. A counter should count the
vehicles which are passing in the specific direction. So, if any vehicle stops, move turn in any
direction in detection zone which are not counted. In this technique, counting is according to
the number of moving vehicles detected in the detection zone

9
Flowchart:

1.4 Challenges

Camera Motions: when there is a motion in camera’s field of view, like the videos
captured by unstable or vibrating cameras, processing the video will be a challenging
issue. The result of this phenomenon is
usually represented as motion blur in video scene which affects both detection and
tracking steps harder.

10
Different shapes of vehicles : Since there are different vehicle categories, if the
detection system is based on classification of vehicles by their visual features like
headlight and bumpers, some vehicles
may be misclassified. This challenge is the most common in supervised technique vehicle
detection

Low Light Conditions: in nights and other low light situations like tunnels, cars can’t be
simply detected by their visual features and the only part of them that can be recognized
are headlight/taillight lamps. So other parts that do not produce light or exposed to light
from a very close distance will appear to have dark color. This lack of visual features can
affect detection and tracking processes. The other challenge
here is to pair detected lamps to be considered as an individual car. Image binary
conversion using an adequate threshold value can deal with such situations. At night
videos, vehicle headlights/taillight and bad illumination that may cause strong noise can
also lead to many difficulties for the detection task.

Congested Traffic Conditions:


In urban traffic images, vehicle occlusion and traffic jams are two common phenomenon.
Vehicle occlusion can occur anytime a vehicle passes behind other vehicles with respect to a
camera. Occlusion in both partial and full types, may affect the process of computing the
background frame. If a vehicle detection system is based on motion information, the congested
traffic conditions may severely affect the results.

1.5 Motivation

The main motivation of this project stems back from when we were assigned to a project
by our mentor at NTPC Dadri to count and detect number of vehicles visiting the plant.
That can help in parking management of the plant.

1.6 Project Objective

The objectives of vehicle detection and counting system is to detect and count the number
of vehicles .Vehicle detection and statistics in highway monitoring video scenes are of
considerable significance to intelligent traffic management and control of the highway.
With the popular installation of traffic surveillance cameras, a vast database of traffic video
footage has been obtained for analysis.

11
CHAPTER-2 Project Requirement

TECHNOLOGIES USED
The key technologies that constitute the application are:
● Python
● OpenCV

SOFTWARE USED
The software used to setup and run the application are:
● Visual Studio Code
● Python 3.11 Interpreter

HARDWARE REQUIRED
The hardware specifications required to run the application are:
● A machine running any popular 64-bit desktop operating system
● At least 8 GB of RAM on the machine

EXTENSIONS USED
The extensions used to run the application are:
● Python Extension for VS Code

LIBRARIES USED
The Python libraries used in this project are listed below:
● OpenCV-python
● NumPy

12
CHAPTER-3 Applications
1. vehicle speed measurement
2. identification of traffic accidents
3. traffic flow prediction
4. Parking management

13
CHAPTER-4 Benefits and Limitations
Limitations:
Capture errors: Varying intensity of light during day affects the appearance of background
scene and can cause false positive detections of vehicles, which means considering non-vehicle
objects as vehicles in a video sequence. Fast transition from cloudy to bright sunlight is a
common phenomenon which can result in sudden illumination changes.

Positional errors: Tracking may be difficult when conditions introduce uncertainty into the
positions of anatomical locations within the image. This may also occur when attempting to
track a movement froma suboptimal viewpoint.

Limitations of recording devices: Use of devices with low sampling rates may be unable to
capture accurate movement of vehicles.The aperture and shutter speed of recording devices can
also impact image quality and introduce blurring, which can impact the quality of the tracking
achieved through pose estimation.

Benefits:

A vehicle detection and counting system could be beneficial for the traffic police because
everything they can monitor from one place only likes how many vehicles have crossed
this toll and which vehicle.
Moving vehicle detection, tracking, and counting are very critical for traffic flow
monitoring, planning, and controlling. Video-based solution, comparing to other
techniques, does not disturb traffic flow and is easily installed. By analyzing the traffic
video sequence recorded from a video camera, this paper presents a video-based solution
applied with adaptive subtracted background technology in combination with virtual
detector and blob tracking technologies.

14
CHAPTER-5 Future Scope &Applications

1. Helps traffic police: A vehicle detection and counting system could be beneficial for
the traffic police because everything they can monitor from one place only likes how
many vehicles have crossed this toll and which vehicle.

2. Maintaining records: It is challenging for some individuals to record all the vehicles
with them because the cars are passing by in real-time. It’s not like that one is watching
the video, and they can pause it and have a note of it, so to remove this limitation, this
application can be very well-versed to attain the time-saving quality and be automated.

3. Traffic surveillance control: As this application can be planted anywhere as it only


requires a camera or some wires (for establishing the connectivity with the central
system) hence if the traffic is high at someplace, then from that area, an officer can
monitor it and forward the information to next toll officer so that they could be prepared
beforehand

15
CONCLUSION
This paper has clearly explained about the vehicle counting detection system to identify
and counting the number of vehicles from the video sequence captured from static cameras.
Firstly, by using adaptive background subtraction with virtual detector, secondly
foreground masking, find contour method, motion analysis and edge detection techniques
have been used. Open computer vision techniques like threshold calculation and blob
analysis, hole filling, morphological operations, are applied to remove objects and to
remove noises from the video frames for smoother boundaries. Thirdly, by using contour
methods to identify the vehicles and counting the number of vehicles in the video sequence
captured from static cameras. Once the vehicle has reached the region of interest count
would begin as mentioned in the above method.

16
References

• For learning about OpenCV:


https://docs.opencv.org/4.x/d6/d00/tutorial_py_root.html

• For learning about Python:


https://docs.python.org/3/

• geeksforgeeks
https://www.geeksforgeeks.org/

17

You might also like