From 0c8e155afa618a7290474c34ad95b5e34e6fb67a Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Mon, 29 Apr 2024 09:58:53 -0600 Subject: [PATCH] Fix handling mixed masks (#11157) --- frigate/util/config.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/frigate/util/config.py b/frigate/util/config.py index d720df067..e882f0bfd 100644 --- a/frigate/util/config.py +++ b/frigate/util/config.py @@ -155,14 +155,18 @@ def get_relative_coordinates( relative_masks = [] for m in mask: points = m.split(",") - relative_masks.append( - ",".join( - [ - f"{round(int(points[i]) / frame_shape[1], 3)},{round(int(points[i + 1]) / frame_shape[0], 3)}" - for i in range(0, len(points), 2) - ] + + if any(x > "1.0" for x in points): + relative_masks.append( + ",".join( + [ + f"{round(int(points[i]) / frame_shape[1], 3)},{round(int(points[i + 1]) / frame_shape[0], 3)}" + for i in range(0, len(points), 2) + ] + ) ) - ) + else: + relative_masks.append(m) mask = relative_masks elif isinstance(mask, str) and any(x > "1.0" for x in mask.split(",")):