Skip to content

Commit 1c91e59

Browse files
Add full res array capture to capture_array
1 parent 1ef11c4 commit 1c91e59

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

src/labthings_picamera2/thing.py

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ def snap_image(self) -> ArrayModel:
528528
@thing_action
529529
def capture_array(
530530
self,
531-
stream_name: Literal["main", "lores", "raw"] = "main",
531+
stream_name: Literal["main", "lores", "raw", "full"] = "main",
532532
wait: Optional[float] = None,
533533
) -> ArrayModel:
534534
"""Acquire one image from the camera and return as an array
@@ -537,9 +537,13 @@ def capture_array(
537537
It's likely to be highly inefficient - raw and/or uncompressed captures using
538538
binary image formats will be added in due course.
539539
540-
stream_name: (Optional) The PiCamera2 stream to use, should be one of ["main", "lores", "raw"]. Default = "main"
540+
stream_name: (Optional) The PiCamera2 stream to use, should be one of ["main", "lores", "raw", "full"]. Default = "main"
541541
wait: (Optional, float) Set a timeout in seconds. A TimeoutError is raised if this time is exceeded during capture. Default = None
542542
"""
543+
if stream_name == "full":
544+
with self.picamera(pause_stream=True) as picam2:
545+
capture_config = picam2.create_still_configuration()
546+
return picam2.switch_mode_and_capture_array(capture_config)
543547
with self.picamera() as cam:
544548
return cam.capture_array(stream_name, wait = wait)
545549

@@ -774,15 +778,6 @@ def grab_jpeg(
774778
)
775779
return JPEGBlob.from_bytes(frame)
776780

777-
@thing_action
778-
def capture_highres_array(
779-
self,
780-
):
781-
with self.picamera(pause_stream=True) as picam2:
782-
capture_config = picam2.create_still_configuration()
783-
array = picam2.switch_mode_and_capture_array(capture_config)
784-
return array
785-
786781
@thing_action
787782
def grab_jpeg_size(
788783
self,

0 commit comments

Comments
 (0)