Skip to content

Commit

Permalink
adding a way to set the image size in the configuration with some sor…
Browse files Browse the repository at this point in the history
…t of default
  • Loading branch information
joe-mccarthy committed Nov 3, 2024
1 parent 8333ab1 commit 6c7fdc9
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@
"delay": 5,
"tolerance": 0.1
},
"size": {
"width": 3040,
"height": 3040
},
"format" : {
"file" : "jpg"
},
Expand Down
3 changes: 3 additions & 0 deletions src/app/capture/imaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}"

Expand Down
6 changes: 6 additions & 0 deletions src/app/configuration/nsp_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down

0 comments on commit 6c7fdc9

Please sign in to comment.