mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-07 11:45:24 +03:00
don't print zooming debug for stationary obj
This commit is contained in:
parent
acac540545
commit
2b20e7e972
@ -591,7 +591,7 @@ class PtzAutoTracker:
|
|||||||
|
|
||||||
return centroid_distance < distance_threshold
|
return centroid_distance < distance_threshold
|
||||||
|
|
||||||
def _should_zoom_in(self, camera, obj, box):
|
def _should_zoom_in(self, camera, obj, box, debug_zooming=False):
|
||||||
# returns True if we should zoom in, False if we should zoom out, None to do nothing
|
# returns True if we should zoom in, False if we should zoom out, None to do nothing
|
||||||
camera_config = self.config.cameras[camera]
|
camera_config = self.config.cameras[camera]
|
||||||
camera_width = camera_config.frame_shape[1]
|
camera_width = camera_config.frame_shape[1]
|
||||||
@ -664,7 +664,7 @@ class PtzAutoTracker:
|
|||||||
at_min_zoom = self.ptz_metrics[camera]["ptz_zoom_level"].value == 0
|
at_min_zoom = self.ptz_metrics[camera]["ptz_zoom_level"].value == 0
|
||||||
|
|
||||||
# debug zooming
|
# debug zooming
|
||||||
if True:
|
if debug_zooming:
|
||||||
logger.debug(
|
logger.debug(
|
||||||
f"{camera}: Zoom test: far from left edge: {bb_left > edge_threshold * camera_width}"
|
f"{camera}: Zoom test: far from left edge: {bb_left > edge_threshold * camera_width}"
|
||||||
)
|
)
|
||||||
@ -781,7 +781,7 @@ class PtzAutoTracker:
|
|||||||
f'{camera}: Velocity: {tuple(np.round(obj.obj_data["estimate_velocity"]).flatten().astype(int))}'
|
f'{camera}: Velocity: {tuple(np.round(obj.obj_data["estimate_velocity"]).flatten().astype(int))}'
|
||||||
)
|
)
|
||||||
|
|
||||||
zoom = self._get_zoom_amount(camera, obj, predicted_box)
|
zoom = self._get_zoom_amount(camera, obj, predicted_box, debug_zoom=True)
|
||||||
|
|
||||||
self._enqueue_move(camera, obj.obj_data["frame_time"], pan, tilt, zoom)
|
self._enqueue_move(camera, obj.obj_data["frame_time"], pan, tilt, zoom)
|
||||||
|
|
||||||
@ -791,7 +791,7 @@ class PtzAutoTracker:
|
|||||||
if zoom != 0:
|
if zoom != 0:
|
||||||
self._enqueue_move(camera, obj.obj_data["frame_time"], 0, 0, zoom)
|
self._enqueue_move(camera, obj.obj_data["frame_time"], 0, 0, zoom)
|
||||||
|
|
||||||
def _get_zoom_amount(self, camera, obj, predicted_box):
|
def _get_zoom_amount(self, camera, obj, predicted_box, debug_zoom=False):
|
||||||
camera_config = self.config.cameras[camera]
|
camera_config = self.config.cameras[camera]
|
||||||
|
|
||||||
# frame width and height
|
# frame width and height
|
||||||
@ -812,7 +812,9 @@ class PtzAutoTracker:
|
|||||||
zoom = current_zoom_level
|
zoom = current_zoom_level
|
||||||
else:
|
else:
|
||||||
if (
|
if (
|
||||||
result := self._should_zoom_in(camera, obj, obj.obj_data["box"])
|
result := self._should_zoom_in(
|
||||||
|
camera, obj, obj.obj_data["box"], debug_zoom
|
||||||
|
)
|
||||||
) is not None:
|
) is not None:
|
||||||
if result:
|
if result:
|
||||||
zoom = min(1.0, current_zoom_level + 0.1)
|
zoom = min(1.0, current_zoom_level + 0.1)
|
||||||
@ -831,6 +833,7 @@ class PtzAutoTracker:
|
|||||||
predicted_box
|
predicted_box
|
||||||
if camera_config.onvif.autotracking.movement_weights
|
if camera_config.onvif.autotracking.movement_weights
|
||||||
else obj.obj_data["box"],
|
else obj.obj_data["box"],
|
||||||
|
debug_zoom,
|
||||||
)
|
)
|
||||||
) is not None:
|
) is not None:
|
||||||
# zoom value
|
# zoom value
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user