mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-05 10:45:21 +03:00
Prefer horizontal layout to vertical
This commit is contained in:
parent
3efa77f302
commit
af180729c1
@ -277,7 +277,34 @@ class BirdsEyeFrameManager:
|
|||||||
second_camera_dims = self.cameras[second_camera]["dimensions"].copy()
|
second_camera_dims = self.cameras[second_camera]["dimensions"].copy()
|
||||||
|
|
||||||
# check for optimal layout
|
# check for optimal layout
|
||||||
if first_camera_dims[0] + second_camera_dims[0] < canvas_width:
|
if first_camera_dims[0] + second_camera_dims[0] > canvas_width:
|
||||||
|
# place cameras vertically
|
||||||
|
top_scaled_width = int(
|
||||||
|
(canvas_height / 2) * first_camera_dims[0] / first_camera_dims[1]
|
||||||
|
)
|
||||||
|
bottom_scaled_width = int(
|
||||||
|
(canvas_height / 2) * second_camera_dims[0] / second_camera_dims[1]
|
||||||
|
)
|
||||||
|
return [
|
||||||
|
[
|
||||||
|
(
|
||||||
|
first_camera,
|
||||||
|
(0, 0, top_scaled_width, int(canvas_height / 2)),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
[
|
||||||
|
(
|
||||||
|
second_camera,
|
||||||
|
(
|
||||||
|
0,
|
||||||
|
int(canvas_height / 2),
|
||||||
|
bottom_scaled_width,
|
||||||
|
int(canvas_height / 2),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
]
|
||||||
|
else:
|
||||||
# place cameras horizontally
|
# place cameras horizontally
|
||||||
first_scaled_width = int(
|
first_scaled_width = int(
|
||||||
canvas_height * first_camera_dims[0] / first_camera_dims[1]
|
canvas_height * first_camera_dims[0] / first_camera_dims[1]
|
||||||
@ -321,33 +348,6 @@ class BirdsEyeFrameManager:
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
]
|
]
|
||||||
else:
|
|
||||||
# place cameras vertically
|
|
||||||
top_scaled_width = int(
|
|
||||||
(canvas_height / 2) * first_camera_dims[0] / first_camera_dims[1]
|
|
||||||
)
|
|
||||||
bottom_scaled_width = int(
|
|
||||||
(canvas_height / 2) * second_camera_dims[0] / second_camera_dims[1]
|
|
||||||
)
|
|
||||||
return [
|
|
||||||
[
|
|
||||||
(
|
|
||||||
first_camera,
|
|
||||||
(0, 0, top_scaled_width, int(canvas_height / 2)),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
[
|
|
||||||
(
|
|
||||||
second_camera,
|
|
||||||
(
|
|
||||||
0,
|
|
||||||
int(canvas_height / 2),
|
|
||||||
bottom_scaled_width,
|
|
||||||
int(canvas_height / 2),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
]
|
|
||||||
|
|
||||||
def calculate_layout(
|
def calculate_layout(
|
||||||
canvas, cameras_to_add: list[str], coefficient
|
canvas, cameras_to_add: list[str], coefficient
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user