1111import numpy as np
1212
1313from ...config import CameraSettings
14- from ..base import CameraBackend , SupportLevel , register_backend
14+ from ..base import CameraBackend , CapturedFrame , SupportLevel , register_backend
1515from ..factory import DetectedCamera
1616
1717LOG = logging .getLogger (__name__ )
@@ -52,6 +52,8 @@ def __init__(self, settings):
5252 self ._actual_width : int | None = None
5353 self ._actual_height : int | None = None
5454 self ._actual_fps : float | None = None
55+ self ._camera_pixel_format : str | None = None
56+ self ._actual_output_format : str | None = None
5557
5658 self ._camera = None
5759 self ._stream = None
@@ -69,6 +71,16 @@ def actual_fps(self) -> float | None:
6971 """Return the actual frame rate of the camera after opening."""
7072 return self ._actual_fps
7173
74+ @property
75+ def actual_pixel_format (self ) -> str | None :
76+ """Camera/native pixel format requested/reported for Aravis."""
77+ return self ._camera_pixel_format or self ._pixel_format
78+
79+ @property
80+ def actual_output_format (self ) -> str | None :
81+ """Current Aravis backend emits BGR uint8 frames."""
82+ return self ._actual_output_format or "BGR8"
83+
7284 @classmethod
7385 def is_available (cls ) -> bool :
7486 """Check if Aravis is available on this system."""
@@ -360,7 +372,7 @@ def open(self) -> None:
360372
361373 self ._camera .start_acquisition ()
362374
363- def read (self ) -> tuple [ np . ndarray , float ] :
375+ def read (self ) -> CapturedFrame :
364376 """Read a frame from the camera."""
365377 if self ._camera is None or self ._stream is None :
366378 raise RuntimeError ("Aravis camera not initialized" )
@@ -418,7 +430,7 @@ def read(self) -> tuple[np.ndarray, float]:
418430 # Always push buffer back to stream
419431 self ._stream .push_buffer (buffer )
420432
421- return frame , timestamp
433+ return CapturedFrame ( frame = frame , software_timestamp = timestamp , timestamp_metadata = None )
422434
423435 def stop (self ) -> None :
424436 """Stop camera acquisition."""
@@ -615,10 +627,12 @@ def _configure_pixel_format(self) -> None:
615627
616628 if self ._pixel_format in format_map :
617629 self ._camera .set_pixel_format (format_map [self ._pixel_format ])
630+ self ._camera_pixel_format = self ._pixel_format
618631 LOG .info (f"Pixel format set to '{ self ._pixel_format } '" )
619632 else :
620633 # Try setting as string
621634 self ._camera .set_pixel_format_from_string (self ._pixel_format )
635+ self ._camera_pixel_format = self ._pixel_format
622636 LOG .info (f"Pixel format set to '{ self ._pixel_format } ' (from string)" )
623637 except Exception as e :
624638 LOG .warning (f"Failed to set pixel format '{ self ._pixel_format } ': { e } " )
0 commit comments