Skip to content

Commit

Permalink
Fix thumbnails for panoramic cameras
Browse files Browse the repository at this point in the history
  • Loading branch information
NickM-27 committed Mar 17, 2024
1 parent 89bd386 commit 0111ecb
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions frigate/util/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 0111ecb

Please sign in to comment.