Skip to main content

ScaFoCamera

Inherits from: Camera A software-based camera implementation. This class implements all required abstract methods from the Camera base class. Suitable for development, validation, and scenarios where physical hardware is not available. Attributes: resolution (tuple[int, int]): Image resolution (width, height) _frame_count (int): Counter for tracking number of frames captured

Inherited methods

  • From Camera: getData, getCameraIntrinsics, setCameraIntrinsics, getCameraSettings, setCameraSettings

init

ScaFoCamera.__init__(resolution: tuple[int, int] = (640, 480), fps: int = 30, camera_model: CameraModel = CameraModel.PINHOLE)
Initialize the ScaFoCamera.
Arguments
resolution (tuple[int, int])
tuple[int, int]
Image resolution (width, height). Defaults to (640, 480).
fps (int)
int
Frames per second (informational only). Defaults to 30.
camera_model (CameraModel)
CameraModel
Camera projection model. Defaults to PINHOLE.

getImage

ScaFoCamera.getImage(image_type: str = 'rgb', camera_name: str = 'left') -> Optional[Image]
Return an image from the camera.
Arguments
image_type (str)
str
Type of image to return. Options: ‘rgb’, ‘depth’, ‘left’, ‘right’. Defaults to ‘rgb’.
camera_name (str)
str
Camera name for stereo cameras. Options: ‘left’, ‘right’. Defaults to ‘left’.
Returns
Optional[Image]
Optional[Image]
Captured image with appropriate data type and range

getStereoImagePair

ScaFoCamera.getStereoImagePair() -> tuple[Image, Image]
Get a synchronized pair of left and right images for stereo vision.
Returns
returns
tuple[Image, Image]

getExtrinsics

ScaFoCamera.getExtrinsics(source_image_frame: str, target_image_frame: str) -> np.ndarray
Get the transform between camera frames as a 4x4 homogeneous transformation matrix. Returns either identity (same frame) or translation for left-to-right stereo baseline.
Arguments
source_image_frame (str)
str
required
Source frame. Valid: ‘color’, ‘rgb’, ‘left’, ‘right’
target_image_frame (str)
str
required
Target frame. Valid: ‘color’, ‘rgb’, ‘left’, ‘right’
Returns
np.ndarray
np.ndarray
4x4 homogeneous transformation matrix

getCameraMatrix

ScaFoCamera.getCameraMatrix(image_type: Optional[str] = None) -> np.ndarray
Get the camera matrix K as a numpy array of shape (3, 3). K = [[fx, 0, cx], [0, fy, cy], [0, 0, 1]]
Arguments
image_type (Optional[str])
Optional[str]
Camera sensor type (‘left’, ‘color’, ‘rgb’, ‘right’). Defaults to ‘left’.
Returns
np.ndarray
np.ndarray
3x3 camera intrinsic matrix

getDistortionCoefficients

ScaFoCamera.getDistortionCoefficients(image_type: str = 'left') -> np.ndarray
Get distortion coefficients as a numpy array of shape (5,).
Arguments
image_type (str)
str
Camera sensor type (‘left’ or ‘right’). Defaults to ‘left’.
Returns
np.ndarray
np.ndarray
Distortion coefficients [k1, k2, k3, k4, k5]

getFrameCount

ScaFoCamera.getFrameCount() -> int
Get the number of frames captured so far.
Returns
int
int
Total number of frames captured

resetFrameCount

ScaFoCamera.resetFrameCount() -> None
Reset the frame counter to zero.
Returns
returns
None