Skip to content

Commit 3ee14ed

Browse files
Merge pull request #26 from JohemianKnapsody/timeout-capture-array
Optional wait parameter for capture_array()
2 parents 999aeb6 + e7d5e69 commit 3ee14ed

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/labthings_picamera2/thing.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -527,16 +527,21 @@ def snap_image(self) -> ArrayModel:
527527

528528
@thing_action
529529
def capture_array(
530-
self, stream_name: Literal["main", "lores", "raw"] = "main"
530+
self,
531+
stream_name: Literal["main", "lores", "raw"] = "main",
532+
wait: Optional[float] = None,
531533
) -> ArrayModel:
532534
"""Acquire one image from the camera and return as an array
533535
534536
This function will produce a nested list containing an uncompressed RGB image.
535537
It's likely to be highly inefficient - raw and/or uncompressed captures using
536538
binary image formats will be added in due course.
539+
540+
stream_name: (Optional) The PiCamera2 stream to use, should be one of ["main", "lores", "raw"]. Default = "main"
541+
wait: (Optional, float) Set a timeout in seconds. A TimeoutError is raised if this time is exceeded during capture. Default = None
537542
"""
538543
with self.picamera() as cam:
539-
return cam.capture_array(stream_name)
544+
return cam.capture_array(stream_name, wait = wait)
540545

541546
@thing_action
542547
def capture_raw(

0 commit comments

Comments
 (0)