Using FLOW with PTZ cameras

See the possibilities of working with pan-tilt-zoom cameras using the ONVIF protocol.

DataFromSky avatar
Written by DataFromSky
Updated over a week ago

Normally, FLOW operates under the assumption that the cameras view the scene at a constant angle all the time. If e.g. someone moved the camera by hand to the left while FLOW is analyzing its video feed, it would seem to FLOW that all traffic objects suddenly moved to the right. The same principle goes for cameras using a pan-tilt-zoom capability to move on their own. Luckily, there's a way that lets FLOW deal with the latter case and unlock new opportunities that PTZ cameras bring compared to static ones.

Most PTZ cameras use the ONVIF PTZ protocol to control and report their position. With the correct setup, a FLOW block can read this position in real-time and react to its changes. Once you set a camera's home position in FLOW Insights, the BLOCK makes sure to stop analyzing the video feed each time the camera moves out of this position and resume analysis when the camera gets back. Let's see how to set this up in detail. Of course, first you need to set up your own PTZ camera an have it accessible through the network.

Basic setup

Go to the Analytics overview and create a new analytic, or edit an existing one. You create a new one by clicking on Add source in the top right corner. Enable Connect to a PTZ data stream and enter the corresponding credentials and IP addresses.

Once you've created the analytic, enter it, go to Analytic settings, and select the PTZ settings section.

Here you can find confirmation that the camera positions are received by FLOW. You can also set up the camera's home position. That means once the camera starts moving, the analytic is stopped until the camera gets back to the specified position and stops for at least one second—then the analytic is resumed.

Multiple home positions

You may want your PTZ camera to follow a more complex movement pattern, like:

  1. Move to position A, spend x seconds stationary

  2. Move to position B, spend y seconds stationary

  3. Move to position C, spend z seconds stationary

  4. Repeat

It's possible to analyze the traffic at each position. First, you need to go to the camera web interface and set up the movements between the desired positions. Then all that is left to do in FLOW insights is to set up a new analytic for each position you want to analyze. Make sure to use the same RTSP and ONVIF source strings. Then you can set up a different Home position and possibly operator layout for each new analytic.

Possible use cases

The power of setting up PTZ capability in FLOW lies in freeing the camera to watch a larger portion of the scene and perform multiple tasks. It also allows an operator of a mostly static camera to zoom in on a particular area of interest at any time without introducing false data into the analytics.

Once the camera starts moving, you can consider the trajectories that were tracked up to that point to be closed. To be more precise, the trajectories are interrupted and won't continue, but they'll be formally closed after a five-minute period. This somewhat limits the possible use cases—for example, a PTZ camera watching a parking lot would consider cars parked for a long time to be new traffic objects and trajectories each time it moves away and back to its home position.

That's why it's best to use PTZ cameras with a periodic movement pattern for tasks that don't require continuity of trajectories and continuous surveillance of a particular area. Examples of such tasks include:

  • Periodically counting the number of people in a particular area, e.g. a bus stop, and generating a service request event if their count crosses a threshold

  • Watching whether a vehicle has parked in a no-parking zone

  • Checking whether vehicles parked in spots reserved for particular license plate numbers have the matching license plate

And many more. If you're not sure whether PTZ cameras are suitable for your FLOW task, don't hesitate to contact us!

Did this answer your question?