diff --git a/docs/docs/configuration/autotracking.md b/docs/docs/configuration/autotracking.md index b23d0d73f..23ce2830d 100644 --- a/docs/docs/configuration/autotracking.md +++ b/docs/docs/configuration/autotracking.md @@ -74,7 +74,7 @@ A fast [detector](object_detectors.md) is recommended. CPU detectors will not pe The autotracker will add PTZ motion requests to a queue while the motor is moving. Once the motor stops, the events in the queue will be executed together as one large move (rather than incremental moves). If your PTZ's motor is slow, you may not be able to reliably autotrack fast moving objects. -Zooming is an experimental feature. It may be helpful to tweak your camera's autofocus settings if you are noticing focus problems when using zooming. +Zooming is an experimental feature and may use significantly more CPU when tracking objects than panning/tilting only. It may be helpful to tweak your camera's autofocus settings if you are noticing focus problems when using zooming. ## Usage applications diff --git a/frigate/ptz/autotrack.py b/frigate/ptz/autotrack.py index 9739acb56..ff849a733 100644 --- a/frigate/ptz/autotrack.py +++ b/frigate/ptz/autotrack.py @@ -58,21 +58,20 @@ class PtzMotionEstimator: # If we've just started up or returned to our preset, reset motion estimator for new tracking session if self.ptz_metrics["ptz_reset"].is_set(): self.ptz_metrics["ptz_reset"].clear() + # homography is nice (zooming) but slow, translation is pan/tilt only but fast. if self.camera_config.onvif.autotracking.zooming: logger.debug("Motion estimator reset - homography") - self.norfair_motion_estimator = MotionEstimator( - transformations_getter=HomographyTransformationGetter(), - min_distance=30, - max_points=900, - ) + transformation_type = HomographyTransformationGetter() else: logger.debug("Motion estimator reset - translation") - self.norfair_motion_estimator = MotionEstimator( - transformations_getter=TranslationTransformationGetter(), - min_distance=30, - max_points=900, - ) + transformation_type = TranslationTransformationGetter() + + self.norfair_motion_estimator = MotionEstimator( + transformations_getter=transformation_type, + min_distance=30, + max_points=900, + ) self.coord_transformations = None diff --git a/frigate/ptz/onvif.py b/frigate/ptz/onvif.py index 9e25270c6..03abc88bf 100644 --- a/frigate/ptz/onvif.py +++ b/frigate/ptz/onvif.py @@ -434,7 +434,11 @@ class OnvifController: status_request = self.cams[camera_name]["status_request"] status = onvif.get_service("ptz").GetStatus(status_request) - if status.MoveStatus.PanTilt == "IDLE" and status.MoveStatus.Zoom == "IDLE": + # zooming is optional + pan_tilt_status = getattr(status.MoveStatus, "PanTilt", None) + zoom_status = getattr(status.MoveStatus, "Zoom", None) + + if pan_tilt_status == "IDLE" and (zoom_status is None or zoom_status == "IDLE"): self.cams[camera_name]["active"] = False if not self.ptz_metrics[camera_name]["ptz_stopped"].is_set(): self.ptz_metrics[camera_name]["ptz_stopped"].set()