/PTZ_PID

PID control with face tracking for PTZ camera

Primary LanguagePython

PTZ_PID

This project implements a object detector, object tracker, and PID controller for PTZOptics cameras. It is loosely based on work done at Houghton College Summer Research Institute 2021.

Detectors

There are 4 detectors currently implemented: a simple color-based detector using OpenCV thresholding and contours, a HAAR-cascade face and landmark detector using Intel HAAR cascades with OpenCV, a face detector based on OpenCV DNN Module, and a face and landmark detector using MTCNN.

The detectors are wrapped to take parameters height and width and include a detect function that returns a list of bounding boxes. See detectors.py for details. New detectors can easily be added.

Tracker

A simple cost-based, single-object tracker is used to track a given object over time. Multi-object capabilities can easily be added by minimizing the tracking cost accross multiple detections with the Hungarian algorithm or similar. See this paper for inspiration.

Controller

A PID controller is used to move a camera. The current controller is implementation specific to the PTZOptics camera using VISCA over IP. See manual for details on VISCA over IP.

As expected the controller uses the difference in the target and current position to calculate the proportional error to follow an object, the integral of the error for steady state error, and the derivative of the error for smooth movement. It also uses thresholding to limit unnecessary movement. There are multiple adjustable parameters that will be described after further updates.