Skip to content

Commit

Permalink
Fix handling mixed masks (blakeblackshear#11157)
Browse files Browse the repository at this point in the history
  • Loading branch information
NickM-27 authored Apr 29, 2024
1 parent 5bc9f9a commit 0c8e155
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions frigate/util/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(",")):
Expand Down

0 comments on commit 0c8e155

Please sign in to comment.