optional zooming in camera status

This commit is contained in:
Josh Hawkins 2023-09-01 14:43:15 -05:00
parent 19597b4ce1
commit c6970c9d78
3 changed files with 15 additions and 12 deletions

View File

@ -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

View File

@ -58,18 +58,17 @@ 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")
transformation_type = TranslationTransformationGetter()
self.norfair_motion_estimator = MotionEstimator(
transformations_getter=TranslationTransformationGetter(),
transformations_getter=transformation_type,
min_distance=30,
max_points=900,
)

View File

@ -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()