mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-06 19:25:22 +03:00
change exponent
This commit is contained in:
parent
4fa9f35b0a
commit
9aa7c2e28b
@ -693,6 +693,10 @@ class PtzAutoTracker:
|
|||||||
def _get_zoom_amount(self, camera, obj, predicted_box):
|
def _get_zoom_amount(self, camera, obj, predicted_box):
|
||||||
camera_config = self.config.cameras[camera]
|
camera_config = self.config.cameras[camera]
|
||||||
|
|
||||||
|
# frame width and height
|
||||||
|
camera_width = camera_config.frame_shape[1]
|
||||||
|
camera_height = camera_config.frame_shape[0]
|
||||||
|
|
||||||
zoom = 0
|
zoom = 0
|
||||||
|
|
||||||
# absolute zooming separately from pan/tilt
|
# absolute zooming separately from pan/tilt
|
||||||
@ -712,8 +716,10 @@ class PtzAutoTracker:
|
|||||||
# don't make small movements to zoom in if area hasn't changed significantly
|
# don't make small movements to zoom in if area hasn't changed significantly
|
||||||
# but always zoom out if necessary
|
# but always zoom out if necessary
|
||||||
if (
|
if (
|
||||||
"area" in obj.previous
|
abs(
|
||||||
and abs(obj.obj_data["area"] - obj.previous["area"])
|
obj.obj_data["area"]
|
||||||
|
- self.tracked_object_previous[camera].obj_data["area"]
|
||||||
|
)
|
||||||
/ obj.obj_data["area"]
|
/ obj.obj_data["area"]
|
||||||
< 0.3
|
< 0.3
|
||||||
and zoom <= zoom_level
|
and zoom <= zoom_level
|
||||||
@ -726,7 +732,8 @@ class PtzAutoTracker:
|
|||||||
if self.tracked_object_previous[camera] is None:
|
if self.tracked_object_previous[camera] is None:
|
||||||
zoom = 0
|
zoom = 0
|
||||||
else:
|
else:
|
||||||
zoom = zoom * (1 / self.zoom_factor[camera]) ** 1.5
|
zoom_level = obj.obj_data["area"] / (camera_width * camera_height)
|
||||||
|
zoom = min(1, zoom_level * (1 / self.zoom_factor[camera]) ** 1.2)
|
||||||
|
|
||||||
# test if we need to zoom out
|
# test if we need to zoom out
|
||||||
if not self._should_zoom_in(
|
if not self._should_zoom_in(
|
||||||
@ -738,6 +745,8 @@ class PtzAutoTracker:
|
|||||||
):
|
):
|
||||||
zoom = -zoom
|
zoom = -zoom
|
||||||
|
|
||||||
|
logger.debug(f"Zoom amount: {zoom}")
|
||||||
|
|
||||||
return zoom
|
return zoom
|
||||||
|
|
||||||
def _lost_object_zoom(self, camera, obj):
|
def _lost_object_zoom(self, camera, obj):
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user