What is PTZ?

PTZ stands for Pan-Tilt-Zoom. PTZ cameras are built with motors that allow them to change the viewing position remotely.

Normally PTZ is operated by a person at a view center for the camera. However in this article were going to do something more interesting.

Pre-requisites

This article assumes you have already setup the following

  • Dashboard V3 : At the time of writing this article the PTZ was most recently updated in the dev branch, which is now Dashboard V3.
  • Object Detection : If you haven't you can see here on how to do that https://shinobi.video/docs/object.
  • Control Settings in your Monitor Settings of Shinobi : If you added your camera through the ONVIF Scanner then it will most likely already have the PTZ controls enabled. You can verify its working by opening the Live Grid, opening the Monitor, opening the menu of it and selecting Control. If you need to setup PTZ You can see here on how to do that https://hub.shinobi.video/articles/view/eRNcAjM95fhEaZL
  • Event Filters (Optional) : You should set rules to drop events that don't have the desired object. Essentially make rules like "Object Tag Does Not Contain person = Drop Event". To learn more about Event Filters you can see this article here https://hub.shinobi.video/articles/view/Z7q0tvrIV3IGc40

Turning on PTZ Tracking

In the Control section of your Monitor Settings you will find the toggle for PTZ Tracking. Turn it on then a field will appear for which tags you want to follow. By default it will follow the "person" tag. You can change it to any tag that may appear for a detection matrix (the red box around the object when it is detected).

You can also put multiple tag names to follow different types of objects. For example you can do "person,car,truck" to follow the 3 specified Object Tags.

Other Notes about the PTZ Tracking :

  • Looks to follow the largest object found.
  • Prioritizes moving toward top of the screen if object is near the top edge and touching the bottom edge.
  • Turn Speed is based on how far the object is from the center of the screen. Further away means move faster, closer means move slower.
  • Tracking works in a "polling" fashion because we cannot get real-time data about the movement from the camera in a standardized way. It will move toward the object for half a second and stop. If it still hasn't centered the object it will do the same process again. Essentially inching toward the object.