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

# ZenohCamera

## ZenohCamera

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`, `getCameraIntrinsics`, `setCameraIntrinsics`, `getCameraSettings`, `setCameraSettings`

### **init**

```python theme={null}
ZenohCamera.__init__(topic, shape = None, dtype = np.uint8, queue_length = 2, zenoh_config = None, auto_parse_ros2 = True)
```

Initialize ZenohCamera with direct zenoh usage

<ResponseField name="Arguments">
  <ParamField query="topic (str)" type="str" required>
    Zenoh topic to subscribe to
  </ParamField>

  <ParamField query="shape (tuple, optional)" type="tuple, optional">
    Shape of the image (height, width, channels). If None and auto\_parse\_ros2=True, will be extracted from ROS2 message
  </ParamField>

  <ParamField query="dtype (np.dtype)" type="np.dtype">
    Data type of the image data
  </ParamField>

  <ParamField query="queue_length (int)" type="int">
    Maximum size of the image queue
  </ParamField>

  <ParamField query="zenoh_config (dict, optional)" type="dict, optional">
    Zenoh configuration options
  </ParamField>

  <ParamField query="auto_parse_ros2 (bool)" type="bool">
    Whether to automatically parse ROS2 sensor\_msgs/Image messages
  </ParamField>
</ResponseField>

### from\_ros2\_topic

```python theme={null}
ZenohCamera.from_ros2_topic(topic, queue_length = 2, zenoh_config = None)
```

Create a ZenohCamera configured for ROS2 sensor\_msgs/Image messages.

This method creates a camera that will automatically parse the ROS2 message
format and extract height, width, encoding, and image data.

<ResponseField name="Arguments">
  <ParamField query="topic (str)" type="str" required>
    Zenoh topic to subscribe to (should carry ROS2 sensor\_msgs/Image)
  </ParamField>

  <ParamField query="queue_length (int)" type="int">
    Maximum size of the image queue
  </ParamField>

  <ParamField query="zenoh_config (dict, optional)" type="dict, optional">
    Zenoh configuration options
  </ParamField>
</ResponseField>

<ResponseField name="Returns">
  <ResponseField name="ZenohCamera" type="">
    Configured camera instance
  </ResponseField>
</ResponseField>

### getImage

```python theme={null}
ZenohCamera.getImage()
```

Get the latest image from the queue

<ResponseField name="Returns">
  <ResponseField name="Image" type="">
    The latest image, or None if no image is available
  </ResponseField>
</ResponseField>

### close

```python theme={null}
ZenohCamera.close()
```

Close the zenoh session and cleanup resources
