From b9e74ee9abdb0c15dd95991df55506a318f4bade Mon Sep 17 00:00:00 2001 From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> Date: Thu, 3 Oct 2024 08:40:27 -0500 Subject: [PATCH] Fix autotracking absolute zoom interpolation logic (#14139) --- frigate/ptz/onvif.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/frigate/ptz/onvif.py b/frigate/ptz/onvif.py index bbcdf5188..fd3e3c396 100644 --- a/frigate/ptz/onvif.py +++ b/frigate/ptz/onvif.py @@ -406,19 +406,19 @@ class OnvifController: # The onvif spec says this can report as +INF and -INF, so this may need to be modified pan = numpy.interp( pan, - [-1, 1], [ self.cams[camera_name]["relative_fov_range"]["XRange"]["Min"], self.cams[camera_name]["relative_fov_range"]["XRange"]["Max"], ], + [-1, 1], ) tilt = numpy.interp( tilt, - [-1, 1], [ self.cams[camera_name]["relative_fov_range"]["YRange"]["Min"], self.cams[camera_name]["relative_fov_range"]["YRange"]["Max"], ], + [-1, 1], ) move_request.Speed = { @@ -531,11 +531,11 @@ class OnvifController: # function takes in 0 to 1 for zoom, interpolate to the values of the camera. zoom = numpy.interp( zoom, - [0, 1], [ self.cams[camera_name]["absolute_zoom_range"]["XRange"]["Min"], self.cams[camera_name]["absolute_zoom_range"]["XRange"]["Max"], ], + [0, 1], ) move_request.Speed = {"Zoom": speed} @@ -686,11 +686,11 @@ class OnvifController: # store absolute zoom level as 0 to 1 interpolated from the values of the camera self.ptz_metrics[camera_name].zoom_level.value = numpy.interp( round(status.Position.Zoom.x, 2), - [0, 1], [ self.cams[camera_name]["absolute_zoom_range"]["XRange"]["Min"], self.cams[camera_name]["absolute_zoom_range"]["XRange"]["Max"], ], + [0, 1], ) logger.debug( f"{camera_name}: Camera zoom level: {self.ptz_metrics[camera_name].zoom_level.value}"