use relative coordinates for masks & zones (#10912)

* Handle zones and masks as relative coords

* Ensure that zone coords are saved as relative

* Get motion mask working with relative coordinates

* Rewrite object mask to use relative coordinates as well

* Formatting

* Fix always trying to convert

* fix mask logic
This commit is contained in:
Nicolas Mowen
2024-04-09 16:51:38 -06:00
committed by GitHub
parent ef52a1d6f0
commit 15e4f5c771
5 changed files with 258 additions and 48 deletions

View File

@@ -137,7 +137,10 @@ def stats_history():
@bp.route("/config")
def config():
config = current_app.frigate_config.model_dump(mode="json", exclude_none=True)
config_obj: FrigateConfig = current_app.frigate_config
config: dict[str, dict[str, any]] = config_obj.model_dump(
mode="json", exclude_none=True
)
# remove the mqtt password
config["mqtt"].pop("password", None)
@@ -154,9 +157,13 @@ def config():
for cmd in camera_dict["ffmpeg_cmds"]:
cmd["cmd"] = clean_camera_user_pass(" ".join(cmd["cmd"]))
# ensure that zones are relative
for zone_name, zone in config_obj.cameras[camera_name].zones.items():
camera_dict["zones"][zone_name]["color"] = zone.color
config["plus"] = {"enabled": current_app.plus_api.is_active()}
for detector, detector_config in config["detectors"].items():
for detector_config in config["detectors"].values():
detector_config["model"]["labelmap"] = (
current_app.frigate_config.model.merged_labelmap
)