How to create highway TRAFFIC CAMERA with FLOW

Turn a standard traffic camera into a smart sensor in just a few clicks!

Marta avatar
Written by Marta
Updated over a week ago

FLOW empowers you to create a multimodal traffic analysis system in a few clicks. FLOW runs in real-time and hence enables you to control time-critical applications based on the extracted traffic intelligence, such as controlling traffic lights based on the momentary traffic situation or detecting speeding.

In this example, we will focus on a simple scenario. We will create a highway monitoring sensor. We will leverage the extracted data for improving safety by detecting the wrong-way driving on a slip road. We will set up an alert for the traffic control in case of a dangerous state via our API. This will enable the local adaptive signaling system to close the highway segment immediately and prevent a potentially lethal accident.

Download free FLOW demo kit here.

Goals/objectives: 

We will use a traditional fixed camera that captures a highway section with deceleration and acceleration lanes and turn this existing camera into a smart sensor for traffic intensity measurement and wrong-way driving detection. The outputs of this simple setup include:

  • Traffic intensity measurement with a resolution to lane level

  • Vehicle count visualization for every lane

  • Vehicle class distribution in the form of a histogram

  • Real-time detection of wrong-way slip road driving. Signaling of this state via UDP API to an adaptive traffic signaling system

The footage we use is from the Czech Republic, Brno - the city where DataFromSky comes from. Vehicles traveling towards the camera are leaving the city, whereas vehicles moving away from the camera are bound for Brno city. We recommend checking our basics of FLOW Insights article prior to working on this tutorial.

How to design the FLOW?

Step 1 - Create the gates

First, we will create four virtual gates by using the Create zones/gates tool. To position the gates correctly, it is a good idea to consider the placement of the trajectories in the image. We recommend naming the gates concisely. In our example, we have created two gates for the Inbound and two gates for the Outbound lanes.

Now, we can drag and drop the gates instances to the canvas. This operation makes the gates active, they start to filter the trajectories and display their number.

For more information on the spatial filters please refer to Chapter 6 of the getting started guide.

Step 2 - Create monitoring widgets

Let’s create a simple dashboard monitoring our traffic situation. In the Programming Elements Menu, we will switch to the widgets tab, find the Value element, and drag it towards one of our gate instances. The region for dropping the widget gets automatically highlighted.

Upon placing the widget a configuration window appears. Again, we recommend using a descriptive name for the widget, so that anyone can clearly understand what data does it display. We will add the Value widgets for all four gates of our interest. 

Step 3 - Monitor the data

 When we have configured all four gates to send their object counts to the dashboard, it might be a good time to check the result of our work. Let’s switch to a Dashboard environment in the left menu. The vehicle count for each lane gives us a clear overview of the traffic loads. We can rearrange the widgets simply by dragging and dropping them as needed.

What if we wanted to see the overall inbound and outbound traffic, not just the lane counts, and get the total number of vehicles from both directions? It is quite easy to do with just a few Union operators being added and linked on the canvas.

We have added Value widgets to all three union operators, so we can see the number of vehicles leaving and entering the city via this road as well as the total value. Since we have added a Histogram widget to the last union operator, we can also study the class distribution of all vehicles.

Examining the differences in vehicle class distribution between the two lanes is just as easy - just add the Histogram widget to the Gate instances of interest and you are done.

Step 4 - Wrong-way driving

We can use the capabilities of FLOW to make this highway section safer by detecting wrong-way vehicles entering the highway through the slip road. We will create two consecutive gates on the slip road and connect them with a movement. We are interested in wrong-way driving, therefore we draw the movement is in the opposite direction than the normal traffic flow, in our case from Gate 5 to Gate 6. By drag & dropping the movement filter onto the canvas, we finish the setup. Fortunately, we can see zero under the filter, which means that there were no wrong-way driving cars in our sample footage. As soon as this number changes, we know that we have a significant problem on the highway.

Finish line - Prevent an accident

We have created a detector of a very dangerous situation easily. Now we need to take action to prevent a potentially lethal accident.

We will connect FLOW to an intelligent highway infrastructure to close the road section immediately. How can we do that? Just take the UDP Zone sink and drop it on the wrong way driving movement instance. Done. This way, FLOW will push a message to the adaptive traffic sign controller only milliseconds after it has detected the predefined motion. You can read more about UDP sinks in our getting started manual.

Free Bonus - Detect stationary vehicles

Since we are finished with our job, we can add just a bit more intelligence to our camera as increasing road safety further can never hurt. 

Creating a zone for the acceleration line is a matter of a few clicks. We will combine it with a stationary time filter set for the detection of vehicles not moving for more than ten seconds. Adding a UDP Zone sink will finish the whole process. As soon as a stationary vehicle is detected, the system will alert an adaptive traffic sign controller to warn the other traffic participants. Now we have added some additional safety with no additional cost.

Conclusion

With a few minutes on our hands and FLOW operators at our disposal, we have turned an ordinary traffic camera into a highly capable sensor. We have extracted vehicle counts with a lane resolution and evaluated the vehicle type distribution within the traffic flow. At the same time, the camera was set up to detect dangerous situations in the scene and immediately alert the highway infrastructure via API if a problem in case one arises. This way we can prevent accidents and potentially save lives.

The setup can be tweaked easily whenever the requirements change, at no additional cost. Watch our webinars to hear more about other ways FLOW can be used #1 or #2. By deploying FLOW, you get the most versatile and advanced traffic brain for your highway infrastructure.

Links

• Do you have more questions? Contact us!

• Follow us on Linkedin.

• Learn more about FLOW.

• Download the demo version of FLOW.

• Visit our homepage to view products and news.

Thank you for your interest! Have a great day!

Let the traffic flow - with FLOW!

Did this answer your question?