2110433 Computer Vision
Traffic Flow Monitoring
Let's get started

Project Goal

The aim of this project is to detect traffic flow monitoring using computer vision,
which is counting the number of cars, finding the speed of each car and the overall speed.

Project Scope

The project support only one camera perspective,
other perspective can be applied with a little adjustment.
The scope of vehicle that can be detected are only cars on the lane of the road.


  • Adjust Perspective

    The perspective of the road makes it's hard to detect cars because the bounding boxes is in different sizes. This is important because each car’s real distance has to be calculated to find the speed. The solution to this task is to create four transformation matrices for four road lanes.

  • Background Subtraction

    After plotting the histogram graph of the background model, the color of the road is in the middle of the sorted color value. So we use median instead of mean to calculate chromatic distortion and brightness distortion.

  • Deal with Black and Grey Cars

    Background Subtraction finds it hard to detect them on the road because the color is similar to the road. Using Sobel Edge Detection instead of Background Subtraction to detect cars is the solution for this task.

  • Contour Cars

    Using Cars Detection algorithm with Sobel Edge Detection instead of findcontour function that already exists, to detect cars on the road

  • Close the Area

    Since the capote of the cars is plane, so edge detection can not detect. We have to close the area for improving the cars detection algorithm by using union find algorithm to connect the background and find the foreground.

  • Track Cars Frame By Frame

    To track the car, we get current and next centroid of cars, calculate to accurate y position. Then use lower bound to find proper new position of car and also use car speed to predicted undetected car in the frame

  • Find the Speed

    Transformation Matrix is used to warp the image so the real distance of driving can be calculated. With distance and time, the speed can be made.

  • Finish!


Suthida Sukhonunthikul

593 10731 21

Methus Kiatchaiwat

593 10536 21

Natawat Kwanpum

593 10170 21

Warit Prasartritha

593 10565 21