From 29c6fde443d1ab13fe598526e5747849e5986173 Mon Sep 17 00:00:00 2001 From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> Date: Fri, 22 May 2026 14:08:06 -0500 Subject: [PATCH] regenerate zone contours and per-zone filter masks on detect resolution change --- frigate/api/app.py | 7 +++++++ frigate/util/config.py | 11 +++++++++++ 2 files changed, 18 insertions(+) diff --git a/frigate/api/app.py b/frigate/api/app.py index 179c7fb90a..35eed2b9ce 100644 --- a/frigate/api/app.py +++ b/frigate/api/app.py @@ -770,6 +770,13 @@ def _config_set_in_memory(request: Request, body: AppConfigSetBody) -> JSONRespo ), cam_cfg.objects, ) + if cam_cfg.zones: + request.app.config_publisher.publish_update( + CameraConfigUpdateTopic( + CameraConfigUpdateEnum.zones, camera + ), + cam_cfg.zones, + ) request.app.config_publisher.publish_update( CameraConfigUpdateTopic( CameraConfigUpdateEnum.refresh, camera diff --git a/frigate/util/config.py b/frigate/util/config.py index 5e5d2a0fc8..431c8bff53 100644 --- a/frigate/util/config.py +++ b/frigate/util/config.py @@ -816,6 +816,17 @@ def apply_section_update(camera_config, section: str, update: dict) -> Optional[ **filt.model_dump(exclude_unset=True, exclude={"mask", "raw_mask"}), ) + # Regenerate zone contours and per-zone filter masks at the new + # frame_shape so zone outlines and membership stay relative + for zone in camera_config.zones.values(): + if zone.filters: + for zone_obj_name, zone_filter in zone.filters.items(): + zone.filters[zone_obj_name] = RuntimeFilterConfig( + frame_shape=new_frame_shape, + **zone_filter.model_dump(exclude_unset=True), + ) + zone.generate_contour(new_frame_shape) + else: merged = deep_merge(current.model_dump(), update, override=True) setattr(camera_config, section, current.__class__.model_validate(merged))