#22 more fixes
This commit is contained in:
@@ -1,16 +1,18 @@
|
|||||||
from utils.utils import round_resolution
|
from utils.utils import round_resolution
|
||||||
|
|
||||||
|
ROUND_MULTIPLES = (32, 16)
|
||||||
|
|
||||||
class PiCam:
|
class PiCam:
|
||||||
def __init__(self, config: dict):
|
def __init__(self, config: dict):
|
||||||
self.capture_resolution = round_resolution(config["capture_resolution"])
|
self.capture_resolution = round_resolution(config["capture_resolution"], ROUND_MULTIPLES)
|
||||||
self.preview_resolution = round_resolution(config["preview_resolution"])
|
self.preview_resolution = round_resolution(config["preview_resolution"], ROUND_MULTIPLES)
|
||||||
|
|
||||||
def set_capture_resolution(self, resolution: "tuple[int, int]") -> None:
|
def set_capture_resolution(self, resolution: "tuple[int, int]") -> None:
|
||||||
"""Set capture resolution for camera
|
"""Set capture resolution for camera
|
||||||
|
|
||||||
:param resolution: New resolution for camera captures
|
:param resolution: New resolution for camera captures
|
||||||
"""
|
"""
|
||||||
rounded_resolution = round_resolution(resolution, (32, 16))
|
rounded_resolution = round_resolution(resolution, ROUND_MULTIPLES)
|
||||||
self.capture_resolution = rounded_resolution
|
self.capture_resolution = rounded_resolution
|
||||||
|
|
||||||
def set_preview_resolution(self, resolution: "tuple[int, int]") -> None:
|
def set_preview_resolution(self, resolution: "tuple[int, int]") -> None:
|
||||||
@@ -18,7 +20,7 @@ class PiCam:
|
|||||||
|
|
||||||
:param resolution: New resolution for camera preview
|
:param resolution: New resolution for camera preview
|
||||||
"""
|
"""
|
||||||
rounded_resolution = round_resolution(resolution, (32, 16))
|
rounded_resolution = round_resolution(resolution, ROUND_MULTIPLES)
|
||||||
self.preview_resolution = rounded_resolution
|
self.preview_resolution = rounded_resolution
|
||||||
|
|
||||||
def capture(self) -> bytearray:
|
def capture(self) -> bytearray:
|
||||||
|
|||||||
Reference in New Issue
Block a user