> ## Documentation Index
> Fetch the complete documentation index at: https://docs.generalrobotics.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# ScaFoCamera

## ScaFoCamera

Inherits from: [`Camera`](/robot-api/reference/base/sensors/camera/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`](/robot-api/reference/base/sensors/camera/Camera): `getData`, `getCameraIntrinsics`, `setCameraIntrinsics`, `getCameraSettings`, `setCameraSettings`

### **init**

```python theme={null}
ScaFoCamera.__init__(resolution: tuple[int, int] = (640, 480), fps: int = 30, camera_model: CameraModel = CameraModel.PINHOLE)
```

Initialize the ScaFoCamera.

<ResponseField name="Arguments">
  <ParamField query="resolution (tuple[int, int])" type="tuple[int, int]">
    Image resolution (width, height). Defaults to (640, 480).
  </ParamField>

  <ParamField query="fps (int)" type="int">
    Frames per second (informational only). Defaults to 30.
  </ParamField>

  <ParamField query="camera_model (CameraModel)" type="CameraModel">
    Camera projection model. Defaults to PINHOLE.
  </ParamField>
</ResponseField>

### getImage

```python theme={null}
ScaFoCamera.getImage(image_type: str = 'rgb', camera_name: str = 'left') -> Optional[Image]
```

Return an image from the camera.

<ResponseField name="Arguments">
  <ParamField query="image_type (str)" type="str">
    Type of image to return. Options: 'rgb', 'depth', 'left', 'right'. Defaults to 'rgb'.
  </ParamField>

  <ParamField query="camera_name (str)" type="str">
    Camera name for stereo cameras. Options: 'left', 'right'. Defaults to 'left'.
  </ParamField>
</ResponseField>

<ResponseField name="Returns">
  <ResponseField name="Optional[Image]" type="Optional[Image]">
    Captured image with appropriate data type and range
  </ResponseField>
</ResponseField>

### getStereoImagePair

```python theme={null}
ScaFoCamera.getStereoImagePair() -> tuple[Image, Image]
```

Get a synchronized pair of left and right images for stereo vision.

<ResponseField name="Returns">
  <ResponseField name="returns" type="tuple[Image, Image]" />
</ResponseField>

### getExtrinsics

```python theme={null}
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.

<ResponseField name="Arguments">
  <ParamField query="source_image_frame (str)" type="str" required>
    Source frame. Valid: 'color', 'rgb', 'left', 'right'
  </ParamField>

  <ParamField query="target_image_frame (str)" type="str" required>
    Target frame. Valid: 'color', 'rgb', 'left', 'right'
  </ParamField>
</ResponseField>

<ResponseField name="Returns">
  <ResponseField name="np.ndarray" type="np.ndarray">
    4x4 homogeneous transformation matrix
  </ResponseField>
</ResponseField>

### getCameraMatrix

```python theme={null}
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]]

<ResponseField name="Arguments">
  <ParamField query="image_type (Optional[str])" type="Optional[str]">
    Camera sensor type ('left', 'color', 'rgb', 'right'). Defaults to 'left'.
  </ParamField>
</ResponseField>

<ResponseField name="Returns">
  <ResponseField name="np.ndarray" type="np.ndarray">
    3x3 camera intrinsic matrix
  </ResponseField>
</ResponseField>

### getDistortionCoefficients

```python theme={null}
ScaFoCamera.getDistortionCoefficients(image_type: str = 'left') -> np.ndarray
```

Get distortion coefficients as a numpy array of shape (5,).

<ResponseField name="Arguments">
  <ParamField query="image_type (str)" type="str">
    Camera sensor type ('left' or 'right'). Defaults to 'left'.
  </ParamField>
</ResponseField>

<ResponseField name="Returns">
  <ResponseField name="np.ndarray" type="np.ndarray">
    Distortion coefficients \[k1, k2, k3, k4, k5]
  </ResponseField>
</ResponseField>

### getFrameCount

```python theme={null}
ScaFoCamera.getFrameCount() -> int
```

Get the number of frames captured so far.

<ResponseField name="Returns">
  <ResponseField name="int" type="int">
    Total number of frames captured
  </ResponseField>
</ResponseField>

### resetFrameCount

```python theme={null}
ScaFoCamera.resetFrameCount() -> None
```

Reset the frame counter to zero.

<ResponseField name="Returns">
  <ResponseField name="returns" type="None" />
</ResponseField>
