From 0111ecbf3b62ca1cb7808a68c70e0dad63541b37 Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Sat, 16 Mar 2024 20:31:10 -0600 Subject: [PATCH] Fix thumbnails for panoramic cameras --- frigate/util/image.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/frigate/util/image.py b/frigate/util/image.py index 0afa451b73..ef6c75ae4a 100644 --- a/frigate/util/image.py +++ b/frigate/util/image.py @@ -215,16 +215,19 @@ def calculate_16_9_crop(frame_shape, xmin, ymin, xmax, ymax, multiplier=1.25): min_size = 200 # size is the longest edge and divisible by 4 - x_size = int(xmax - xmin * multiplier) + x_size = int((xmax - xmin) * multiplier) if x_size < min_size: x_size = min_size - y_size = int(ymax - ymin * multiplier) + y_size = int((ymax - ymin) * multiplier) if y_size < min_size: y_size = min_size + if frame_shape[1] / frame_shape[0] > 16 / 9 and x_size / y_size > 4: + return None + # calculate 16x9 using height aspect_y_size = int(9 / 16 * x_size)