> ## 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.

# RealsenseCamera

## RealsenseCamera

Inherits from: [`Camera`](/robot-api/reference/base/sensors/camera/Camera)

*No class docstring.*

### Inherited methods

* From [`Camera`](/robot-api/reference/base/sensors/camera/Camera): `getData`, `setCameraIntrinsics`, `getCameraSettings`, `setCameraSettings`

### **init**

```python theme={null}
RealsenseCamera.__init__() -> None
```

*No docstring provided.*

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

### init\_camera

```python theme={null}
RealsenseCamera.init_camera() -> None
```

Initialize the RealSense camera

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

### cleanup

```python theme={null}
RealsenseCamera.cleanup() -> None
```

Properly cleanup the camera resources

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

### getImage

```python theme={null}
RealsenseCamera.getImage(image_type: str | None = None) -> Image
```

Get image from RealSense camera

<ResponseField name="Arguments">
  <ParamField query="image_type (str | None)" type="str | None">
    type of image to retrieve ("rgb", "depth", "infrared"). Defaults to rgb.
  </ParamField>
</ResponseField>

<ResponseField name="Returns">
  <ResponseField name="Image" type="Image">
    requested image as numpy array
  </ResponseField>
</ResponseField>

### getStereoImagePair

```python theme={null}
RealsenseCamera.getStereoImagePair() -> tuple
```

Get the left and right infrared images, which can be used for stereo vision.

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

### getAllImages

```python theme={null}
RealsenseCamera.getAllImages() -> tuple
```

Get all images from RealSense camera (RGB, Depth, and IR), aligned to RGB

<ResponseField name="Returns">
  <ResponseField name="tuple" type="tuple">
    (rgb\_image, depth\_image, ir\_image) as Images
  </ResponseField>
</ResponseField>

### getCameraIntrinsics

```python theme={null}
RealsenseCamera.getCameraIntrinsics() -> dict
```

Get all camera intrinsic parameters, including the focal length and centerpoint,

distortion\_coefficients, distortion model, image size, etc.

<ResponseField name="Returns">
  <ResponseField name="dict" type="dict">
    camera intrinsics
  </ResponseField>
</ResponseField>

### getCameraMatrix

```python theme={null}
RealsenseCamera.getCameraMatrix(image_type: 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 (str)" type="str">
    str, Describes which camera sensor to get the matrix for. Valid values are: - "color" or "rgb" or None: the color camera (default) - "left" or "infrared": the left infrared camera - "right": the right infrared camera
  </ParamField>
</ResponseField>

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

### getDistortionCoefficients

```python theme={null}
RealsenseCamera.getDistortionCoefficients() -> np.ndarray
```

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

<ResponseField name="Returns">
  <ResponseField name="np.ndarray" type="np.ndarray">
    distortion coefficients
  </ResponseField>
</ResponseField>

### getExtrinsics

```python theme={null}
RealsenseCamera.getExtrinsics(source_image_frame: str, target_image_frame: str) -> np.ndarray
```

Get the transform of the target sensor frame with respect to the source sensor frame as a 4x4 homogeneous transformation matrix (np.ndarray)

This transform transforms a 3D point (in meters) from the source frame to the target frame.

<ResponseField name="Arguments">
  <ParamField query="source_image_frame (str)" type="str" required>
    the frame of the source sensor. Valid values are 'color', 'rgb', 'left', 'right'
  </ParamField>

  <ParamField query="target_image_frame (str)" type="str" required>
    the frame of the target sensor. Valid values are 'color', 'rgb', 'left', 'right'
  </ParamField>
</ResponseField>

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