from utils.utils import round_resolution class PiCam: def __init__(self, config: dict): self.capture_resolution = round_resolution(config["capture_resolution"]) self.preview_resolution = round_resolution(config["preview_resolution"]) def set_capture_resolution(self, resolution: "tuple[int, int]") -> None: """Set capture resolution for camera :param resolution: New resolution for camera captures """ rounded_resolution = round_resolution(resolution, (32, 16)) self.capture_resolution = rounded_resolution def set_preview_resolution(self, resolution: "tuple[int, int]") -> None: """Set resolution for camera preview (viewfinder) :param resolution: New resolution for camera preview """ rounded_resolution = round_resolution(resolution, (32, 16)) self.preview_resolution = rounded_resolution def capture(self) -> bytearray: """Capture an image :returns: Image data as a byte buffer """ raise NotImplementedError def capture_preview(self) -> bytearray: """Capture a preview image for the viewfinder :returns: Image data as a byte buffer """ raise NotImplementedError