mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-06 11:15:21 +03:00
bugfixes
This commit is contained in:
parent
57588a8287
commit
2eb474b437
@ -199,6 +199,8 @@ class PtzAutoTracker:
|
|||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
self.onvif.get_camera_status(camera_name)
|
||||||
|
|
||||||
# movement thread per camera
|
# movement thread per camera
|
||||||
if not self.move_threads or not self.move_threads[camera_name]:
|
if not self.move_threads or not self.move_threads[camera_name]:
|
||||||
self.move_threads[camera_name] = threading.Thread(
|
self.move_threads[camera_name] = threading.Thread(
|
||||||
@ -279,7 +281,6 @@ class PtzAutoTracker:
|
|||||||
camera_config = self.config.cameras[camera]
|
camera_config = self.config.cameras[camera]
|
||||||
|
|
||||||
if camera_config.onvif.autotracking.zooming:
|
if camera_config.onvif.autotracking.zooming:
|
||||||
# frame width and height
|
|
||||||
camera_width = camera_config.frame_shape[1]
|
camera_width = camera_config.frame_shape[1]
|
||||||
camera_height = camera_config.frame_shape[0]
|
camera_height = camera_config.frame_shape[0]
|
||||||
camera_area = camera_width * camera_height
|
camera_area = camera_width * camera_height
|
||||||
@ -291,6 +292,7 @@ class PtzAutoTracker:
|
|||||||
# ensure zooming level is in range
|
# ensure zooming level is in range
|
||||||
# if so, check if bounding box is 10% of an edge
|
# if so, check if bounding box is 10% of an edge
|
||||||
# if so, try zooming in, otherwise try zooming out
|
# if so, try zooming in, otherwise try zooming out
|
||||||
|
# should we make these configurable?
|
||||||
edge_threshold = 0.1
|
edge_threshold = 0.1
|
||||||
area_threshold = 0.6
|
area_threshold = 0.6
|
||||||
|
|
||||||
@ -473,4 +475,11 @@ class PtzAutoTracker:
|
|||||||
autotracker_config.return_preset.lower(),
|
autotracker_config.return_preset.lower(),
|
||||||
)
|
)
|
||||||
self.ptz_metrics[camera]["ptz_reset"].set()
|
self.ptz_metrics[camera]["ptz_reset"].set()
|
||||||
|
|
||||||
|
# empty move queue
|
||||||
|
while not self.move_queues[camera].empty():
|
||||||
|
self.move_queues[camera].get()
|
||||||
|
|
||||||
|
# clear tracked object
|
||||||
|
self.tracked_object[camera] = None
|
||||||
self.tracked_object_previous[camera] = None
|
self.tracked_object_previous[camera] = None
|
||||||
|
|||||||
@ -458,11 +458,18 @@ class OnvifController:
|
|||||||
self.ptz_metrics[camera_name]["ptz_stop_time"].value = 0
|
self.ptz_metrics[camera_name]["ptz_stop_time"].value = 0
|
||||||
|
|
||||||
if self.config.cameras[camera_name].onvif.autotracking.zooming:
|
if self.config.cameras[camera_name].onvif.autotracking.zooming:
|
||||||
# interpolate the actual zoom level reported by the camera into the relative zoom range
|
# store zoom level as 0 to 1 interpolated from the values of the camera
|
||||||
self.ptz_metrics[camera_name][
|
self.ptz_metrics[camera_name]["ptz_zoom_level"].value = numpy.interp(
|
||||||
"ptz_zoom_level"
|
round(status.Position.Zoom.x, 2),
|
||||||
].value = status.Position.Zoom.x
|
[0, 1],
|
||||||
logger.debug(f"Camera zoom level: {status.Position.Zoom.x}")
|
[
|
||||||
|
self.cams[camera_name]["absolute_zoom_range"]["XRange"]["Min"],
|
||||||
|
self.cams[camera_name]["absolute_zoom_range"]["XRange"]["Max"],
|
||||||
|
],
|
||||||
|
)
|
||||||
|
logger.debug(
|
||||||
|
f'Camera zoom level: {self.ptz_metrics[camera_name]["ptz_zoom_level"].value}'
|
||||||
|
)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"pan": status.Position.PanTilt.x,
|
"pan": status.Position.PanTilt.x,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user