Counting Traffic


Development Tools:

The project was done using Python in Jupyter Notebook and with the use of the following libraries:

pyttsx3
pywin32
numpy
opencv-python
 
Project-related information:

This project is built on top of the motion detection project and allows us to count the number of vehicles going in a certain direction.
In this case, I implemented an algorithm that counts the cars going from the right to the left.

Below is an image where you can see the red circle in the top left corner of the green rectangle.
That is the pixel coordinate that I track and if it moves from the right side of the screen to the left and is added to the counter when it crosses the pedestrian crossing.

You'll note the counter in the top left corner of the video.
I also calculate the number of cars per minute.

This is information that could be used to make the traffic lights dynamic in order to reduce traffic congestion.

The link at the top of the page (Visit Button) shows the actual implementation with the code, etc.

Below is a short video that shows the algorithm in action.