Read Image
Libraries:
ROS Toolbox /
ROS 2
Description
The Read Image block extracts an image from a ROS
2 sensor_msgs/Image
or sensor_msgs/CompressedImage
message. You can select the message parameters of a topic active on a live ROS 2 network, or
specify the message parameters separately. The ROS 2 messages are specified as a nonvirtual
bus. Use the Subscribe block output
to receive a message from a ROS 2 network and input the message to the Read
Image block.
Note
When reading ROS 2 image messages from the network, the Data
property
of the message can exceed the maximum array length set in Simulink®. Follow the steps below to increase the maximum array length for all message
types in the model:
Enable ROS options by selecting the Robot Operating System (ROS) app under the Apps tab and configure the ROS network parameters appropriately.
From the Prepare section under Simulation tab, select ROS Toolbox > Variable Size Messages.
Uncheck Use default limits for this message type and then in the Maximum length column, increase the length based on the number of pixels in the image.
Examples
Ports
Input
Output
Parameters
Extended Capabilities
Version History
Introduced in R2021b