Automated People flow tracking | with Computer Vision and AI

I built this people flow tracking prototype to track the flow of people in large areas such as airports, shopping malls, large open spaces, or whatever.

In this video, we will see what the steps are to build this type of solution and what are the critical points for example object tracking in an uncontrolled environment, and understand when this type of solution can be implemented and when it is not good.

Basically, this solution consists of:
-Object Detection
-Object tracking
-Object counting

But care must be taken not to regard this project as the ultimate solution. To build a working software you must consider that it must be prepared for operation in uncontrolled environments, different devices, and cameras. All this might sound very simple, but there are so many aspects to consider.

According to Travel Weekly Airports were crowded last year. It could be a terminal problem article, the increase in people at airports is creating problems, and managing large numbers of people in the right way is critical, especially for security.

People flow tracking first Object detection

The first step to consider is object detection, in fact, you have to make sure that the object, in this case, people, is identified by the software.

In the image below you can see how the bounding box is present around the people. I point out that the people at the top of the image are not identified because they are very small, the problem can be overcome but for our project, it is not necessary.

People flow tracking Object detection

Object tracking

Once the object has been identified, it needs to be tracked and then assigned a unique Id. Considering that the video is read by OpenCV as a sequence of images, the tracking algorithm must make sure to always track the same object in subsequent images.

This operation can be particularly complex due to multiple factors so it is something to be carefully planned.

object tracking

Use ROI on People flow tracking project

We can now consider an area of interest to determine whether tracked people cross the line or not. We have already done a project where we explain this concept: How to count people from CCTV cameras

Object counting and flow tracking

Thanks to tracking we can record people’s previous positions, and this is very helpful in determining their direction.

past tracking

By putting all this information together and tracking the flow of people, it is possible to define with certainty how many people pass through a given point and also determine the direction.

people flow tracking direction and counting


This small prototype I made helps to evaluate the displacements of a large number of people in well-defined environments but is to be considered, precisely, an exercise. In a real environment, there are so many other parameters to take into account.


Learn to build Computer Vision Software easily and efficiently.

This is a FREE Workshop where I'm going to break down the 4 steps that are necessary to build software to detect and track any object.

Sign UP for FREE