Main Content

ROS Write Image, ROS 2 Write Image

Write image data to a ROS or ROS 2 message

Since R2022a

  • ROS Write Image Block

Libraries:
ROS Toolbox / ROS
ROS Toolbox / ROS 2

Description

The Write Image block writes image data to a ROS or ROS 2 image message. You can specify the encoding for the output image message. Use the ROS Publish or ROS 2 Publish block to publish the output image message to an active topic on the network.

Examples

Ports

Input

expand all

Image pixel data, specified as an M-by-N-by-3 matrix for color images, and an M-by-N matrix for grayscale images.

Data Types: single | double | int8 | int16 | int32 | uint8 | uint16

Alpha channel for image, specified as an M-by-N matrix. This matrix is the same height and width as the image input. Each element has a value in the range [0,1] that indicates the opacity of the corresponding pixel, with a value of 0 being completely transparent.

Dependencies

The selected image encoding must support alpha channel.

Data Types: single | double | int8 | int16 | int32 | uint8 | uint16

Output

expand all

ROS or ROS 2 image message, returned as a nonvirtual bus. You can use the ROS Publish or ROS 2 Publish block to publish the message to an active ROS or ROS 2 network respectively.

Data Types: bus

Parameters

expand all

Image encoding for the input Image, specified as one of the supported options. For more information about encoding types, see rosReadImage.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

Version History

Introduced in R2022a