ImageClient

Inherits from: ROSClient

A ROS client for handling image messages.

This class inherits from ROSClient and provides functionality for publishing and receiving image messages over ROS topics, with support for various image encodings and formats.

ImageClient

ImageClient(client_dict, agent_dict)

Initialize the image client.

Arguments
client_dict (dict)
required

Configuration dictionary for the client

agent_dict (dict), optional

defaults to None. Dictionary of agent parameters. Defaults to None.

decode_image

ImageClient.decode_image(data, height, width, encoding)

Decode image data from ROS message format.

Arguments
data (str)
required

Base64 encoded image data

height (int)
required

Image height in pixels

width (int)
required

Image width in pixels

encoding (str)
required

Image encoding format. Supported formats:

  • ‘rgb8’: 8-bit RGB color
  • ‘bgr8’: 8-bit BGR color (converted to RGB)
  • ‘rgba8’: 8-bit RGBA color (converted to RGB)
  • ‘bgra8’: 8-bit BGRA color (converted to RGB)
  • ‘32FC1’: 32-bit floating point grayscale
Returns

Decoded image array in RGB format (for color images) or grayscale format (for ‘32FC1’). For RGB format, has shape (height, width, 3). For grayscale, has shape (height, width, 1).

publish_agent_image

ImageClient.publish_agent_image()

publish_image

ImageClient.publish_image(data)

Publish an image to the configured topic.

Arguments
data (numpy.ndarray)
required

Image data to publish

get_image

ImageClient.get_image()

Get the most recent processed image.

Returns

The most recent image data, or None if no image is available

Was this page helpful?