mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-06 19:25:22 +03:00
Formatting
This commit is contained in:
parent
26b1bc8fc0
commit
90850267d2
@ -51,6 +51,7 @@ def get_standard_aspect_ratio(width: int, height: int) -> tuple[int, int]:
|
|||||||
)
|
)
|
||||||
return known_aspects[known_aspects_ratios.index(closest)]
|
return known_aspects[known_aspects_ratios.index(closest)]
|
||||||
|
|
||||||
|
|
||||||
def get_canvas_shape(width: int, height: int) -> tuple[int, int]:
|
def get_canvas_shape(width: int, height: int) -> tuple[int, int]:
|
||||||
"""Get birdseye canvas shape."""
|
"""Get birdseye canvas shape."""
|
||||||
canvas_width = width
|
canvas_width = width
|
||||||
@ -60,7 +61,9 @@ def get_canvas_shape(width: int, height: int) -> tuple[int, int]:
|
|||||||
if round(a_w / a_h, 2) != round(width / height, 2):
|
if round(a_w / a_h, 2) != round(width / height, 2):
|
||||||
canvas_width = width
|
canvas_width = width
|
||||||
canvas_height = (canvas_width / a_w) * a_h
|
canvas_height = (canvas_width / a_w) * a_h
|
||||||
logger.warning(f"The birdseye resolution is a non-standard aspect ratio, forcing birdseye resolution to {canvas_width} x {canvas_height}")
|
logger.warning(
|
||||||
|
f"The birdseye resolution is a non-standard aspect ratio, forcing birdseye resolution to {canvas_width} x {canvas_height}"
|
||||||
|
)
|
||||||
|
|
||||||
return (canvas_width, canvas_height)
|
return (canvas_width, canvas_height)
|
||||||
|
|
||||||
|
|||||||
@ -43,5 +43,5 @@ class TestBirdseye(unittest.TestCase):
|
|||||||
width = 1280
|
width = 1280
|
||||||
height = 840
|
height = 840
|
||||||
canvas_width, canvas_height = get_canvas_shape(width, height)
|
canvas_width, canvas_height = get_canvas_shape(width, height)
|
||||||
assert canvas_width == width # width will be the same
|
assert canvas_width == width # width will be the same
|
||||||
assert canvas_height != height
|
assert canvas_height != height
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user