From 6c7fdc9e60315a99bbccdb858fccf78d26480b0e Mon Sep 17 00:00:00 2001 From: Joe McCarthy <179146301+joe-mccarthy@users.noreply.github.com> Date: Sun, 3 Nov 2024 12:34:11 +0000 Subject: [PATCH] adding a way to set the image size in the configuration with some sort of default --- config.json | 4 ++++ src/app/capture/imaging.py | 3 +++ src/app/configuration/nsp_configuration.py | 6 ++++++ 3 files changed, 13 insertions(+) diff --git a/config.json b/config.json index 3392582..d600df4 100644 --- a/config.json +++ b/config.json @@ -57,6 +57,10 @@ "delay": 5, "tolerance": 0.1 }, + "size": { + "width": 3040, + "height": 3040 + }, "format" : { "file" : "jpg" }, diff --git a/src/app/capture/imaging.py b/src/app/capture/imaging.py index 9096c7a..d66517a 100644 --- a/src/app/capture/imaging.py +++ b/src/app/capture/imaging.py @@ -78,6 +78,9 @@ def __capture_image( ) switches = "-n --immediate --denoise cdn_hq " command = "libcamera-still " + + if capture.size.width != 0 and capture.size.height != 0: + switches += f"--width {capture.size.width} --height {capture.size.height} " call = f"{command} -o {filename} {exposure_settings} {white_balance} {switches}" diff --git a/src/app/configuration/nsp_configuration.py b/src/app/configuration/nsp_configuration.py index 9ece7ae..023bf1e 100644 --- a/src/app/configuration/nsp_configuration.py +++ b/src/app/configuration/nsp_configuration.py @@ -38,6 +38,11 @@ class CaptureFormat(JSONWizard): file: Optional[str] = "jpg" +@dataclass +class ImageSize(JSONWizard): + width: Optional[int] = 0 + height: Optional[int] = 0 + @dataclass class Capture(JSONWizard): shutter: Shutter = field(default_factory=Shutter) @@ -46,6 +51,7 @@ class Capture(JSONWizard): format: CaptureFormat = field(default_factory=CaptureFormat) gain: Gain = field(default_factory=Gain) timeout: Optional[int] = 100 + size: ImageSize = field(default_factory=ImageSize) @dataclass