Traffic Congestion Gauge

Guy Layfer, Arthur Furmanovsky

Motivation

We noticed that a lot of traffic lights in our city were not operating optimaly.
For example, you might find yourself waiting for a green light quite some time
even though there are no cars crossing the intersection.
What a waste of time, isn’t it?
In general, we noticed that in many cases there is a green light for a direction
where there is way less traffic than on other directions.
After doing some research, we found that the majority of traffic lights are operating
on a static timer that was planned according to estimated traffic patterns.
But the problem is that many times traffic behaviour does not suit the regular traffic patterns.

Our Goal

To create a simple and cheap system that will provide real time information
about traffic congestion on each direction at the intersection.

The Solution

A web camera system that identifies and counts cars.
The system measures and indicates how many cars are waiting
or going to cross the intersection from a specific direction.

Algorithm

The system performs the following operations on each frame of the captured video.

  1. Original Frame:

  2. Background Subtraction:

    Seperating the moving objects from the static background.
    The result of this operation is an image with black background
    and white blobs which represent the moving objects.

  3. Erosion & Dilation:

    Sometimes the video capture is not stable and it creates unwanted noise which is
    represented by tiny blobs that appear randomally in the background subtraction image.
    Erosion is used to filter those tiny blobs by decreasing the size of the blobs.
    Then, Dilation is used to increase the size of the remaining blobs
    to improve the accuracy of the blob detection operation.

  4. Blob Detection:

    Detecting the blobs which represent the cars on the road.
    Some paremeters should be determined for this operation, for example:
    area size, convexity, circularity etc..

  5. Car counting and measuring the congestion:

    Defining rectangle areas of interest for top and bottom limits of the road.
    Then counting the centers of the blobs which represent the cars that cross those areas,
    and by doing so, indicating the congestion which is the number of cars between those rectangles.

Code

tcg.py

Useful Links

OpenCV Documentation

OpenCV-Python Tutorials

OpenCV: Background Subtraction

Blob Detection Using OpenCV

Contact Us

Guy Layfer: layfergp@gmail.com
Arthur Furmanovsky: foarthur@gmail.com

Accessibility
Close Close